Twine Version: 2.3.13
Story Format: Sugarcube 2.34.1
As the title suggests, I’m trying to figure out if having a template provide multiple outputs is actually possible.
I’ve been trying to get a single template to print out one item each from three separate arrays.
Array one: [‘fluffy’,‘warm’,‘comfy’] Array two: [‘red’,‘blue’,‘green’] Array three: [‘jacket’,‘sweater’,‘hoodie’]
So the end result would be something like “comfy red jacket”.
My attempts haven’t worked so far. Now I know I could do this by using three separate templates, but I’m really curious if this can actually be achieved with a single template.
Honestly the reason was just to keep things contained in one template. That way I could have one template provide simple outputs like" You have a jacket." And then using another template when examining it to print out a semi random description for it.
I know I’m a little late, but I have something similar to this in my game. I’m not the best coder so I’m sure it could be improved, but this could work for you:
You have a <<cycle "$adjective">><<option "fluffy">> <<option "warm">> <<option "comfy">><</cycle>> <<cycle "$colour">><<option "red">> <<option "blue">> <<option "green">><</cycle>> <<cycle "$noun">><<option "jacket">> <<option "sweater">> <<option "hoodie">><</cycle>>.
Which players could then cycle through. If you want to know how to style it, it’s “a.macro-cycle”