Log in

View Full Version : How do you tell who originally triggered a buttonfield change?



SilentRuin
June 26th, 2020, 14:04
I'm trying to figure out if the host or player changed a buttonfield (https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/389677061/buttonfield). Because if either sets a new value (setValue(state)) the other immediately receives it as if it set that new state itself and I want to know in the script logic for the buttonfield who actually triggered the change (host or player).

Is there a call to do this someplace? Obviously User.isHost just thinks "oh yeah, this is me changing" when in reality the change in state originated from the player.

SilentRuin
June 26th, 2020, 18:32
Well I solved this by dancing between onButtonPress() and onValueChanged() - it was the only way that I could find that would work.

damned
June 27th, 2020, 02:26
Typically use onClickRelease rather than onButtonPress - its a more commonly used UI so that user can change their mind.
Other than that continue... :bandit:

SilentRuin
June 27th, 2020, 05:43
Typically use onClickRelease rather than onButtonPress - its a more commonly used UI so that user can change their mind.
Other than that continue... :bandit:

This is more about changing a button state on an existing button (preventing it from changing in certain conditions) - so for this buttonfield I needed a logic combination of onButtonPress, onValueChanged, and a Db.handler in order to get what I wanted to work.