Page 2 of 2
Re: Gadget and Widget Cross Communication
Posted: 29 Jan 2011, 12:38
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 ()
Re: Gadget and Widget Cross Communication
Posted: 30 Jan 2011, 04:24
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?

Re: Gadget and Widget Cross Communication
Posted: 30 Jan 2011, 06:03
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.
Re: Gadget and Widget Cross Communication
Posted: 31 Jan 2011, 03:59
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?
Re: Gadget and Widget Cross Communication
Posted: 31 Jan 2011, 18:23
by knorke
why would it matter what kind of data you send?