Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Is there a way to set variable when linking to a passage?
I would like to avoid having 2 pages for setting variable.

I tried this but it breaks when using tool to convert to RenPy, while works fine in Twine:

<<set $myVariable = false>>

[[Click me to go to NextPassage and set variable to true|NextPassage][$myVariable to true]]

The tool doesn’t currently account for this, but a simple workaround would be to set the variable to true at the beginning of the passage. It would be a slightly trickier feature to add because this type of statement doesn’t explicitly exist in Ren’Py or Python to my knowledge, but let me know if you had an equivalent statement in mind + how important this is to your current workflow.

Hmm actually, I lied, I forgot that menus can be multiline. I can take a look at this, but it may take some time to find a solution.

Thanks for replying so quickly.

I wouldn't say it's crucial for my workflow. I would just need to redo some paths when I convert to renpy.

Probably in most cases you would set variable depending on choice in next passage. In my case I have some examples where I would set different bool state for variable but for both choices would take to same passage.

Like this:

<<set $hasFeature= false>>

"Would you like to have this feature?"

[[Yes, I would like to have that feature|Game Start][$hasFeature to true]]

[[No|Game Start][$hasFeature to false]]

So, if you don't see this useful for other projects, don't bother. I'll just redo these instances when converted to renpy.

Nah, I can definitely see a use for this. I didn't thoroughly test this one but here's a quick shot at it if you have some time to try it out.

It's working great now! Thanks for the quick update!

Actually I found one issue that happens on 1.2.3 version and not on 1.2.2

When I have this in Twine:

[[Try last option|Last_Option]]

In 1.2.2 it transformes properly to:

menu:

        "Try last option":

            jump last_option


while in 1.2.3 it transforms to:

menu:

        "Try last option":

    last_option        jump

Nice catch! This small update should fix that, but let me know if you spot anything else.

Thanks for the quick fix!
So far didn't noticed any other issues.