inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
4.14k stars 492 forks source link

Using the same parameter name in a thread can cause values to be lost #908

Open joningold opened 4 months ago

joningold commented 4 months ago

In the following structure, the use of the same parameter name ("-> knot") causes an issue. When the choice inside "level two" is selected, and the flow loops back into level_one.opt, the value of the first "knot" parameter is overwritten with value from the level two knot.

If the parameters are given different names, then the bug doesn't occur.

- (top) 
    ->  level_one (-> end ) 
- (end)
    -> END 

=== level_one (-> knot) 
- (opt)
    <- level_two(-> opt) 
    *   [ Knot variable is {knot} ] -> knot

=== level_two(-> knot) 
    *   [ choosing this causes the "knot" variable to change value  ]
        -> knot