HandleChatMessage question

suspectDevice12suspectDevice12 zei

een tijd geleden | Bericht #1
I am working on a game where I want to send private messages through the chat system. I am experimenting with overloading the HandleChatMessage() method, however I can not figure out how to display the text message to only 1 user. Any ideas?

Cyclone103Cyclone103 zei

een tijd geleden | Bericht #2
For the user who typed the message,
Player.send("chathandled", msg)

To send it to a user who is not the one who typed it, have some code take the second string in the array and place it into the variable "usertosend"

So if the command is /message Cyclone103 Hi! How are you? it will parse Cyclone103 as usertosend. Concatenate everything past the second part into a single string, msg.

Use this code on the serverside:

Broadcast("messagerecieved", usertosend, msg)

Have the clientside code check if the current user has the username stored in usertosend, if they don't, it should not do anything to the message and it should not parse it.

If they do, use the addChildToChat method and add the text.

If you want a complete code for this, PM me, as I have worked it out.

suspectDevice12suspectDevice12 zei

een tijd geleden | Bericht #3
Thank you much for the help! I was hoping there was some kind of flag I could use. But I got it working your way.

My new Question is what did you do for NonobaAPI.AddChildToChat(s:Sprite)?

I passed it a sprite with a TextField for a child, and it looks ugly. Did you find an easy way to make the text look and feel like what nonoba is using?

Cyclone103Cyclone103 zei

een tijd geleden | Bericht #4
No problem!

They actually provide a great example in the documentation for adding text to the chatbox, here, and the example works great. You can format the text, and change its color and background with the normal attributes of the field.

suspectDevice12suspectDevice12 zei

een tijd geleden | Bericht #5
Perfect, that was the last piece of the puzzle. Not sure how I missed it when I was looking through the documentation.

thanks again

Cyclone103Cyclone103 zei

een tijd geleden | Bericht #6
You're welcome!

Antwoord op onderwerp

Schrijf je nu in om te kunnen antwoorden op onderwerpen

Nonoba

nonoba.nl is een onafhankelijke spelletjes site waar je zowel individueel als gezamenlijk spelletjes gratis kunt spelen.

Developer gereedschap

Als je een flash spelontwerper bent hebben we gave gereedschappen die je kunnen helpen om nog betere spellen te ontwikkelen.

Geweldige Spellen

Waarom probeer je niet een van de beste online flah spellen die wij hebben voor nop?

Copyright ©2007-2012 Nonoba™ - All rights reserved.358.8006ms on SERVER34096