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.
HandleChatMessage question
Cyclone103说
很久以前 | 帖子#2
suspectDevice12说
很久以前 | 帖子#3Thank 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?
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?
Cyclone103说
很久以前 | 帖子#4No 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.
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.
suspectDevice12说
很久以前 | 帖子#5Perfect, that was the last piece of the puzzle. Not sure how I missed it when I was looking through the documentation.
thanks again
thanks again
Cyclone103说
很久以前 | 帖子#6You're welcome!
回复主题
现在就注册以回复主题
suspectDevice12说
很久以前 | 帖子#1