Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

How to not put a function into a variable

$
0
0
Greetings.

I'm constantly getting the problem of being unable to distinguish whether the variable is going to be set to a value or to a function itself. Usually it takes me some time to try all the possible variants I could think of to find the solution, but this time I'm stuck.

I'm trying to build "doors" from each of 10 "roomN" passages to other within a (live:) macro. The problem is it's getting set to a (link-to: variable), not to a (link-to: value), no matter how I set it up. So after the macro stops, I have all doors leading to the 9th and 10th, because it's set to (link-to: $n), which is (link-to: "room9"). And I want them to be set to (link-to: "room1"), (link-to: "room2"), etc.

All (passage: "room")'s doors are set to (a:) beforehand.

(set: $index to 0)
(set: $roomam to 1)
(live: 10ms)[
(if: $roomam is 10)[(stop:)]
(if: $roomam is not 10)[
(set: $index to it + 1)
(set: $roomam to it + 1)
(set: $n to "room" + (text: $index))
(set: $m to "room" + (text: $roomam))
(set: $l to (link-goto: "$n"))
(set: (passage: $m)'s doors to it + (a: "$l"))
(set: (passage: $n)'s doors to it + (a: "(link-goto: $m)"))
]
]

There may be better ways to do so (I only want it to be done automatically, 'cause I want to add some random logic to door generation), so I would be glad to get any solution, or to be simply explained about the idea of how to set to a value or to a variable.

Thank you in advance!

Viewing all articles
Browse latest Browse all 1844

Trending Articles