0 votes
by (120 points)
So something I had wanted to try with my project was having a segment where the story is altered by a section where a player picks from a list of words and each word has point values and the story is then altered via character values at the end of the section.

How would I go about this- adding in a list of words with point values, character values changing based on the end total?

1 Answer

0 votes
by (159k points)

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on this information. As you have indicated you are using Harlowe I will assume you are using the latest version which is v3.0.2

1. You can use a Harlowe DataMap to associate the String words with their numerical values.

(set: $ratings to (dm: "Good", 1, "Better", 2, "Best", 3))

2. You can use either the (cycling-link:) macro or the (dropdown:) macro to allow the selection of one of the words contained within the above variable, you will need to use the (datanames:) macro to obtain an Array of those words (names) from the DataMap.

(set: $rating to "")

Select a rating: (cycling-link: bind $rating, ...(datanames: $ratings))
Select a rating: (dropdown: bind $rating, ...(datanames: $ratings))


3. You can use the selected word (bound to the $rating variable) to lookup the associated numerical value, after checking that a word was actually selected.
note: The following code would be placed within the Result passage referenced by the above Mark-up based link.

(set: $score to 0)
(unless: $rating is "")[
	(set: $score to $ratings's ($rating))
You selected: $rating
You scored: $score