Your browser lacks required capabilities. Please upgrade it or switch to another to continue.
Loading…
/*TAG-BASED QBN DISPLAY*/
/*<<if tags().includes("location")>> <<include [[Hunt]]>> <</if>> This will display location cards (via the Hunt passage) if you're in a place where you can Hunt*/
/*<<if tags().includes("map")>> <<include [[Map Locations]]>> <</if>> This will display map locations if you're in a place where you can Hunt*/
/*TAG usage*/
/*<<if tags().includes("forest")>>…the active passage is part of the forest…<</if>>
<<if tags("Lonely Glade").includes("forest")>>…the Lonely Glade passage is part of the forest…<</if>>
Story.lookup("tags", "forest");*/<<if tags().includes("bbar")>>
<div id="bottombar">
<div id="bbblock">
<div id="bbtext" class="animate__animated">
<span class="textenter">
<<textbox "_code" "" autofocus>>
<<button "Guess!">>
<<set _code to _code.toLowerCase()>>
<<if _code.indexOf(_answer) > -1>> /*checks code against the password set by the widget argument. If password is "brain" any instance of it will work, ie "brained" or "the brain" or "xyzsbrain"*/
<<CurHP +1>>
<<set $score to $score + $reward[_hintCounter]>> /*Your reward points are added to your score!*/
/*LEVEL UP? to verse new monster? */
<<if $score gte $levelValues[$monsterLevel+1]>>
<<set $monsterLevel++>>
<<switch $monsterLevel>> /*updating the monster speech beginnings based on level */
<<case 1>> <<arraymaker "easy speech beginning">> <<set $speechbeginning to _array>>
<<case 4>> <<arraymaker "medium speech beginning">> <<set $speechbeginning to _array>>
<<case 7>> <<arraymaker "hard speech beginning">> <<set $speechbeginning to _array>>
<</switch>>
<</if>>
<<set $wordCounter++>> /*increase $wordCounter by 1, so when you come back to this passage you'll get a NEW wordclue*/
<<if $wordCounter gte $wordClues.length>> /*if you've seen all the word clues, reset wordcounter and shuffle the wordclues again */
<<set $wordCounter to 0>>
<<arraymaker "wordclue list">> /*Going to the passage that lists ALL the word clues and turning it into an array */
<<set $wordClues to _array>> /*array of ALL word clues*/
<<set $wordClues.shuffle()>> /*Shuffle the words so it's different every time a kid plays it */
<</if>>
<<goto [[Game Loop]]>> /*Currently loops back to the same passage, but could be any passage you like */
<<audio "victory" volume 1 play>>
<<else>>
<<arraymaker "wrong answer feedback">> <<set _wronganswerfeedback to _array>> <<set _randomfeedback to _wronganswerfeedback.pluck()>>
<<replace "#wronganswerfeedback">>_randomfeedback<</replace>>
<<addclass "#bbtext" "animate__headShake">>
<<timed 1s>>
<<removeclass "#bbtext" "animate__headShake">>
<</timed>>>
<<CurHP -1>>
/*Javascript to highlight the incorrect answer in the textbox so players can type right over it */
<<script>>
let input = document.getElementById('textbox--code'); /*the ID here is the receiving variable of the textbox, with a "-" for a story variable and "--" for a temporary variable (instead of $ or _) */
input.focus();
input.select();
<</script>>
<</if>>
<</button>>
</span>
</div>
<div id="score">
<div id="score-text">
$score
</div>
</div>
</div>
</div>
<</if>>http://www.gogamewise.com
<div id="volumeslider">Volume: <<volume>></div>
<span class="credits">[[Credits]]</span>
/*VERTICAL HEALTHBAR DISPLAY FOR STORY CAPTION*/
<div id="verticalhealthbarbkg" class="vertbarbkg">
<div id="verticalhealthbar" class="vertbar"></div>
</div>
<<run Health2($CurHP, $MaxHP, "verticalhealthbar", false)>><strong>Design:</strong>
-Gilbert Walker
-Hannah Sunderland
<strong>Code:</strong>
Macros and other handy bits of code courtesty of:
-TheMadExile
-HiEv
-GreyElf
-Dan Cox
<strong>Styling:</strong>
-Hannah Sunderland (Aka my beautiful wife)
//A particular thanks to TheMadExile for the Sugarcube format, and Klembot for Twine in general. //
<<return "back">><<set $points to 5>>
<<set $textboxbutton to "Check!">> /*Default password button (if none is specified) */
/*STOW UI BAR*/
<<script>>UIBar.stow()<</script>>
/*HEALTH*/
<<set $MaxHP to 5>> /* Maximum Hit Points */
<<set $CurHP to 5>> /* Current Hit Points */
/*SOUNDS - DEFAULT ERROR AND VICTORY SOUND INCLUDED!*/
<<set _sound = setup.Path + "error.mp3">>
<<cacheaudio "error" _sound>>
<<set _sound = setup.Path + "victory.mp3">>
<<cacheaudio "victory" _sound>>
<<set _sound = setup.Path + "eviltheme_xmas.mp3">>
<<cacheaudio "death" _sound>>
/*----------------------------------------------------------CUSTOM PASSAGES------------------------------------------------------*//*initialising variables */
<br><br><br><br>
<h1 style="text-align: center;">Welcome!</h1>
<div class="centerh">
<img src="assets/thumbnail.png" style="max-width: 400px; outline: 0.5px solid grey;">
</div>
<p style= "text-align: center;">Before you begin, please enter your game code below:
<<password "inference" "intro" "Let the Fun Begin!">>
</p><<if visited() is 1>>
/*Wordclues SETUP*/
<<set $score to 0>> /*This is your TOTAL score */
<<set $reward to [10,5,3,1,0,-1,-3]>> /*array of potential reward points for guessing riddles */
<<arraymaker "monsters">> /*grabbing list of character file names */
<<set $monsters to _array>>
<<set $monsterLevel to 0>>
<<set $levelValues = [0,20,40,60,80,100,120,130,140,150]>>
<<arraymaker "intro speech beginning">>
<<set $speechbeginning to _array>>
<<set $nextclue to "More Evidence!">> /*this is the label for the button players click to get another clue */
<<set $wordCounter to 0>> /*your very FIRST visit...starting the WordClue array at the start...the character now has a bunch of riddles to solve! */
<<arraymaker "wordclue list">> /*Going to the passage that lists ALL the word clues and turning it into an array */
<<set $wordClues to _array>> /*array of ALL word clues*/
<<set $wordClues.shuffle()>> /*Shuffle the words so it's different every time a kid plays it */
<</if>>
/*Current number of clues: $wordClues.length*/
/*Answer & Hint Setup*/
<<set _answer to $wordClues[$wordCounter]>> /*the is both the answer AND the name of the passage where the clues for "tree" are contained!*/
<<arraymaker _answer>> /*Running the widget "arraymaker" for the _answer word. e.g if _answer is "tree it will find the matching "tree" passage and get it's hints*/
<<set _hintArray to _array>> /*grabbing the output of the arraymaker widget (ie all the hints) and setting it to an array*/
<<set _hintCounter to 0>> /*This WILL get reset every time you revisit the passage.*/
<<set _speechbeginning to $speechbeginning.random()>> /*grabbing random beginning from current set */
<<set _character to $monsters[$monsterLevel]>> /*Getting the right level for the right monster*/
<<set $img to "assets/"+ _character.toLowerCase()+ ".png">> /*this is assuming the files are always in assets folder and always the character name followed by "-av" (avatar)*/
<<set _noMoreHints to false>>
/*Character and Dialogue Bubble */
<div class="character-dialogue-grid">
<div class="character">
/* reward */
<div class="character-reward">$reward[_hintCounter] points </div>
/* character img */
<img class="character-img" @src="$img">
/* give up and reveal answer */
<div class="character-give-up">
<<link "give up">>
<<replace ".character-give-up">>
<div class="animate__animated animate__bounce"> _answer </div>
<</replace>>
<<timed 3000s>>
<<goto "death">>
<</timed>>
<</link>>
</div>
</div>
/* dialogue bubble */
<div class="dialogue">
''_speechbeginning'' <br>
//<span id="clues"><<set _hint to _hintArray.pluck()>>_hint<br><<set _hint to _hintArray.pluck()>>_hint<br><<set _hint to _hintArray.pluck()>>_hint<br></span>//
</div>
<div class="over-dialogue"> <span id="wronganswerfeedback"></span> </div>
<br>
<div class="under-dialogue">
<<button $nextclue>>
<<set _hintCounter++>> /*add 1 to the hint counter*/
<<if _hintArray.length is 0 and _noMoreHints is false>> /*if you've run out of hints display THIS*/
<<append "#clues" t8n>><strong><br>That's all the clues!</strong><</append>>/*If you're beyond the end of the array, display this message, otherwise keep showing clues!*/
<<set _noMoreHints to true>>
<<elseif _hintArray.length is 0 and _noMoreHints is true>> /*you've reached the end so display nothing! */
<<else>> /*if there's still hints left, display a random one! */
<<set _hint to _hintArray.pluck()>>/*pluck a random hint from the array*/
<<append "#clues" t8n>>
_hint<br>
<</append>> /*append the random hint to the monster speech bubble */
<<replace ".character-reward" t8n>>$reward[_hintCounter] points<</replace>> /*Update reward span (it's been modified by hintcounter)*/
<<arraymaker "hint feedback">> <<set _hintfeedback to _array>> <<set _randomhintfeedback to _hintfeedback.pluck()>>
<<replace "#wronganswerfeedback">>_randomhintfeedback<</replace>>
<</if>>
<</button>>
</div>
</div>Hmm no that's not it!
Nope. Not the word I'm thinking of!
No, no my child, that's not it at all.
I don't think so!
Huh, nice try, but no!
Oops, slip of the tongue? Try again!
You'll have to get closer than that I'm afraid!
Hmmm I like what you're thinking, but that's not quite it!
I can see what you mean, but that's not what I'm thinking of!
Close...but no cigar! Er...I mean pipe.
Not what I'm thinking of, sorry!
No, no no. Whatever did they teach you in school?
I guess this is a hard one eh?Need another hint eh?
I'm not surprised, this one's hard!
Yes, you DO need another hint hehe.
Yes, yes, this one's hard.
Ok, here's another hint.
Another hint for the wee little one!
Aha! Looks like I've found a tricky one...
Oooh have I stumped you?
Haha! I've got you this time.
You'll give up soon I expect?
They all said my riddles were tricky. I guess this proves it!Can you solve this riddle?Back for more? Try this one!
Good job, now listen closely...
Here's another riddle...
What do you make of this?
Here's a tricky one!
You're actually good at this! Try this:
Keep up the good work!
Excellent work! Now figure this out...
You're doing well! How about this...Hmmff think you're as clever as me!?
I'm sure you'll give up on this one...
I suppose you did alright back there...
Ok... How about this one?
You're good. But can you figure this out?
Here's one of my favorites...
This is a good one!
Don't get too cocky. What about this one?
This one will stump you I think!
Think you can defeat me human?Petty human, listen closely...
You're skills are weak. Try this!
You have much to learn child. Consider this...
I take pity on you...Here's an easy one:
That last one took you a long time didn't it? Here's an easy one...
Think you're ready for this? Think again!
You'll never defeat me, human!
You cannot defeat me, no matter how hard you try!
Hmmm...you're earning my respect!
Work harder to earn my respect!
Hmmm they told me you were good?
Ha! Is that the best you can do?limemonster
brownmonster
pinkmonster
yellowmonster
grapemonster
greenmonster
bluemonster
purplemonster
limemonster
brownmonster
pinkmonster
yellowmonster
grapemonster
greenmonster
bluemonster
purplemonsterI start out small
You can use me to see further
I can become quite tall
I can provide shade
I can be green
I can be brownI can be loud or soft
When I'm dead you sell me for money
I can get dirty especially with kids around
I help people get places they want to go
I'm sometimes stolen
I carry peopleI'm scary
Sometimes I take very long naps
I can climb and swim
I like to eat berries
I'm as big as a ----I have very good eyes
Sometimes I live on mountains
I'm one of the fastest creatures alive
I often look down from a high place
I have feathers
----- eyedI can make you cry
I have many "walls" inside
I'm often in a tasty dish
You throw away my skin
You might wish for goggles around meSome folk tell lies about my size
Weigh me on the scales...or was that scale me on the way?
I have many children
I can breath under water
I like wormsI come in different shapes and sizes
I can be expensive
Sometimes I'm abandoned
Sometimes I'm haunted
Homeless people don't have meI am sweet
I have many seeds
I grow best in cold weather
My name is two words together
I'm a popular flavour
I am redI am round
I am hard
I can be collected
I can be exchanged
I can be in pirate chests
I can be gold or silver or bronzePeople used to dream about making me
I may hold a black box
Some people said I could never be made
The ones who made me were instantly famous
I go to high places
I can carry one person, or manyI am made up of many similar objects
I may look very different in another season
I am home to many creatures
I am in many fairytales
I am shady in the day, scary at night
I start with FI had to win a competition to get my job
I have to have a lot of money to get where I am
Many people don't like me, many people do
I am very important
I work somewhere white
I am like a modern kingI am sharp
I come in sets
I am made of something from the ground
I am in houses
I often get hit very hard
Sometimes when you try to hit me you hit yourselfI am very important
I can make beautiful sounds
I help you breathe
I am between your mind and your heart
The noose is my enemyI usually come in pairs
I can fold in half
Use me to greet your relatives
I come in different colours
I can be bulging or skinnyFind me in the wild
I can live in cold places
I move about in groups
I hunt with my brothers and sisters
Hear me beneath a full moon
A ---- in sheep's clothingI can be smart or dumb
I make buzzing sounds
I often break
I can be very expensive
New versions of me come out every year
Lots of people have meI am very common
I can float in water
I am crunchy
Shoot an arrow through me to prove you're a good shot
I am red
An ---- a day keeps the doctor awayI am large for my type
Sweet when ripe
Often cut into wedges
Watch out for drips!
I'm like a big ball
Green on the outside
Red on the insideI can make you feel better
Most people like me
I can be soft
People get tickets to see me
I am made up of different parts
You might listen to me when you're travellingI can be a suprise
I can be a deliberate act
I can bring pleasure to one, and discomfort to many
Sometimes loud and funny
I can be silent
I can be "deadly"I'm a little bit instead of a lot
I can be easy to make
I can give you energy
I can satisfy your hunger
Too much ---- food isn't good for youI can show you many secrets
I am usually found in cities
I have many visitors
Pay someone to explain my best parts
I hold history and memory
I store lots of old thingsI can be hot or cold
I can be hard or soft
Sometimes I'm a threat to ships
I'm rare in the desert
I'm usually blue
I'm all around the worldYou can wrap me
You can hang me
I'm helpful before bed
I'm used around water
Lie down on meLots of kids want me
I often don't get used
I am hard to learn
I have 6 ropes of metal across me
I have a hole in my heart
I can be electricI should be comfortable
I can be cheap or expensive
I can be bouncy
I can be saggy
I often have metal or foam inside
I'm close to you at nightI'm something you play
I sit on tables
I am a competition
I am a struggle between kings
I am an equal mix of black and whiteI help you stay fit
I am tall, and usually dark in color
I sometimes fold up
I help you travel far yet not far at all
I'm in a gym or maybe your house
I go around and aroundI can put you to sleep
You can open me
You can close me
I tell you things you sometimes forget
I can take you to faraway lands
I can be heavy
I often come in setsI help you plan for the future
Often I hold treasures
Sometimes I hold nasty surprises
Plug me in to turn me on
I am cold
I often get dirtyI can be open or shut
I hold many things, or I can be bare
I keep things safe
I can be tall
I am usueally made of wood
Find me in the kitchenSome people see your future in me
Hold me to use me
When I'm gold or silver I can be a prize
I can have one handle, two, or none at all
I am often made of china or glassI hold stuff you need every day
Many people use me in the morning
Fill me up to use me
I am round
I need cleaning after use
I have no handlesI am cold
I am wet
I am light
You can compact me
I am white
I can fall
I can be a ballI help humans
I have a mesmerizing dance
I need dry food to stay alive
Wet food will kill me
Wind can be my enemy or friend
Don't get too close to me or you'll regret it!I am rare
Kings treasured me
I am sometimes stolen
I am heavy
Look for me in the ground
A good person has a heart of ----I live separate from most people
I might sleep in a hammock
I steal things from others
I might have a gun or a sword
Kings are my enemyI am huge
I am the distance between two points
I am dangerous
I am mostly unexplored
I hold many secrets
I'm always aboveI'm always hungry
I'm not interested in brainless people
You can't kill me
I'm already dead
I move slowly and make groaning noises
Sometimes I'm green!Don't suck on me!
I am used all over the world
I come in different sizes
When I expire you'll need to replace me
I'm near you right now!
You need to charge meI come in different colours
I grow in the ground
I smell nice
Bees like me
My clothes are delicateI gave kings protection from their enemies
In some places I'm common, in others I'm not
I may be cold
I am tall
People like to climb meMy roars make the earth tremble
I am light
I can be white or grey
I often change shape
When I am angry I release a deadly fireI can be soft or loud
I come in sets
I can be small or huge and dangerous
I am usually blue
My top turns white as I bendI am usually blue or black or grey
I can be clear or clouded
I look different at night
I look different in different seasons
In the darkness, my lights shineI am dangerous
I am cold at night
I don't like many plants
I may have spikes and rattles
Bring water if you want to visit meYou might use a stick to get me
I'm a picture
I help you capture the moment
I help you capture yourself
You probably have lots of meI give you answers
But do you trust me?
You're allowed to make me bigger
I'm online
I'm like an EncyclopediaPeople have me in cars
People have me in phones
I am 3 letters long
I make use of satellites
I help you navigateI'm like a movie theatre
Use me in your home
I'm like a library
You have to pay to get me
I am 2 words joined togetherKids love me
I come in groups
I'm little and yellowy-gold
I come in a little box or bucket
Find me at a takeaway storeI'm a big company
I'll make sure to pick you up
I start with U...
I help you get where you want to go
I'm like a taxiI'm a gadget
Lots of kids have/had me
Spin me in your hands
I go round and round
I've got metal balls to make me spin fast
I am two separate words ------ -------I tell you things you want to know
I'm a huge company
I'm a really big number
I look for lots of things very quickly
I'm used millions of times every dayYou use me to get fit.
I know when you are excercising
I am two words joined together
Wear me on your wrist
I start with S not FI first grew from the ground
I'm edible and orange
I can have a glowing face
Sometimes I sit on your doorstep
You can make me into a Jack-o'-lanternI'm made of many connected parts
I am inside you, under your flesh
I can break, but I can also mend in time
I hang around, even after you die
I'm made of bonesI'm strong, yet delicate
My owner wants visitors
I am often in high places
I'm a trap
I catch little creaturesSometimes I'm friendly, sometimes I'm not
People are scared of me. Boo!
I get blamed for bumps in the night
Sometimes I'm wispy, sometimes I'm lifelike
I'm dead.I'm multi-flavoured
I'm multi-coloured
Eat too much of me and you might hurl
I start with C
You eat a lot of me at HalloweenI'm a sucker with pointy teeth
I like red drinks
I don't like garlic
I can turn into a bat
I stay out of the sunI have a pointy nose...
I have a black hat
I have a black cat
I have a broom
Sometimes I'm green!Find me in the desert
In a pyramid or tomb
I curse those who disturb my sleep
I'm all wrapped up
I'm the other kind of "daddy"tree
bear
eagle
car
onion
fish
house
strawberry
coin
plane
forest
president
nail
throat
arm
wolf
phone
apple
watermelon
music
fart
snack
museum
water
towel
guitar
mattress
chess
treadmill
book
fridge
cupboard
cup
bowl
snow
fire
gold
pirate
space
zombie
battery
flower
mountain
cloud
wave
sky
desert
mummy
witch
vampire
candy
ghost
web
skeleton
pumpkin
smartwatch
google
fidget spinner
uber
nugget
netflix
gps
wikipedia
selfie
phone<<if ndef $textGroup>><<set $textGroup = 1>><</if>>
<<switch $textGroup>>
<<case 1>>
<h1> Welcome to the Inference Riddle Game! <br>// -- Cute Monsters Now <<linkreplace "Invited! --">>Included! -- <</linkreplace>>//</h1>
So...I know what you're asking yourself. //What the heck does "inference mean?"//<br><br>
An "inference" is //a conclusion based on evidence or reason.//<br><br>
Here's an example. Let's say you
<<link "go into your bedroom." `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */<br>
<br><br>[[Bro, I already know what an inference is!|Game Settings]]
<<case 2>>
There's mess all over the floor. How did that get there? <br>
You turn and see your younger brother run down the hallway with one of your toys.<br><br>
''Who do you think made the mess in your room?''<br><br>
<<link "A chicken" "nope">><</link>><br>
<<link "Your Dad" "nope">><</link>><br>
<<link "Your younger brother" `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */<br>
<<case 3>>
That's right. You can //infer// that your brother messed up your room because of two pieces of //evidence:// <br>
1. He ran away <br>
2. He's got something else from your room<br><br>
If your younger brother did this kind of thing often, you'd have yet another reason/piece of evidence to believe he made the mess! <br><br>
<<link "So an inference is basically a judgement..." `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */
<<case 4>>
That's right. An inference is a reasonable judgement. It's very much like...<br><br>
<<link "a hunch" `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */<br>
<<link "an accusation" "nope">><</link>><br>
<<link "a conclusion" `passage()`>><</link>>
<<case 5>>
Exactly. But it's not just random, it's based on collecting clues, like a detective.<br><br>
So let's change things up and add some new evidence to the example above. Let's say:<br>
1. Your brother ran away <br>
2. He's got something from your room<br>
3. Your brother has NEVER ever stolen anything from your room before<br>
4. Your brother's friend is visiting and he's always getting into things without asking<br><br>
''Now who do you think made the mess in your room?''<br><br>
<<link "Brother" `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */<br>
<<link "Brother's friend" `passage()`>><</link>>
<<case 6>>
Interesting huh? It could really have been either of them... You can't be 100% sure! <br><br>
But now that you know about your brother's friend, an inference that //your brother// messed up your room is...<br>
<<link "weaker!" `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */<br>
<<link "stronger!" "nope">><</link>>
<<case 7>>
That's right. With your brother's friend around, you can't be as sure as before. So the inference that your brother is guilty is weaker (LESS reasonable).<br><br>
Ok let's recap. An inference is...<br><br>
<<link "a prediction based on a random chance." "nope">><</link>><br>
<<link "a conclusion based on evidence or reason." `passage()`>><</link>> /*this link RELOADS the CURRENT passage! */<br>
<<link "a decision based on evidence or intense desire." "nope">><</link>>
<<default>>
Exactly! It looks like you're ready for the game!<br>
Just remember, a good inference is based on evidence. <br><br>
//So in the game, if you're not sure of the answer, you probably need more //evidence// to help you make a stronger inference!//<br><br>
<<unset $textGroup>>[[Ok boss!|Game Settings]]
<</switch>>
<<set $textGroup>><<set $textGroup ++>>Hmm... Someone hasn't been paying attention!
You'd better <<return "go back and read more carefully!">>
<<set $textGroup-->><h1>Game Setup:</h1>
In this game, you get points for making correct inferences... but watch out! You lose POWER for incorrect guesses!
<span style="color: red;"><-- </span> Your POWER is shown by the <span style="color: red;">red bar </span>to the left.
//Don't let it drop to zero! :P//
Hint: If you ask a monster for less clues, you'll get a bigger reward!
But don't be afraid to ask for clues when you need them - you're time is limited!
<strong>Choose your difficulty level, and the game will begin... </strong>
<div style = "display: flex; justify-content: space-around;">
<<nobr>>
<<button "Chicken (No timer)">><<set $difficulty to "chicken">><<include [[Apply Game Settings]]>><<goto [[Game Loop]]>><</button>>
<<button "Normal (5 min)">><<set $difficulty to "normal">><<include [[Apply Game Settings]]>><<goto [[Game Loop]]>><</button>>
<<button "Hard (3 min)">><<set $difficulty to "hard">><<include [[Apply Game Settings]]>><<goto [[Game Loop]]>><</button>>
<</nobr>>
</div>/*<<if visited() is 1>> Starting the timer on your FIRST visit only*/
<<switch $difficulty>>
<<case "chicken">>
/* no timer! */
<<case "normal">>
<<script>>setup.startCountdown(5 * 60, 'time is up');<</script>>
<<case "hard">>
<<script>>setup.startCountdown(3 * 60, 'time is up');<</script>> /*45 lots of 60 seconds, include CONTENTS of the 'time is up' passage (in the "time is up" passage there's a <<goto "death">> */
<<default>>
<<script>>setup.startCountdown(5 * 60, 'time is up');<</script>>
<</switch>>
/*<</if>>*/
/*Applies settings from the "Game Settings" passage*/<<script>>setup.stopCountdown();<</script>>
<h1>DEFEAT!</h1>
The monsters got you this time, but you can always...
/*BUTTON THAT REFRESHES ALL THE VARIABLES! */
<<button "Try Again!">>
<<set $score to 0>> /*This is your TOTAL score */
<<arraymaker "monsters">> /*grabbing list of character file names */
<<set $monsters to _array>>
<<set $monsterLevel to 0>>
<<set $levelValues = [0,10,20,30,40,50,60,70,80,90]>>
<<arraymaker "intro speech beginning">>
<<set $speechbeginning to _array>>
<<CurHP 5>>
<<goto [[Game Settings]]>>
<</button>>
<<audio "death" volume 1 play>><<goto [[time score]]>><<script>>setup.stopCountdown();<</script>>
<<audio "victory" volume 1 play>>
<div class="centerh">
<h1>Score</h1>
<div style="width: 100px; height: 100px;">
<div id="score">
<div id="score-text">
$score
</div>
</div>
</div>
</div>
<div class="centerh">
<div>
<h1>High Scores </h1>
<<if $difficulty is "normal" or $difficulty is "hard">>
<<updatescoreboard>>
<<scoreboard>>
<br>
<br>
/*BUTTON THAT REFRESHES ALL THE VARIABLES! */
<<button "Set a New High Score!">>
<<set $score to 0>> /*This is your TOTAL score */
<<arraymaker "monsters">> /*grabbing list of character file names */
<<set $monsters to _array>>
<<set $monsterLevel to 0>>
<<set $levelValues = [0,10,20,30,40,50,60,70,80,90]>>
<<arraymaker "intro speech beginning">>
<<set $speechbeginning to _array>>
<<CurHP 5>>
<<goto [[Game Settings]]>>
<</button>>
<<else>> /*no score for casual mode! */
Well done! Your chicken score was $score!
<br><br>
//Play on normal or hard mode to put a real score on the leaderboard!//
<br><br>
/*BUTTON THAT REFRESHES ALL THE VARIABLES! */
<<button "Get A Real Score!">>
<<set $score to 0>> /*This is your TOTAL score */
<<arraymaker "monsters">> /*grabbing list of character file names */
<<set $monsters to _array>>
<<set $monsterLevel to 0>>
<<set $levelValues = [0,10,20,30,40,50,60,70,80,90]>>
<<arraymaker "intro speech beginning">>
<<set $speechbeginning to _array>>
<<CurHP 5>>
<<goto [[Game Settings]]>>
<</button>>
<</if>>
</div>
</div>
/*-----------------------------------------------------------------WIDGETS---------------------------------------------------------------- */<<widget "updatescoreboard">>
/% Create the scoreboard variable if it doesn't exist. %/
<<if ndef $scoreboard>>
<<set $scoreboard to []>>
<</if>>
/% Grab memorized scores from past plays! %/
<<set $scoreboard = recall("scoreboard", [])>>
/% Add the current name and score to the end of the array. %/
<<set $scoreboard.push($score)>>
/% Sort the array. Sort Highest to lowest. If I want lowest to highest, switch to "return a - b" %/
<<run $scoreboard.sort(function (a, b) { return b - a; })>>
/% Persist the scoreboard story variable (which now includes the current score!) %/
<<set memorize("scoreboard", $scoreboard)>>
<</widget>>
<<widget "scoreboard">>
<<set _scoreFound to false>>
<<if def $scoreboard>>
<<for _i to 0; _i lt $scoreboard.length and _i lt 10; _i++>> /*Only display the top 10 scores */
<br>
<<if $scoreboard[_i] is $score and _scoreFound is false>>
<strong><<print _i + 1>>.</strong> <span class="circle-sketch-highlight">$score</span>
<<set _scoreFound to true>> /*sets this variable once you've found the first score, so if there's multiple scores in the array that are the same they won't all highlight */
<<else>>
<strong><<print _i + 1>>.</strong> $scoreboard[_i]
<</if>>
<</for>>
<<if _scoreFound is false>> <br><br>
<<set _position to $scoreboard.indexOf($score)>>
//You got rank _position ...not quite enough to make it to the top 10... :( <br>
Better luck next time! //
<</if>>
<</if>>
<</widget>><<widget "password">> /*The name of the widget */
<<set _password to $args[0]>> /*setting the textbox password */
<<set _forwardingpassage to $args[1]>> /*setting the forwarding passage */
<<if $args[2]>>
<<set _buttonlabel to $args[2]>>/*setting the label for the textbox check button. If Designer hasn't included a button label it willfault to "Check!" */
<<else>>
<<set _buttonlabel to "Check!">>
<</if>>
<span id="answerfeedback"></span><br>
<<textbox "_code" "" autofocus>>
<<button _buttonlabel>>
<<set _code to _code.toLowerCase()>>
<<if _code.indexOf(_password) > -1>> /*checks code against the password set by the widget argument. If password is "brain" any instance of it will work, ie "brained" or "the brain" or "xyzsbrain"*/
<<goto _forwardingpassage>>
<<else>>
<<replace "#answerfeedback">>Hmm that doesn't look right...try again?<</replace>>
/*Javascript to highlight the incorrect answer in the textbox so players can type right over it */
<<script>>
let input = document.getElementById('textbox--code'); /*the ID here is the receiving variable of the textbox, with a "-" for a story variable and "--" for a temporary variable (instead of $ or _) */
input.focus();
input.select();
<</script>>
<</if>>
<</button>>
<</widget>>
/*USAGE: <<password "The Password" "Forwarding Passage" "Button Label">> "The Password", the second is the passage to forward to if the password is correct *//*WIDGET CONSTRUCTING Array FROM PASSAGE*/
<<widget "arraymaker">> /*the name of the widget*/
/*Get the contents of a variable passage - that is specified in the twine passage. For example, <<arraymaker "somepassage">> would run this widget and turn the contents of "somepassage" into an Array*/
<<set _passageContents to Story.get($args[0])>> /*full argument string in raw and parsed forms—accessed via the $args.raw and $args.full*/
/*Turn the contents into text*/
<<set _passageText to _passageContents.text>>
/*Turn the text into an Array (split here by ENTERS)*/
<<set _array to _passageText.split("\n")>>
<</widget>>
/*
SAMPLE USAGE- the first word is calling on the widget, the second word or number etc. is the argument ie "$args[0]" that you're passing to the widget - this can be a value or a variable etc.
<<set _q to "8x tables">> //setting question passage
<<arraymaker _q>> //Running the arraymaker widget for _q, which means it grabs all content in the passage "8x tables" and turns it into an Array
*/<<widget "gender">> /*the name of the widget*/
<<if $args[0] is "male">>
<<set $he to "he">>
<<set $him to "him">>
<<set $his to "his">>
<<set $himself to "himself">>
<<set $He to "He">>
<<set $Him to "Him">>
<<set $His to "His">>
<<set $Himself to "Himself">>
<<set $son to "daughter">>
<<set $witch to "witch">>
<<set $wife to "wife">>
<<set $wizard to "wizard">>
<<set $prince to "prince">>
<<set $boy to "boy">>
<<set $brother to "brother">>
<<set $father to "father">>
<<else>>
<<set $he to "she">>
<<set $him to "her">>
<<set $his to "her">>
<<set $himself to "herself">>
<<set $He to "She">>
<<set $Him to "Her">>
<<set $His to "Her">>
<<set $Himself to "Herself">>
<<set $son to "son">>
<<set $witch to "wizard">>
<<set $wife to "husband">>
<<set $wizard to "witch">>
<<set $prince to "princess">>
<<set $boy to "girl">>
<<set $brother to "sister">>
<<set $father to "mother">>
<</if>>
<</widget>>/* widget fuction that adds or subtracts health, plays appropriate sound and sends you to the death passage if you're dead!*/
<<widget "CurHP">>
/*LOSE HEALTH */
<<set $CurHP to $CurHP + $args[0]>> /*Gain or lose as much HP as the widget argument[0] */
/*AUDIO */
<<if $args[0] gte 0>> /*GAIN HP, so play victory sound */
<<audio "victory" volume 0.5 play>>
<<audio "victory" fadeoverto 1 0>>
<<timed 1s>> <<audio "victory" stop>> <</timed>>
<<else>> /*no gain of HP, so play error sound */
<<audio "error" volume 0.5 play>>
<<audio "error" fadeoverto 1.5 0>>
<</if>>
/*GAME-BASED STUFF */
<<if $CurHP lte 0>> /*IF HP loss dropped player below 0 send them to the death passage! */
<<timed 1.5s>>
<<audio "error" stop>>
<<goto [[death]]>>
<</timed>>
<</if>>
<<if $CurHP gte $MaxHP>> /*IF that gain put player OVER max HP, set HP to Max HP*/
<<set $CurHP to $MaxHP>>
<</if>>
/*UPDATE HEALTHBAR! */
<<run Health2($CurHP, $MaxHP, "verticalhealthbar", false)>>
<</widget>>