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

Blablaland
Guest

Getting Messages and identifying them

Hello! It's been 4 years since I touched to a PlayerIO Library and it has changed quite a bit since then. Now, I was feeling doing a very peculiar bot and I already know what I want to do (For the curious, it will transform EE in a shooter, basically). Now, I remembered how I used to do the Chat commands, so, trying to test out how good my memory was, I tried the following:

//This one's in the connection and it works fine and all. //I'm impressed I could remember that, though there seem to have been quite a few changes since then. this.conLobby1.OnMessage += new MessageReceivedEventHandler(onMessageLobby);  public void onMessageLobby(object sender, PlayerIOClient.Message m) {      if (m.Type == "init")      {       }      else if (m.Type == "say")      {           if (m[1].ToString() == "!timeleft")          {               conLobby1.Send("say", "Testing");          }       } }

Now, that doesn't work at all, ahah. Honestly, I can't remember that part, but I found some documentation that said the string was stored on Index 1 (UserID is 0 or something). I've tried a few things already, but I guess I'm just unable to remember or it just changed a lot. Well, I'd really like to know if that m[1].ToString() is actually correct here, because that's probably the most problematic part ahah.

Thanks.

EDIT: By the way, if any of you could give a tip on how to place Blocks, to determine the position of someone and to get, in the messages, the user who placed a block. Thanks.

Last edited by Blablaland (Sep 10 2014 9:57:34 pm)

#2 Before February 2015

ugotpwned
Member
Joined: 2015-02-16
Posts: 376

Re: Getting Messages and identifying them

That's great that your back! Since you haven't touched on the Library in a while, I would suggest using either Skylight or Cupcake, the two seemingly most popular API's nowadays which basically have everything built in and make everything easy with documentation and tutorials if you need it. If you really insist on using vanilla PlayerIO this is a really resourceful page.

To answer your question more specifically your snippet of code that sends "say" seems okay, but its usually a bit cleaner to use

m.GetString(1)

instead of

m[1].ToString()

. As far as sending blocks, you need to receive the world key from the init message, its a string at the 5th index, but you'll also need to do a bit of work with it which is mentioned on the page I mentioned earlier.

Last edited by UgotPwned (Sep 10 2014 10:32:59 pm)

Offline

#3 Before February 2015

Blablaland
Guest

Re: Getting Messages and identifying them

UgotPwned wrote:

That's great that your back! Since you haven't touched on the Library in a while, I would suggest using either Skylight or Cupcake, the two seemingly most popular API's nowadays which basically have everything built in and make everything easy with documentation and tutorials if you need it. If you really insist on using vanilla PlayerIO this is a really resourceful page.

To answer your question more specifically your snippet of code that sends "say" seems okay, but its usually a bit cleaner to use

m.GetString(1)

instead of

m[1].ToString()

. As far as sending blocks, you need to receive the world key from the init message, its a string at the 5th index, but you'll also need to do a bit of work with it which is mentioned on the page I mentioned earlier.

Thank you!

Blablaland 1423758624202808

Board footer

Powered by FluxBB

[ Started around 1714875528.5893 - Generated in 0.046 seconds, 13 queries executed - Memory usage: 1.39 MiB (Peak: 1.49 MiB) ]