Would like to ask if it is possible to send what I type in to the console to my oponent screen? But only display when I want it to? Or totally do not display?
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
echo in a gadget: shows only the message, no player name. visible to all.
echo in a widget: just visble to the player running the widget. at least i think because otherwise i wonder why nobody complaint on the occaisions where i accidently spammed the chat with widgets going mad
To send chat a chatmessage from widget use Spring.SendCommands("say blabla") Spring.SendCommands("say a: blabla") for teamchat.
The above is able to send message and the opponent will be able to see.
However, I want to sent a message while the opponent do not see it. In the end, I use "/n" (insert new line) to clear the console before the opponent could see.
However, I want to sent a message while the opponent do not see it. In the end, I use "/n" (insert new line) to clear the console before the opponent could see.
This doesn't work. The opponent may be using a lua console which does not display the extra newlines or allows the user to scroll up and look at the message. If you entirely disable lua the opponent could still read the message by opening and reloading their infolog as Spring writes to it.
yup. in my case I want to send the message player A has to player B computer (infolog and also a txt file that I ask a widget to write that message). but doesn't want the player to be able to see in the console =D
Thanks knorke! Understand the concept of the communication between widget and gadget.
Say we have lots of messages going in between the widget and gadget. How do we check the contains of the message to what we want before we do the action? string.gmatch(message, keyword)?
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
in spring tanks i do it like this: (in ST there are two kind of messages the gadget can send to the widget: 1) "game event messages" like "the game has started!" etc 2) "score table messages" which is the current score of all players packed into a string)
I prefix messages with stuff so the widget can tell them apart:
Code:
luamsgpre = "tpMSGBOX" luascoremsgpre ="tpSCORE"
the gadget then does stuff like
Code:
Spring.SendLuaUIMsg (luamsgpre .. "The game has ended!") Spring.SendLuaUIMsg (luamsgpre .. "<TEAM" .. flagteam .. "> returned his flag") ... Spring.SendLuaUIMsg (luascoremsgpre .. score_string())
and on widget side:
Code:
function widget:RecvLuaMsg(msg, playerID) luamsgpre = "tpMSGBOX" luascoremsgpre ="tpSCORE" if (msg:find(luamsgpre,1,true)) then --display the message in the UI end
if (msg:find(luascoremsgpre,1,true)) then --take the string apart and update the score display end end
For widget->gadget talk I would do it the same way, I think. Just with SendLuaRulesMsg instead of SendLuaUIMsg.
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum