Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic tags appear to not update in JS #853

Open
tessaSAC opened this issue Jun 23, 2023 · 3 comments
Open

Dynamic tags appear to not update in JS #853

tessaSAC opened this issue Jun 23, 2023 · 3 comments

Comments

@tessaSAC
Copy link

I've been updating CSS based on dynamic tags, but they only appear to interpolate on the inkle side of things and not in the JavaScript.

For example:

~ temp character = "Kirby"
# LABEL: { character }
VAR character = "Kirby"
# LABEL: { character }

In both cases, these populate in Inky/in the gameplay text correctly, but when printing them in the JavaScript, show { character } rather than Kirby.

@tessaSAC
Copy link
Author

Update: I also tried

~ temp tag = "LABEL: { character }"
# { tag }

and

VAR character = "Kirby"
VAR tag = "LABEL: { character }"
# { tag }

and those didn't work either (first one didn't interpolate, same as before; second one resulted an error about putting logic in a string)

@Selsynn
Copy link

Selsynn commented Jun 23, 2023

So I don't know how it should work.
Several years ago, like two (and before 1.0 version of ink, it may not work) we made this code in a game jam

    ~timedActionID1 = "YouR Value"
     #resolveItem: timedActionID1

The timedActionID1 is a VAR that holds your value.
After that there is the tag: name of the variable. However it does not work out of the box, and we had to create a special handling for it: the js went to fetch the value of the variable of the name it had. (the following is in the part of the )

        let itemId = window.STORY.story.variablesState[`${value}`];

that's the part where it transform the value of the literal timedActionID1 to the one that was variable from the ink text just over. Because JS.
Once you have it, you can do whatever you want with it.

So for it to work, you have to do some logic in the js to handle the tag, and you have to be VERY careful to write exactly the name of the variable you want.
But last I checked, it worked.

(especially you may have to rewrite how to read the current variable state, I think that changed., but the trick to interpret the value itself with the [`${value}`] should still work the same, as it's pure js)

@benjaminpstern
Copy link

This is also happening in C#. For example, # {RANDOM(1, 4)} resolves in the ink player to a number, but when calling story.currentTags in C#, it just gives "{RANDOM(1,4)}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants