Gadget and Widget Cross Communication - Page 2

Gadget and Widget Cross Communication

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget and Widget Cross Communication

Post by knorke »

Widget to gadget communication, how would one set that up?
SendLuaRulesMsg is pretty cool sends strings and aint afraid of nothing.
An imo relative simple example is in the unit poser:
http://springrts.com/phpbb/viewtopic.php?f=14&t=25104

on the widget side:
tp_buttonsender.lua sends unsynced stuff (button presses on a players keyboard)
via Spring.SendLuaRulesMsg

on the gadget side:
tp_unitmessagetransmit.lua recieves the messages
via gadget:RecvLuaMsg ()
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Gadget and Widget Cross Communication

Post by bobthedinosaur »

2 questions:
how is the Spring.SendLuaRulesMsg able to go from widget to sync gadget?

and what is the
(needs ModUICtrl)
that has to be enabled in some spring setting? That seems like it will cause issues? :shock:
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget and Widget Cross Communication

Post by knorke »

how is the Spring.SendLuaRulesMsg able to go from widget to sync gadget?
you mean how it does not cause desync? I think it is because even though the event (ie a button press) that causes the LuaRulesMsg to be send is unsynced, the message is then multiplied and each client gets a copy and this way it keeps sync.

(needs ModUICtrl):
http://springrts.com/wiki/Lua_UnsyncedCtrl wrote:NOTE: Entries below marked (needs ModUICtrl) require the setting ModUICtrl to be enabled in the users springsettings.cfg, if you want to use them in unsynced LuaRules/LuaGaia. It is enabled by default so you generally don't need to care.
So just ignore that text i think and usually that should be fine.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Gadget and Widget Cross Communication

Post by bobthedinosaur »

well, I'm not sending button to sync. I am trying to send player specific camera data.

my question is if a player can change their settings (even though it should work by default) how bad would it screw up the code?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget and Widget Cross Communication

Post by knorke »

why would it matter what kind of data you send?
Post Reply

Return to “Lua Scripts”