Faces and changeRoutine do not work well together. #390

Open
opened 2026-02-20 10:17:05 -05:00 by deekerman · 3 comments
Owner

Originally created by @96LawDawg on GitHub (Nov 5, 2021).

I am having a problem with a changeRoutine and faces in the same widget. I made a basic widget where as the faces change, the text changes from -- to A to B to C. I tried use a changeRoutine to feed that value to another widget. But the other widget lags behind by one click. Demo room at https://virtualtabletop.io/wdyq. I used this code on the widgets on the left:

 "changeRoutine": [
    {
      "func": "SELECT",
      "property": "id",
      "value": "copy"
    },
    {
      "func": "SET",
      "property": "text",
      "value": "${PROPERTY text}"
    }
  ]

@bjalder26 found a solution using this code for the widgets on the right:

"changeRoutine": [
    {
      "func": "SELECT",
      "property": "id",
      "value": "label1"
    },
    "var face = ${PROPERTY faces} getIndex ${PROPERTY activeFace}",
    "var text = ${face} getIndex 'text'",
    {
      "func": "SET",
      "property": "text",
      "value": "${text}"
    }
  ]

But there is no reason that my code shouldn't work except for the order in which things activate. @bjalder26 suggests that activeFace updates first, then the changeRoutine fires, then the property updates.

Originally created by @96LawDawg on GitHub (Nov 5, 2021). I am having a problem with a `changeRoutine` and faces in the same widget. I made a basic widget where as the faces change, the text changes from -- to A to B to C. I tried use a `changeRoutine` to feed that value to another widget. But the other widget lags behind by one click. Demo room at [https://virtualtabletop.io/wdyq](https://virtualtabletop.io/wdyq). I used this code on the widgets on the left: ``` "changeRoutine": [ { "func": "SELECT", "property": "id", "value": "copy" }, { "func": "SET", "property": "text", "value": "${PROPERTY text}" } ] ``` @bjalder26 found a solution using this code for the widgets on the right: ``` "changeRoutine": [ { "func": "SELECT", "property": "id", "value": "label1" }, "var face = ${PROPERTY faces} getIndex ${PROPERTY activeFace}", "var text = ${face} getIndex 'text'", { "func": "SET", "property": "text", "value": "${text}" } ] ``` But there is no reason that my code shouldn't work except for the order in which things activate. @bjalder26 suggests that activeFace updates first, then the changeRoutine fires, then the property updates.
Author
Owner

@96LawDawg commented on GitHub (Nov 5, 2021):

This may be related to #536

@96LawDawg commented on GitHub (Nov 5, 2021): This may be related to #536
Author
Owner

@robartsd commented on GitHub (Nov 5, 2021):

I have not analyzed the relevant code recently, but my guess is that changing the activeFace triggers changeRoutine before the properties from the face are copied to the widget. The routine runs, then the properties from the face are copied to the widget without triggering changeRoutne again.

@robartsd commented on GitHub (Nov 5, 2021): I have not analyzed the relevant code recently, but my guess is that changing the `activeFace` triggers `changeRoutine` before the properties from the face are copied to the widget. The routine runs, then the properties from the face are copied to the widget without triggering `changeRoutne` again.
Author
Owner

@ArnoldSmith86 commented on GitHub (Nov 25, 2021):

I would like to merge #536 when we have compatibility servers for breaking changes working. After that is merged, a changeRoutine would still not trigger for the properties inside the face but a GET inside an activeFaceChangeRoutine should return the expected value.

@ArnoldSmith86 commented on GitHub (Nov 25, 2021): I would like to merge #536 when we have compatibility servers for breaking changes working. After that is merged, a `changeRoutine` would still not trigger for the properties _inside_ the face but a `GET` inside an `activeFaceChangeRoutine` should return the expected value.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/virtualtabletop#390
No description provided.