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.
Pages: 1
Topic closed
Hi, so I was programming a part of my bot where it selects a random block in a certain area and it is supposed to verify if it is already occupied by another block. If it is air, then it places either a crown or a coin.
However, I wasn't able to find anyway to get the current values of a block that is already placed. Is there anyway to do this? Even if it requires to make a list when it connects, it would be very helpful. I seem to understand that it would probably be possible using WPE Pro (A tool I have used many years ago), but that, I am not sure.
In any case, I'd like to know in which triggered event I should add the code as well (I'm guessing it will be in m.Type == "b" or something.
[EDIT1] Also, anyone knows how to place a coin or a crown? I seem to be able to place a block, but not a coin or a crown...
Thanks already~
Offline
You need a world deserializer wich deserializes the byte array in the WorldData you get from 'init'
I haven't found a working de-serializer from the web yet, but I don't know about you.
shh i have returned
Offline
Then I guess I'll have to search for one working.
Offline
4649's would do well, although, you can make your own deserializer once you acknowledge the way it works. you might want to try
switch (e.Type) // or m.Type
{
case "init":
Clipboard.SetText(e.ToString());
break;
}
Offline
4649's would do well, although, you can make your own deserializer once you acknowledge the way it works. you might want to try
switch (e.Type) // or m.Type { case "init": Clipboard.SetText(e.ToString()); break; }
What's 4649's? Also, why does it copy the string to the clipboard? What is this string?
Offline
What's 4649's?
We're discussing deserialization, and hence so, it refers to 4649's deserializer. there are lots of other deserializers though.
Also, why does it copy the string to the clipboard?
It copies it to the clipboard so you can paste the "init" message, and read it therefore allowing you to understand the way it works.
What is this string?
It is the text form of the init message; containing all the data one would get upon connecting.
[Edit] Also, about placing coins/crowns, you should be able to place them in a way identical to that of placing normal blocks.
con.Send(wKey, 0, x, y, 100);
Offline
Psychocrysma wrote:What's 4649's?
We're discussing deserialization, and hence so, it refers to 4649's deserializer. there are lots of other deserializers though.
Psychocrysma wrote:Also, why does it copy the string to the clipboard?
It copies it to the clipboard so you can paste the "init" message, and read it therefore allowing you to understand the way it works.
Psychocrysma wrote:What is this string?
It is the text form of the init message; containing all the data one would get upon connecting.
[Edit] Also, about placing coins/crowns, you should be able to place them in a way identical to that of placing normal blocks.
con.Send(wKey, 0, x, y, 100);
Thanks. Do you know where I can find his deserializer? That's what I meant by "What's 4649's (deserializer)". That's said, I sure think it will be fun analysing this string. I know that the "init" contained all data from connection, but what I never realised before is that it could actually be read... I feel dumb.
EDIT1: Is it this one? http://pastebin.com/9uFrYtYp If so, how do I use it to check if it is an air block from an event (m.Type == "say")
Offline
Thanks. Do you know where I can find his deserializer? That's what I meant by "What's 4649's (deserializer)". That's said, I sure think it will be fun analysing this string. I know that the "init" contained all data from connection, but what I never realised before is that it could actually be read... I feel dumb.
EDIT1: Is it this one? pastebin c0m 9uFrYtYp If so, how do I use it to check if it is an air block from an event (m.Type == "say")
It isn't.
Although, it should work fine.
All you've gotta do is add the blocks you get into a list. (It has variables such as bid, x and y)
And checking for a block is easy.
struct Block {public int x, y, bid;}
private List<Block> worldData = new List<Block>();
//You can add to the block list this way -In case you didn't know- : worldData.Add(new Block{x = /*x?*/, y = /*y?*/, bid = /*block id.*/});
//...
switch (m.Type)
{
case "say":
string spl[] = m.GetString(1).Split(' ');
if (/*player == you && */ spl[0] == ".check" && /* > optional > */ spl.Length > 1)
{
int x = int.Parse(spl[1]);//.check x y
int y = int.Parse(spl[2]);
foreach (Block b in worldData)
{
if (b.x == x && b.y == y)
con.Send("say", "/pm psychocrysma The block you specified is" + String.Format(b.bid == 0 ? " empty." : " reserved."));
// bool ? valueIfTrue : valueIfFalse ^
}
}
break;
}
[Edit] Oh right, you can find lots of other deserializers in case this one doesn't suite you. i'm pretty sure there are a few good ones on the forums. and if you would still fail to use them, i can ask tomahawk to give you his deserializer.
Offline
Psychocrysma wrote:Thanks. Do you know where I can find his deserializer? That's what I meant by "What's 4649's (deserializer)". That's said, I sure think it will be fun analysing this string. I know that the "init" contained all data from connection, but what I never realised before is that it could actually be read... I feel dumb.
EDIT1: Is it this one? pastebin c0m 9uFrYtYp If so, how do I use it to check if it is an air block from an event (m.Type == "say")It isn't.
Although, it should work fine.
All you've gotta do is add the blocks you get into a list. (It has variables such as bid, x and y)
And checking for a block is easy.struct Block {public int x, y, bid;} private List<Block> worldData = new List<Block>(); //You can add to the block list this way -In case you didn't know- : worldData.Add(new Block{x = /*x?*/, y = /*y?*/, bid = /*block id.*/}); //... switch (m.Type) { case "say": string spl[] = m.GetString(1).Split(' '); if (/*player == you && */ spl[0] == ".check" && /* > optional > */ spl.Length > 1) { int x = int.Parse(spl[1]);//.check x y int y = int.Parse(spl[2]); foreach (Block b in worldData) { if (b.x == x && b.y == y) con.Send("say", "/pm psychocrysma The block you specified is" + String.Format(b.bid == 0 ? " empty." : " reserved.")); // bool ? valueIfTrue : valueIfFalse ^ } } break; }
[Edit] Oh right, you can find lots of other deserializers in case this one doesn't suite you. i'm pretty sure there are a few good ones on the forums. and if you would still fail to use them, i can ask tomahawk to give you his deserializer.
Well, I might take you up on your offer.
Offline
Locked on request of owner.
"Sometimes failing a leap of faith is better than inching forward"
- ShinsukeIto
Offline
Pages: 1
Topic closed
[ Started around 1732499313.1621 - Generated in 0.073 seconds, 12 queries executed - Memory usage: 1.51 MiB (Peak: 1.67 MiB) ]