Alanrockid
August 24th, 2021, 00:37
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:
<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>
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:
<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>