-
August 24th, 2021, 00:37 #1
Synch Database between host and client
So...i have this string field where you can drag and drop any text while pressing ctrl and it will change the tooltip of the string field itself.
This changes are stored in the db.xml under the "espec_forca" node, and while it works well for the user making the changes, the other clients/host will only see this when the ruleset is reloaded. How can i make this changes update instantly? I've been trying to use onUpdate() function, but i guess i don't get it very well.
Here's the code:
Code:<script> function onInit() local especializacao = window.espec_forca.getValue() if especializacao == "" then setTooltipText("Sem Especialização") else setTooltipText(especializacao) end end function onDoubleClick(x,y) local valortmp = window.pontos_forca.getValue() local dicepool = ChatManager.d10Check(valortmp) local diff = 6 + ModifierStack.getSum() ActionsManager.performRoll(nil, nil, "Força", diff, bSecretRoll, dicepool) end function onDrop(x,y,dragdata) local especializacao = window.espec_forca.getValue() if Input.isControlPressed() then window.espec_forca.setValue("Especialização: " .. dragdata.getStringData()) setTooltipText(window.espec_forca.getValue()) end end </script>
"A saint does what is right. A leader does what is necessary."
-
August 25th, 2021, 03:52 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
You need to have a trigger on the "espec_forca" field as well. Maybe a hidden string field with an onValueChanged event function to trigger the update? (This assumes parent node is already public.)
Here's an example from CoreRPG:
Code:<hs name="noderef"> <script> function onValueChanged() window.onRefChanged(); end </script> </hs>
JPG
-
August 25th, 2021, 04:32 #3
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks