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 Before February 2015

hiimsomething
Guest

case: "init" 18+

I know that case init 18+ requires a deserializer

The only thing i know is ws and we is world start and world end

msg[19]: 9 <-- Block ID

msg[20] Byte[] <-- X: Coor of Block (unserialized)

msg[21] Byte[] <-- Y Coor of Block (unserialized)

I found out the deserializer code and I modified it so I used listbox to add the data. When I connect my bot, it immediatelythrows invalidcastexception. I don't know which part is wrong.

Heres the code. Sorry I don't know well on bitwise operators

 public void Read(PlayerIOClient.Message m, uint c)  {  while (c < m.Count && !(m[c].ToString().StartsWith("PW") || m[c].ToString().StartsWith("BW")))             {  if (m[c].ToString() != "we")  {    int bid = m.GetInt(c);  byte[] array = m.GetByteArray(c + 2);  byte[] array2 = m.GetByteArray(c + 3);  int length = array.Length;  for (int n = 0; n < length; n += 2) <-- If I do m.GetByteArray(c+2).Length ,  It throws the InvalidCastException :\                     {  try  {   int x = m.GetByteArray(c + 2)[n] << 8 | m.GetByteArray(c + 2)[n + 1]; <-- Index out of bounds exception.  int y = m.GetByteArray(c + 3)[n] << 8 | m.GetByteArray(c + 3)[n + 1];   if (bid == 242 || bid == 381) // Portal (0 down, 1 left, 2 up, 3 right)  {  var rotation = m.GetInt(c + 4);  var sid = m.GetInt(c + 5);  var eid = m.GetInt(c + 6);  c += 7;  }   if (bid == 43 || bid == 165) //Coin door and gate  {  var coins = m.GetInt(c + 4);   }   if (bid == 361) //Spikes  {  var rotation = m.GetInt(c + 4); // (0 left, 1 up, 2 right, 3 down)   }   if (bid == 77 || bid == 83) //Piano or Drums  {  var note = m.GetInt(c + 4);   }   if (bid == 1000 || bid == 385 || bid == 374) // Text, Sign, World Portal  {  var text = m.GetString(c + 4);   }   if (bid == 43 || bid == 77 || bid == 83 || bid == 1000 || bid == 165 || bid == 361 || bid >= 374 && bid <= 380 || bid == 385) { c += 5; }  else if (bid == 242 || bid == 381) { c += 7; }  else { c += 4; }  block[x, y].BlockID = bid;  this.Invoke((MethodInvoker)delegate  {  listBox2.Items.Add(x + " " + y + " " + block[x, y].BlockID);  });  }  catch (Exception)  {  }   }    }  else  {  break;  }    }  }

#2 Before February 2015

hiimsomething
Guest

Re: case: "init" 18+

is this the old deserializer code or is it the new one? No matter how hard I try, the exceptions are thrown every time. If I try and catch it stops that part and not continue

#3 Before February 2015

TiKen
Member
Joined: 2015-02-24
Posts: 298

Re: case: "init" 18+

if you use EEViewer from Capasha, you can actually see what the "Init" message actually contains. With a little reflexion you'll be able to find out your own deserializer \o/

Offline

#4 Before February 2015

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

Re: case: "init" 18+

look at capasha's forum. i posted there,that might work for you.


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

Offline

hiimsomething 1423758130203302

Board footer

Powered by FluxBB

[ Started around 1713549637.5688 - Generated in 0.139 seconds, 12 queries executed - Memory usage: 1.39 MiB (Peak: 1.49 MiB) ]