0 votes
asked by (640 points)
So I want to add a point system where player choice causes a variable to go up and down in a range of number. I want this number to be displayed in the sidebar. Also, I want certain choices to be accessible only to a specific range of points. Is this possible and if so how? All help is appreciated.

2 Answers

0 votes
answered by (131k points)
selected by
Best answer

The following is a basic overview of each of the elements needed to implement your question.

1. Initialise the story variable(s) to be used to track the points, this should be done within your story's StoryInit special passage.

<<set $points to 0>>

2. Displaying the current number of points using naked variables or the <<print>> macro.

Points: $points

Points: <<print $points>>

3. Using a Setter Link to increase or decrease the number of points.

[[Option that increases the number of points|Next][$points += 1]]

[[Option that decreases the number of points|Next][$points -= 1]]

4. Using an <<if>> macro (and its related <<elseif>> and <<else>> to branch content based on the number of points.

<<if $points gt 0>>
	\You have more than zero points\
<<elseif $points lt 0>>
	\You have less than zero points\
	\You have zero points\


commented by (640 points)
Thanks so much for you answer, it's everything I wanted. Just one thing: how do I get $points to be always displayed in the sidebar? I'm have no knowledge of how this stuff works so help is really appreciated.
commented by (131k points)

Add a StoryCaption special passage to your story, any content you place in this passage will appear in the side-bar and the displaying of that content will automatically update each time the Reader traverses between Passages.

commented by (640 points)
Thanks guru :)
0 votes
answered by (140 points)
reshown by

First thing you need to do is install and activate the WordPoints plugin. Upon activation, visit the WordPoints » Point Hooks page to create your points type

After creating your points type, you can drag and drop hooks from left to the points type

Add a hook for activity you want to reward and then configure its settings. You can also select the post types and choose how many points to reward

Now repeat the process for each activity you want to reward. For registration hook, you will need to allow user registration on your site.

If you want to reward users for submitting posts, then please take a look at our guide on how to allow users to submit posts to your WordPress site

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.