Send message from widget -> unsynced gadget

Send message from widget -> unsynced gadget

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

Moderator: Moderators

Post Reply
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Send message from widget -> unsynced gadget

Post by Google_Frog »

How do I do this? I only know how to send this via synced gadget but it is currently undesirable to do it that way.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Send message from widget -> unsynced gadget

Post by gajop »

See this: http://springrts.com/phpbb/viewtopic.php?f=23&t=28347
Yeah.. I feel it's not possible, can you explain the use case?
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Send message from widget -> unsynced gadget

Post by SinbadEV »

Clearly I'm not directly familiar with Spring Lua, but couldn't you have some kind of "event handler" or "listener loop" in the gadget that responds to a something the widget does? Like maybe you have some kind of table that the widget puts messages in and the gadget checks to see if there are messages in that table?
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Send message from widget -> unsynced gadget

Post by gajop »

SinbadEV wrote:..
no
it's best if you consider gadget and widget as two separate programs that communicate through the engine
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Send message from widget -> unsynced gadget

Post by smoth »

please stop making posts where you make assumptions and generally just bullshit about how it might work sinbad, it only helps to confuse the issue.

Google: messages are only recieved in sync but you can put the value in _G and check on gameframe. What are you trying to do?


p.S. it is a work week so I may be slow to reply
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Send message from widget -> unsynced gadget

Post by Google_Frog »

There are a few cases of varying importance.

Currently widgets ask my metal spot system to send them the list of metal spots. This means metal spots are not accessible for replays because the synced message is not received during replays.

I have gadgets which draw graphics and some of the graphics is toggleable. Widgets send messages to toggle graphics. To me this system sounds more reasonable than constantly sending data from the gadget.

Most recently I have a terraform texturing gadget which has to be a gadget to match the terrain texture update with UHM updates. The texture application part could be widget side but that sounds expensive.

I wouldn't have a problem if unsynced gadget -> widget communication was cheap. Currently I don't know if it is expensive or not but I usually assume communication is expensive.

(I'm ignoring SinbadEV unless he proposes how to do that)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Send message from widget -> unsynced gadget

Post by jK »

Google_Frog wrote:Currently widgets ask my metal spot system to send them the list of metal spots. This means metal spots are not accessible for replays because the synced message is not received during replays.
GameRules!?!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Send message from widget -> unsynced gadget

Post by smoth »

Google_Frog wrote:There are a few cases of varying importance.

Currently widgets ask my metal spot system to send them the list of metal spots. This means metal spots are not accessible for replays because the synced message is not received during replays.
I had not heard of or seen this before, can you give more details?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Send message from widget -> unsynced gadget

Post by Google_Frog »

GameRules sounds useful for some things but can it send tables? It only solves the cases where widgets ask gadgets for information. The case where a widget sends some sort of graphics config to unsynced gadget is unsolved.

@smoth http://springrts.com/phpbb/viewtopic.ph ... 7&start=40
Post Reply

Return to “Lua Scripts”