Okay, so the Combat Skill and Endurance values are going to get used during combat and in general (there are some Passages that will damage Endurance). Along with them, there are 10 ‘Disciplines’ that are going to get checked throughout the story. All Passages will have default choices, like “go left” or “go right,” but in some Passages your disciplines will give extra choices, or extra information about the choices.
Complicating things though, some disciplines will also effect combat, and have other uses. So first we need to set them up, and then look at all the ways they need to be referenced.
Here are the disciplines from the book... (note, the ‘Action Chart’ is just your character sheet)
Kai Disciplines
Over the centuries, the Kai monks have mastered the skills of the warrior. These skills are known as the Kai Disciplines, and they are taught to all Kai Lords. You have learnt only five of the skills listed below. The choice of which five skills these are, is for you to make. As all of the Disciplines may be of use to you at some point on your perilous quest, pick your five with care. The correct use of a Discipline at the right time can save your life.
When you have chosen your five Disciplines, enter them in the Kai Disciplines section of your Action Chart.
Camouflage
This Discipline enables a Kai Lord to blend in with his surroundings. In the countryside, he can hide undetected among trees and rocks and pass close to an enemy without being seen. In a town or city, it enables him to look and sound like a native of that area, and can help him to find shelter or a safe hiding place.
If you choose this skill, write ‘Camouflage’ on your Action Chart.
Hunting
This skill ensures that a Kai Lord will never starve in the wild. He will always be able to hunt for food for himself except in areas of wasteland and desert. The skill also enables a Kai Lord to be able to move stealthily when stalking his prey.
If you choose this skill, write ‘Hunting: no need for a Meal when instructed to eat’ on your Action Chart.
Sixth Sense
This skill may warn a Kai Lord of imminent danger. It may also reveal the true purpose of a stranger or strange object encountered in your adventure.
If you choose this skill, write ‘Sixth Sense’ on your Action Chart.
Tracking
This skill enables a Kai Lord to make the correct choice of a path in the wild, to discover the location of a person or object in a town or city and to read the secrets of footprints or tracks.
If you choose this skill, write ‘Tracking’ on your Action Chart.
Healing
This Discipline can be used to restore ENDURANCE points lost in combat. If you possess this skill you may restore 1 ENDURANCE point to your total for every numbered section of the book you pass through in which you are not involved in combat. (This is only to be used after your ENDURANCE has fallen below its original level.) Remember that your ENDURANCE cannot rise above its original level.
If you choose this skill write ‘Healing: +1 ENDURANCE point for each section without combat’ on your Action Chart.
Weaponskill
Upon entering the Kai Monastery, each initiate is taught to master one type of weapon. If Weaponskill is to be one of your Kai Disciplines, pick a number in the usual way from the Random Number Table, and then find the corresponding weapon from the list below. This is the weapon in which you have skill. When you enter combat carrying this weapon, you add 2 points to your COMBAT SKILL.
The fact that you are skilled with a weapon does not mean you set out on the adventure carrying that particular weapon. However, you will have opportunities to acquire weapons in the course of your adventures. If you pick the axe, you are lucky enough to be skilled in the one weapon Lone Wolf is carrying from the start of the adventure. (This will be explained fully in the Equipment section.)
You cannot carry more than 2 weapons. If you choose this skill, write ‘Weaponskill in _______ +2 COMBAT SKILL points if this weapon carried’ on your Action Chart.
Mindshield
The Darklords and many of the evil creatures in their command have the ability to attack you using their Mindforce. The Kai Discipline of Mindshield prevents you from losing any ENDURANCE points when subjected to this form of attack.
If you choose this skill, write ‘Mindshield: no points lost when attacked by Mindblast’ on your Action Chart.
Mindblast
This enables a Kai Lord to attack an enemy using the force of his mind. It can be used at the same time as normal combat weapons and adds two extra points to your COMBAT SKILL. Not all the creatures encountered on this adventure will be harmed by Mindblast. You will be told if a creature is immune.
If you choose this skill, write ‘Mindblast: +2 COMBAT SKILL points’ on your Action Chart.
Animal Kinship
This skill enables a Kai Lord to communicate with some animals and to be able to guess the intentions of others.
If you choose this skill, write ‘Animal Kinship’ on your Action Chart.
Mind Over Matter
Mastery of this Discipline enables a Kai Lord to move small objects with his powers of concentration.
If you choose this skill, write ‘Mind Over Matter’ on your Action Chart.
If you successfully complete the mission as set in Book 1 of Lone Wolf, you may add a further Kai Discipline of your choice to your Action Chart in Book 2. This additional skill, together with your five other skills and any Special Items that you have picked up in Book 1, may then be used in the next adventure of the Lone Wolf series which is called Fire on the Water.
Okay, so 10 disciplines as a base. Player chooses 5. Complicating things, one of them, Weaponskill, is random - the player chooses to take the discipline, but which weapon is randomly determined from a list of 9.
Alright, starting with the basics, we need to initialize the disciplines. They are going to be binary, either you have them or you don't. So, I can create a dataset (which I think it's properly called) that will have each discipline and a true/false flag together. Then I can check that true/false really easily.
Weaponskill is a funny one, since there are 9 sub-types. I'm sure there are several ways to do it, but I'm going to just keep the true/false and make each sub-type have it's own name. So, that gives me this code to set my variables...
<<set $Disciplines to {"Camouflage": false,
"Hunting": false,
"Sixth Sense": false,
"Tracking": false,
"Healing": false,
"Weaponskill-Dagger": false,
"Weaponskill-Spear": false,
"Weaponskill-Mace": false,
"Weaponskill-ShortSword": false,
"Weaponskill-Warhammer": false,
"Weaponskill-Sword": false,
"Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false,
"Weaponskill-Broadsword": false,
"Mindshield": false,
"Mindblast": false,
"Animal Kinship": false,
"Mind Over Matter": false}>>
"Hunting": false,
"Sixth Sense": false,
"Tracking": false,
"Healing": false,
"Weaponskill-Dagger": false,
"Weaponskill-Spear": false,
"Weaponskill-Mace": false,
"Weaponskill-ShortSword": false,
"Weaponskill-Warhammer": false,
"Weaponskill-Sword": false,
"Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false,
"Weaponskill-Broadsword": false,
"Mindshield": false,
"Mindblast": false,
"Animal Kinship": false,
"Mind Over Matter": false}>>
I can use spaces in the names, which will make them more readable (though you'll notice as I'm working on the code I forget to :).
Now that I have a big list of disciplines, I can check them with a simple if-then macro. In fact, the first passage in the book has you check for the ‘Sixth Sense’ discipline...
At the foot of the hill, the path splits into two directions, both leading into a large wood.
If you wish to use your Kai Discipline of Sixth Sense, turn to 141.
If you wish to take the right path into the wood, turn to 85.
If you wish to follow the left track, turn to 275.
Okay, so a few things here. First, we're finally getting into making and linking Passages. In Twine making a new Passage is easy, just put [[ ]] around the part you want the player to click on - and as a bonus, if that Passage doesn't exist, Twine will make a blank one for you. SoI can make the bottom two regular options like so...
At the foot of the hill, the path splits into two directions, both leading into a large wood.
If you wish to use your Kai Discipline of Sixth Sense, turn to 141.
If you wish to [[take the right path into the wood, turn to 85.]]
If you wish to [[follow the left track, turn to 275.]]
Thing is though, making them that way means my new Passages are going to be titled “take the right path into the wood, turn to 85” and such. Since this is all going to be handled by Twine, I don't think my players need the passage numbers, I just want the text to be visible. I do want to keep the passage numbers, to use as the titles of my Passages. You can change around the text displayed and the Passage titles with an arrow, like so...
At the foot of the hill, the path splits into two directions, both leading into a large wood.
If you wish to use your Kai Discipline of Sixth Sense, turn to 141.
If you wish to [[take the right path into the wood->85]]
If you wish to [[follow the left track->275]]
Which will look like this.
Or, I can keep the original and put the link in the middle of the text, targeting the same Passage names.
None of which is that important, this is just to illustrate that you have several options when it comes to what you want to display on the screen and what titles you want to give your Passages. Just remember the left of the arrow is what the player sees, right of the arrow is the name of the Passage. Also remember that case matters in Passage titles, “ThisPassage” and “thispassage” are two different ones.
So, what does happen if you have the discipline?
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.
If you wish to head south, turn to 56.
Or if you wish to cut through the heavier foliage towards the northeast, turn to 333.
Okay, so now I need to write the code check for the discipline. And of course, there are a couple of ways to do this and things to consider.
First, this was written in a physical book, so the reader had to determine if they had the ability and turn to that page/passage - hopefully being honest. I'm going to have the program handle everything though, so I don't need to jump to another Passage, I can add the code right here. Again, not a big difference, just a question of how you want things to look.
Second, the wording also implies that you can choose weather or not you want to use your ability. It doesn't say “if you have...” it says “if you wish to...” Looking at this section, your discipline is warning you that there are enemies, and giving you 2 new options to avoid them. But what if you don't want to? What if you're willing to fight? (granted, tht might not be a great idea) I'm going to have to keep in mind 2 possibilities - 1) the ability adds or expands on the regular, non-ability, options and 2) the ability replaces the regular options. They are not a big difference, but the code wording and order might be just a little different for each.
So let's write some code.
I've got two options, you have the discipline or you don't. So an <<if>> macro will check for the discipline and display that text, and an <<else>> macro added on will display the text if you don't have the discipline.
<<if $Disciplines["SixthSense"]>>
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.
If you wish to [[head south->56]], turn to 56.
Or if you wish to [[cut through the heavier foliage towards the northeast->333]], turn to 333.
You can choose to follow one of the paths, if you are willing to risk combat...
<<else>>
If you wish to [[take the right path into the wood->85]], turn to 85.
If you wish to [[follow the left track->275]], turn to 275.
<</if>>
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.
If you wish to [[head south->56]], turn to 56.
Or if you wish to [[cut through the heavier foliage towards the northeast->333]], turn to 333.
You can choose to follow one of the paths, if you are willing to risk combat...
<<else>>
If you wish to [[take the right path into the wood->85]], turn to 85.
If you wish to [[follow the left track->275]], turn to 275.
<</if>>
Let's take a look.
Perfect, I initialized all my disciplines to ‘false,’ so I'm seeing the no discipline version. Let's change that...
<<set $Disciplines to {"SixthSense": true}>>
Okay, it's working, but there is a lot of empty space. I'm going to throw in some <<nobr>> macros again and tighten things up a bit. which gives me this for my final code...
<<nobr>><<set $Disciplines to {"Camouflage": false, "Hunting": false,
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>
<</nobr>>At the foot of the hill, the path splits into two directions, both leading into a large wood.
<<if $Disciplines["SixthSense"]>>
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.
If you wish to [[head south->56]], turn to 56.
Or if you wish to [[cut through the heavier foliage towards the northeast->333]], turn to 333.
You can choose to follow one of the paths, if you are willing to risk combat...
If you wish to [[take the right path into the wood->85]], turn to 85.
If you wish to [[follow the left track->275]], turn to 275.
<<else>>
If you wish to [[take the right path into the wood->85]], turn to 85.
If you wish to [[follow the left track->275]], turn to 275.
<</if>>
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>
<</nobr>>At the foot of the hill, the path splits into two directions, both leading into a large wood.
<<if $Disciplines["SixthSense"]>>
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.
If you wish to [[head south->56]], turn to 56.
Or if you wish to [[cut through the heavier foliage towards the northeast->333]], turn to 333.
You can choose to follow one of the paths, if you are willing to risk combat...
If you wish to [[take the right path into the wood->85]], turn to 85.
If you wish to [[follow the left track->275]], turn to 275.
<<else>>
If you wish to [[take the right path into the wood->85]], turn to 85.
If you wish to [[follow the left track->275]], turn to 275.
<</if>>
And without discipline...
With discipline...
Okay, that makes it pretty easy to initialize and check for the disciplines. But now the slightly tricky part - the player needs to choose 5 of the 10 disciplines to start with. So I need to list them and let the player choose from the list, keeping them from choosing the same one twice, and remembering that Weaponskill is a random choice. How to go about that?
Well, my first thought was how to deal with the Weaponskill. The others are easy enough in theory, click and set the variable - but with Weaponskill I'm going to have to click, generate a random number, and then set the variable. Since it seemed like the hardest, it sounded like a good idea to try to figure that one out first.
The variable part seemed easy enough, I just had to generate a (pseudo-)random number and check it against the Weaponskill sub-types. Something that should be easy with an <<if>> macro, like this:
<<set _i to random (1, 9)>>
<<if _i == 1>><<set $Disciplines to {"Weaponskill-Dagger": true}>>You are proficient with Dagger
<<elseif _i == 2>><<set $Disciplines to {"Weaponskill-Spear": true}>>You are proficient with Spear
<<elseif _i == 3>><<set $Disciplines to {"Weaponskill-Mace": true}>>You are proficient with Mace
<<elseif _i == 4>><<set $Disciplines to {"Weaponskill-ShortSword": true}>>You are proficient with Short Sword
<<elseif _i == 5>><<set $Disciplines to {"Weaponskill-Warhammer": true}>>You are proficient with Warhammer
<<elseif _i == 6>><<set $Disciplines to {"Weaponskill-Sword": true}>>You are proficient with Sword
<<elseif _i == 7>><<set $Disciplines to {"Weaponskill-Axe": true}>>You are proficient with Axe
<<elseif _i == 8>><<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>You are proficient with Quarterstaff
<<elseif _i == 9>><<set $Disciplines to {"Weaponskill-Broadsword": true}>>You are proficient with Broadsword
<</if>>
<<if _i == 1>><<set $Disciplines to {"Weaponskill-Dagger": true}>>You are proficient with Dagger
<<elseif _i == 2>><<set $Disciplines to {"Weaponskill-Spear": true}>>You are proficient with Spear
<<elseif _i == 3>><<set $Disciplines to {"Weaponskill-Mace": true}>>You are proficient with Mace
<<elseif _i == 4>><<set $Disciplines to {"Weaponskill-ShortSword": true}>>You are proficient with Short Sword
<<elseif _i == 5>><<set $Disciplines to {"Weaponskill-Warhammer": true}>>You are proficient with Warhammer
<<elseif _i == 6>><<set $Disciplines to {"Weaponskill-Sword": true}>>You are proficient with Sword
<<elseif _i == 7>><<set $Disciplines to {"Weaponskill-Axe": true}>>You are proficient with Axe
<<elseif _i == 8>><<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>You are proficient with Quarterstaff
<<elseif _i == 9>><<set $Disciplines to {"Weaponskill-Broadsword": true}>>You are proficient with Broadsword
<</if>>
Which works...
Looking at it again, I should have said "You are proficient with the Dagger." Have to fix that. Anyways, so this works just fine. Thing is, it triggers as soon as the page loads it. I want it to trigger only if the player chooses the Weaponskill. So I thought I would just wrap it in a <<click>> and <<replace>> like I did with the Combat Skill/ Endurance and everything would be cool. Like so...
<<set _i to random (1, 9)>>
Choose the <<click "Weaponskill discipline.">>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>>You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>>You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>>You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>>You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>>You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>>You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>>You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>>You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>>You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
<span id="wpn_prof"></span>
Choose the <<click "Weaponskill discipline.">>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>>You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>>You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>>You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>>You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>>You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>>You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>>You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>>You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>>You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
<span id="wpn_prof"></span>
Pre-click...
And post-click...
Now with this one, you can click on the link all you want and nothing will change. Different from the Combat Skill/ Endurance in the last section. Because here I defined the variable number at the start of the page <<set _i to random (1, 9)>> unlike the last time when the random number was added after the click. I also put an underscore for my random number, _i, instead of the dollar sign of all my other variables, $i - because the underscore means that this is a local variable, Twine is going to forget it existed after I leave this passage, the dollar sign variables will persist throughout the story.
I can still go ahead and change the text to plain from the link anyways, just another <span> around the <<click>> and a <<replace>> before the <<if>> triggers. And while I'm formatting things, I'm not sure I like having the text saying what weapon you are proficient in so far under the link, maybe I can get them a little more cozy...
There, that looks nice - like I want it to at least, which makes my final code for this section look like...
<<set _i to random (1, 9)>>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
</span><span id="wpn_prof"></span>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
</span><span id="wpn_prof"></span>
Okay, so I can choose the tricky Weaponskill discipline/ sub-discipline, we if we did all the rest in exactly the same way, a list of basic links for the player to click on? Let's see what it would look like as code...
<<nobr>><<set $Disciplines to {"Camouflage": false, "Hunting": false,
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>
<<set _i to random (1, 9)>>
<</nobr>><span id="ak_choose"><<click "Learn Animal Kinship.">>
<<set $Disciplines to {"Animal Kinship": true}>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>><</click>></span>
<span id="c_choose"><<click "Learn Camouflage.">>
<<set $Disciplines to {"Camouflage": true}>>
<<replace #c_choose>>You know the Camouflage discipline.<</replace>><</click>></span>
<span id="h_choose"><<click "Learn Healing.">>
<<set $Disciplines to {"Healing": true}>>
<<replace #h_choose>>You know the Healing discipline.<</replace>><</click>></span>
<span id="hn_choose"><<click "Learn Hunting.">>
<<set $Disciplines to {"Hunting": true}>>
<<replace #hn_choose>>You know the Hunting discipline.<</replace>><</click>></span>
<span id="mb_choose"><<click "Learn Mindblast.">>
<<set $Disciplines to {"Mindblast": true}>>
<<replace #mb_choose>>You know the Mindblast discipline.<</replace>><</click>></span>
<span id="ms_choose"><<click "Learn Mindshield.">>
<<set $Disciplines to {"Mindshield": true}>>
<<replace #ms_choose>>You know the Mindshield discipline.<</replace>><</click>></span>
<span id="mom_choose"><<click "Learn Mind Over Matter.">>
<<set $Disciplines to {"Mind Over Matter": true}>>
<<replace #mom_choose>>You know the Mind Over Matter discipline.<</replace>><</click>></span>
<span id="ss_choose"><<click "Learn Sixth Sense.">>
<<set $Disciplines to {"Sixth Sense": true}>>
<<replace #ss_choose>>You know the Sixth Sense discipline.<</replace>><</click>></span>
<span id="t_choose"><<click "Learn Tracking.">>
<<set $Disciplines to {"Tracking": true}>>
<<replace #t_choose>>You know the Tracking discipline.<</replace>><</click>></span>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
</span><span id="wpn_prof"></span>
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>
<<set _i to random (1, 9)>>
<</nobr>><span id="ak_choose"><<click "Learn Animal Kinship.">>
<<set $Disciplines to {"Animal Kinship": true}>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>><</click>></span>
<span id="c_choose"><<click "Learn Camouflage.">>
<<set $Disciplines to {"Camouflage": true}>>
<<replace #c_choose>>You know the Camouflage discipline.<</replace>><</click>></span>
<span id="h_choose"><<click "Learn Healing.">>
<<set $Disciplines to {"Healing": true}>>
<<replace #h_choose>>You know the Healing discipline.<</replace>><</click>></span>
<span id="hn_choose"><<click "Learn Hunting.">>
<<set $Disciplines to {"Hunting": true}>>
<<replace #hn_choose>>You know the Hunting discipline.<</replace>><</click>></span>
<span id="mb_choose"><<click "Learn Mindblast.">>
<<set $Disciplines to {"Mindblast": true}>>
<<replace #mb_choose>>You know the Mindblast discipline.<</replace>><</click>></span>
<span id="ms_choose"><<click "Learn Mindshield.">>
<<set $Disciplines to {"Mindshield": true}>>
<<replace #ms_choose>>You know the Mindshield discipline.<</replace>><</click>></span>
<span id="mom_choose"><<click "Learn Mind Over Matter.">>
<<set $Disciplines to {"Mind Over Matter": true}>>
<<replace #mom_choose>>You know the Mind Over Matter discipline.<</replace>><</click>></span>
<span id="ss_choose"><<click "Learn Sixth Sense.">>
<<set $Disciplines to {"Sixth Sense": true}>>
<<replace #ss_choose>>You know the Sixth Sense discipline.<</replace>><</click>></span>
<span id="t_choose"><<click "Learn Tracking.">>
<<set $Disciplines to {"Tracking": true}>>
<<replace #t_choose>>You know the Tracking discipline.<</replace>><</click>></span>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
</span><span id="wpn_prof"></span>
(That ends up being quite the wall of text) And on the page, pre-click...
Then, after clicking 5 disciplines...
Now, this is a workable way to use what we already know to let the player choose their disciplines. It has that problem that we need to trust the player, they can click on all of the links - but I honestly don't know how to ‘turn off’ the <<click>> macro on a link. So this is not perfect, but it would work.
Of course, if you're going to do something you might as well do it right - so how else could we do this, and how to keep the player from clicking on too many? Also, I'd like to give them an “are you sure” moment so they can back out if they want before finalizing the choices. But if our list of links won't work, what will? Or might?
Well, two things come to my mind.
- Checkboxes - what if we put all 10 as checkboxes, then make sure the player can only choose 5. I don't think we can stop the player from clicking on 6+, but I do believe that before we finalize/ send the boxes we can check for how many were checked (so to speak). Not sure how that will combine with the Weaponskill macro though.
- Dropboxes - we could make 5 drop-down boxes, populated with all 10 disciplines in the first box, then the remining 9 in the next box, and so on. That'll keep everything under control. Again, not sure how it will handle the Weaponskill, but we can see.
Those come from my (admittedly limited) knowledge of HTML/ JavaScript, is there something else? Some super-special super-secret Twine/ SugarCube way of doing things? I don't know. Let me go research this...
No comments:
Post a Comment