Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2015-06-22 18:09:13

realmaster42
Formerly marcoantonimsantos
From: ̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍
Joined: 2015-02-20
Posts: 1,380
Website

[C#] Help how do i do fill with coordinates

I got this, X1,X2,Y1,Y2
Everything is set,
but it goes offset!

for (int x = FillXCor; x < FillX2Cor; x++)//((worldWidth-FillYCor)+(FillXCor-FillYCor)); x++)
                {
                    if (!con.Connected)
                    {
                        break;
                    }
                    //if (x <= FillX2Cor)
                    //{
                    for (int y = FillY2Cor; y < FillYCor; y++)
                    {
                        if (!con.Connected)
                        {
                            break;
                        }

                        if (idof > 500 && idof < 1000)
                            con.Send(worldKey, new object[] { 1, x, y, idof });
                        else
                            con.Send(worldKey, new object[] { 0, x, y, idof });
                        Thread.Sleep(Convert.ToInt32(fdelay.Value));
                    }
                    //}
                    //else
                    //{
                    //    break;
                    //}
                    Thread.Sleep(Convert.ToInt32(fdelay.Value));
                }

http://i.imgur.com/bjvgH5L.png?1

Offline

#2 2015-06-22 19:10:57, last edited by Xfrogman43 (2015-06-22 19:13:19)

Xfrogman43
Member
From: need to find a new home
Joined: 2015-02-15
Posts: 4,174

Re: [C#] Help how do i do fill with coordinates

Make numericUpDowns, or something similar.

"init":
{
 numericUpDown2.Value = worldw;
                            numericUpDown4.Value = worldh;
                            numericUpDown2.Maximum = worldw;
                            numericUpDown4.Maximum = worldh;
//this sets their value to worldwidth/height
}
//1=Startx 2=Stopx 3=Starty 4=Stopy 5=BlockID
for (int xpos = (int)numericUpDown1.Value; xpos <= (int)numericUpDown2.Value; xpos++)
                    {
                        for (int ypos = (int)numericUpDown3.Value; ypos <= (int)numericUpDown4.Value; ypos++)
                        {
                            conn.Send(roomkey, layer, xpos, ypos, (int)numericUpDown5.Value);
                            Thread.Sleep(15);
                        }
                    }

Yes there are probably better ways to do this but I just like this way.


zsbu6Xm.png thanks zoey aaaaaaaaaaaand thanks latif for the avatar

Offline

#3 2015-06-22 20:34:02

realmaster42
Formerly marcoantonimsantos
From: ̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍
Joined: 2015-02-20
Posts: 1,380
Website

Re: [C#] Help how do i do fill with coordinates

Xfrogman43 wrote:

Make numericUpDowns, or something similar.

"init":
{
 numericUpDown2.Value = worldw;
                            numericUpDown4.Value = worldh;
                            numericUpDown2.Maximum = worldw;
                            numericUpDown4.Maximum = worldh;
//this sets their value to worldwidth/height
}
//1=Startx 2=Stopx 3=Starty 4=Stopy 5=BlockID
for (int xpos = (int)numericUpDown1.Value; xpos <= (int)numericUpDown2.Value; xpos++)
                    {
                        for (int ypos = (int)numericUpDown3.Value; ypos <= (int)numericUpDown4.Value; ypos++)
                        {
                            conn.Send(roomkey, layer, xpos, ypos, (int)numericUpDown5.Value);
                            Thread.Sleep(15);
                        }
                    }

Yes there are probably better ways to do this but I just like this way.

nop doesnt work at all

plus
Im using custom coordinates with block placement. Why use numeric up down???


http://i.imgur.com/bjvgH5L.png?1

Offline

#4 2015-06-22 20:56:16

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [C#] Help how do i do fill with coordinates

this should only work if the second x-Coord is greater than the first one, so if the first X-coord = 199, and the second is 12 it will not work


if you can read this....good for you

Offline

#5 2015-06-22 21:45:39

Xfrogman43
Member
From: need to find a new home
Joined: 2015-02-15
Posts: 4,174

Re: [C#] Help how do i do fill with coordinates

marcoantonimsantos wrote:

Im using custom coordinates with block placement. Why use numeric up down???

You can set them to whatever you like, as long as 1st is less than 2nd and 3rd is less than 4th
Numeric up down so you can change to whatever.


zsbu6Xm.png thanks zoey aaaaaaaaaaaand thanks latif for the avatar

Offline

#6 2015-06-23 12:03:45

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [C#] Help how do i do fill with coordinates

well numeric up down is useless in my opinion, means you gotta find the locations frist then set em in the bot, i used 2 blocks to fill in between.


if you can read this....good for you

Offline

Wooted by:

#7 2015-06-23 12:32:09

realmaster42
Formerly marcoantonimsantos
From: ̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍
Joined: 2015-02-20
Posts: 1,380
Website

Re: [C#] Help how do i do fill with coordinates

ewoke wrote:

this should only work if the second x-Coord is greater than the first one, so if the first X-coord = 199, and the second is 12 it will not work

Yeah I verified it.

I added the 'if' exception, IF x less than first, x = second & second = first

it's faster now

But I don't see any blocks //forums.everybodyedits.com/img/smilies/sad


http://i.imgur.com/bjvgH5L.png?1

Offline

#8 2015-06-23 13:19:32

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [C#] Help how do i do fill with coordinates

also why do you check if its connected inside the forloop? and 2 times.


if you can read this....good for you

Offline

Wooted by:

#9 2015-06-23 14:28:35, last edited by BuzzerBee (2015-06-23 16:03:30)

BuzzerBee
Forum Admin
From: Texas, U.S.A.
Joined: 2015-02-15
Posts: 4,575

Re: [C#] Help how do i do fill with coordinates

Here, I saw the need for some good fill code so I made this:

                int x1, // Enter your first X coordinate
                    y1, // Enter your first Y coordinate
                    x2, // Enter your second X coordinate
                    y2; // Enter your second Y coordinate

                int diffX = x2 - x1, // Get the difference of the two X coordinates
                    diffY = y2 - y1; // Get the difference of the two Y coordinates

                for (int a = 0; a <= Math.Abs(diffX); a++) // Loops for each X coordinate that needs to be sent
                {
                    for (int b = 0; b <= Math.Abs(diffY); b++) // Loops for each Y coordinate that needs to be sent
                    {
                        int x = (diffX >= 0) ? x1 + a : x1 - a, // Checks whether the diffX is positive, negative, or 0, and adjusts accordingly
                            y = (diffY >= 0) ? y1 + b : y1 - b; // Checks whether the diffY is positive, negative, or 0, and adjusts accordingly
                        con.Send(worldKey, 0, x, y, 9); // Send the block at the X, Y coordinate
                    }
                }

I've tested it with many combinations of integers, and it works regardless of the sign. x2 can be larger or smaller than x1 or the difference can be 0, making a straight line. And of course, the same goes for y1 and y2.

Feel free to use and adapt this code for your purposes, and ask any questions about the code if you need it.
Remember not to over-complicate simple stuff such as filling!


TdQRyz3.png
https://wiki.everybodyedits.com/images/5/5d/135_bee

Offline

Wooted by: (2)

#10 2015-06-23 16:06:31

BuzzerBee
Forum Admin
From: Texas, U.S.A.
Joined: 2015-02-15
Posts: 4,575

Re: [C#] Help how do i do fill with coordinates

Also, you're going to want to change your condition to check if "idof" is >= 500 because I'm pretty sure 500 is also a BG block. Just something I noticed //forums.everybodyedits.com/img/smilies/smile


TdQRyz3.png
https://wiki.everybodyedits.com/images/5/5d/135_bee

Offline

Wooted by:

#11 2015-06-23 19:18:53

realmaster42
Formerly marcoantonimsantos
From: ̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍
Joined: 2015-02-20
Posts: 1,380
Website

Re: [C#] Help how do i do fill with coordinates

BuzzerBee wrote:

Also, you're going to want to change your condition to check if "idof" is >= 500 because I'm pretty sure 500 is also a BG block. Just something I noticed //forums.everybodyedits.com/img/smilies/smile

yeah just noticed that

BuzzerBee wrote:

Here, I saw the need for some good fill code so I made this:

                int x1, // Enter your first X coordinate
                    y1, // Enter your first Y coordinate
                    x2, // Enter your second X coordinate
                    y2; // Enter your second Y coordinate

                int diffX = x2 - x1, // Get the difference of the two X coordinates
                    diffY = y2 - y1; // Get the difference of the two Y coordinates

                for (int a = 0; a <= Math.Abs(diffX); a++) // Loops for each X coordinate that needs to be sent
                {
                    for (int b = 0; b <= Math.Abs(diffY); b++) // Loops for each Y coordinate that needs to be sent
                    {
                        int x = (diffX >= 0) ? x1 + a : x1 - a, // Checks whether the diffX is positive, negative, or 0, and adjusts accordingly
                            y = (diffY >= 0) ? y1 + b : y1 - b; // Checks whether the diffY is positive, negative, or 0, and adjusts accordingly
                        con.Send(worldKey, 0, x, y, 9); // Send the block at the X, Y coordinate
                    }
                }

I've tested it with many combinations of integers, and it works regardless of the sign. x2 can be larger or smaller than x1 or the difference can be 0, making a straight line. And of course, the same goes for y1 and y2.

Feel free to use and adapt this code for your purposes, and ask any questions about the code if you need it.
Remember not to over-complicate simple stuff such as filling!

omg thx u so much this has been questioning me for weeks


http://i.imgur.com/bjvgH5L.png?1

Offline

Wooted by:
realmaster421435083533515596

Board footer

Powered by FluxBB

[ Started around 1732477290.0607 - Generated in 0.080 seconds, 12 queries executed - Memory usage: 1.54 MiB (Peak: 1.71 MiB) ]