0 votes
by (220 points)

Hey all, hopefully a quick "well, duh!' question here: How do I format a datamap entry so that an Either: macro executes correctly and repeatedly? I'm trying to have some variety in text during battle when the enemy attacks. I've tried 

"STRtext", "(either: "dives", "claws", "kicks")",

but that makes the datamap fail to load. And

"STRtext", (either: "dives", "claws", "kicks"),

does choose one randomly, but then it stays the same option throughout all combat turns instead of choosing one randomly every turn.

The line in the actual combat passage for display is 

(elseif: $log is "enemy")[The (print: $monster's name) (print: $monster's STRtext), dealing (print: $monster's STR) damage.]

if that helps any.

1 Answer

+1 vote
by (61.3k points)

Warning, code is untested, as I'm not at my computer. 

Try nesting an array in your data map, i.e. 

"STRtext", (a: "dives", "claws", "kicks"),

Then use the (either:) on the array. 

(elseif: $log is "enemy")[\
The (print: $monster's name) (print: (either: ...$monster's STRtext)), dealing (print: $monster's STR) damage.]

 

by (220 points)
Yup, that does it. I knew I had to be missing something simple.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...