(set: $inv to (a:))
Be sure to scroll down on all the pages!
(transition: "pulse")[This text will pulse when the passage opens.]
(transition: "shudder")[While this text will shudder when the passage opens.]
(transition: "dissolve")[this text will fade in but it doesn't seem to work well]
These use `(transition: "pulse")` on the first line and shudder on the second one while the last one uses dissolve (with the text itself surrounded by `[]`
#one # makes the font biggest
##this is with 2 #'s
###this is with 3
####then 4
#####then 5
######then 6
the next thing is (font:"nemoy")[learning about] [[italics bold superscript and strikethrough]]
The background color is changed based on the explanation given here: <a href="https://twinery.org/forum/discussion/comment/21541/#Comment_21541/"; target="_blank">https://twinery.org/forum/discussion/comment/21541/#Comment_21541/</a>
Basically you open up the twine stylesheet (open your story in twin and then down in the lower left is the up triangle which opens a menu which has a link to show the stylesheet) and you put in this code:
`tw-story[tags~="first"] {
background-color: LightGreen;
color: Red;
}` and now everything that you tag as "first" will have a light green background and red text. You can find a list of the named colors at <a href="https://www.w3schools.com/cssref/css_colors.asp"; target="_blank">https://www.w3schools.com/cssref/css_colors.asp</a>
if you want all the pages to have the same look you can leave out the `[tags-= ]` part.
this page is tagged "second" so it looks different
BOLD. ''Bold text'' is the phrase surrounded by two sets of single quotes with no space (not double quotes)
ITALICS. //Italic text// is the phrase surrounded by two forward slashes with no space between them like this: ``//Italic text//``
SUPERSCRIPT. ^^Superscript^^ use two carets ^ around the phrase
DELETED TEXT. ~~Deleted Text~~ surround it with two tildes ~
If you want want to use `[[double square brackets]]` in my story then you put them inside `` ` ``That is a `` ` `` //not// a `'`
* Bulleted items use an asterix
* It will automatically number them as long as you put an asterix in front of them
** Indented bulleted item use two
0. Numbered items use `0.`
0. Numbered item 2
0.0. an indented numbered item uses `0.0.`
Next up is [[Alignment]]
Here is how to use an inventory:
You found a cell phone. it is in your inventory now. This is done through this code: `(set: $inv to $inv + (a: "smartphone"))` where smartphone is the name of the passage and `$inv` is the variable for your inventory.
(set: $inv to $inv + (a: "smartphone"))
You want to use your [[cellphone]]?<!-- this tile has the code to display the inventory on each page. Using the tag footer makes it automatically appear on every page-->
(if: (passage:)'s name is "inventory")[<!--Do nothing-->]
(else-if: (passage:)'s tags contains "donotshowinventory")[<!--Do nothing-->]
<!-- the if checks if the name of the passage/tile is "inventory" and if it is then it doesn't display on that passage (because yo dog, who wants an inventory in their inventory? If you decide you don't want the inventory shown on some other page then give that passage the tage donotshowinventory -->
(else:)[Check [[inventory]].]
<!-- this was stolen from https://gersande.com/blog/designing-inventories-in-twine-2-with-the-built-in-harlowe-macros/ -->
(if: $countdown)[(if: (passage:)'s tags contains "timer")[(set: $count to $count - 1)(if: $count is 0)[(set: $countdown to false)(goto: "countdown_failed")]]]
<!-- this was stolen from http://twine.analytical-engine.co.uk/Cookbook.html/ -->(if: $inv's length > 0)[Your inventory contains a (print: $inv.join(", ")).]
(else:)[Your inventory is empty.]
(click: "smartphone")[(display: "smartphone")]
(link-goto: "Return", (history:)'s last)
<!-- the first line check if your inventory is empty. if it isn't it shows what is in it. if it is empty it says it is empty. the third link works to show the smartphone if you have it - you got it in the second tile of the story - and then it will show a passage named smartphone if you click on it and the last line takes you back to the previous passage -->
To understand what is going on here, open the html file in twine and then edit the inventory tile to see the codewhat is this?[[Throw away your phone]] this will show you how to remove something from your inventory(set: $inv to $inv - (a: "smartphone"))
If you check your inventory it should now be empty
The code for this is `(set: $inv to $inv - (a: "smartphone"))` where smartphone is the name of the item. the minu takes it out of the inventory.
Now let's [[get into a fight|fight]]Double-click this passage to edit it. ==>
To make text right-aligned use `==>`
=><=
Centered tet is `=><=`
<==>
Justified is `<==>`
<==
To set it back to left-aligned use `<==`
There are ways to do columns too but you can look them up in the twine cookbook on twinery.org
[[more text effects]]
If you want to see how you can use variables to work with inventory or how to use it to count down time click here: [[LockedDoor]]The room was dark but you weren't alone.
(link: "Something happens when you click here.")[if you want new words to appear you can write: `(link: "the original text.")[the text that will appear once you click]`]
What if you (link: "want to display the text from another tile in this one?") [(display: "cellphone")]
(link: "if you want to find out how that works click here.")[to make the text from another tile appear you type `(display: "the_name_of_the_tile_you_want_to_appear")`]
There are also some things you can do with straight up text. Look at <a href="https://twine2.neocities.org/#macro_hover-style"; target="_blank">https://twine2.neocities.org/#macro_hover-style</a>
Hover over this to see it change (the link doesn't actually go anywhere:
(hover-style:(text-color:cyan) + (text-style:'italic'))+(link:"The lake")
[The still, cold lake.]
(color:green)[this text is green]
This text is (text-rotate:45)[Tilted] - you can set the number of degrees
The text has a (text-style: "shadow")[shadow]
This text is really (text-style:"blurrier")[blurry]
This one (text-style:"shudder")[shudders]
There are lots more effects at <a href="https://twine2.neocities.org/#macro_text-style"; target="_blank">https://twine2.neocities.org/#macro_text-style</a>
If you want to see houw to embed images, video, and sound you can [[go on this way|media]]
Or you can go [[get into a fight|fight]]All this stuff is seperate from the other stuff so the inventory stuff donesn't work.
Here's a link to the page that describes how this works: <a href="http://www.ohiofi.com/blog/twine-battle/"; target="_blank">http://www.ohiofi.com/blog/twine-battle/</a>
Valhalla V: Odin's Revenge
by Mr. Riley
[[CLICK HERE TO START->Town]]
(set: $health to 100)
(set: $sword to 0)
(set: $ax to 0)
(set: $coins to 5)
(set: $points to 0)You are standing in the middle of town.
Where do you want to go?
[[Market]]
[[Castle]]
[[Graveyard]]
[[Farm]](if: (random:1,2) is 1)[
(set:$location to "Graveyard")
(display: "Fight Enemy")
]
(else:)[
The graveyard looks empty... //for now.//
Go back to [[Town]]
](if: (random:1,2) is 1)[
(set:$location to "Castle")
(display: "Fight Enemy")
]
(else:)[
The castle looks empty... //for now.//
Go back to [[Town]]
](set: $enemyName to (either:"Giant Spider","Zombie","Ghost","Pizza Rat"))
A $enemyName crawls out of the shadows!
(set: $enemyhealth to (random:30,50) + $points)
(set: $punch to (random:1,9))
(set: $kick to 10 - $punch)
(display: "Enemy Hits You")(if: $enemyhealth > 0)[
(set: $enemyHit to (random:1,3)+(random:1,3))
(color:red)[The $enemyName ATTACKS YOU! //-$enemyHit//]
(set: $health to $health - $enemyHit)
You have $health health.
(if: $health > 0)[
(display: "Use Weapon")
]
(else:)[
(display: "You Died")
]
]
(else:)[
You have defeated the $enemyName. //+10 pts!//
(set: $points to $points + 10)
(set: $randomcoins to (random:25,50))
(set: $coins to $coins + $randomcoins)
//+$randomcoins coins!// You now have $coins coins.
[[Continue]]
](goto:$location)
[[Punch]]
[[Kick]]
(if: $sword > 0)[ [[Use Sword]] ]
(if: $ax > 0)[ [[Use Ax]] ](set: $hit to $punch + (random:1,6))
(if: (random:1,8) is 1)[
You tried to PUNCH it but you missed!
]
(else:)[
(set: $enemyhealth to $enemyhealth - $hit)
(set: $points to $points + $hit)
You PUNCH the $enemyName! (color:green)[-$hit]
]
(display: "Enemy Hits You")(set: $hit to $kick + (random:1,6))
(if: (random:1,8) is 1)[
You tried to KICK it but you missed!
]
(else:)[
(set: $enemyhealth to $enemyhealth - $hit)
(set: $points to $points + $hit)
You KICK the $enemyName! (color:green)[-$hit]
]
(display: "Enemy Hits You")(set: $hit to 10 + (random:1,6) + (random:1,6))
(if: (random:1,10) is 1)[
You tried to SLASH it with your sword but you missed!
]
(else:)[
(set: $enemyhealth to $enemyhealth - $hit)
(set: $points to $points + $hit)
You SLASH the $enemyName with your sword! (color:green)[-$hit]
]
(display: "Enemy Hits You")(set:
$hit to 20 + (random:1,6) + (random:1,6))(if: (random:1,12) is 1)[You
tried to SLASH it with your ax but you missed!](else:)[(set:
$enemyhealth to $enemyhealth - $hit)(set: $points to $points + $hit)You
SLASH the $enemyName with your ax! (color:green)[-$hit]]
(display: "Enemy Hits You")(color:red)[☠ You died! ☠
☠ GAME OVER ☠
(set: $points to $points + $coins)☠ //Final Score: $points// ☠](if: (random:1,2) is 1)[
(set:$location to "Farm")
(display: "Fight Enemy")
]
(else:)[
The farm looks empty... //for now.//
Go back to [[Town]]
](set: $health to $health + 10)(set: $coins to $coins - 10)
(color:green)[+10 health!]
You now have $health health!
(color:red)[-10 coins.]
You now have $coins coins.
(display:"Market")(set: $sword to $sword + 1)(set: $coins to $coins - 50)
(color:green)[+1 sword!]
You now have a Level $sword sword!
(color:red)[-50 coins.]
You now have $coins coins.
(display:"Market")(if: $coins >= 10)[
[[Buy A Healing Potion For 10 Coins]] ]
(else:)[
Healing potions cost 10, but you only have $coins. ]
(if: $coins >= 50)[
[[Buy A Sword For 50 Coins]] ]
(else:)[
Swords cost 50, but you only have $coins. ]
(if: $coins >= 100)[
[[Buy An Ax For 100 Coins]] ]
(else:)[
An ax costs 100, but you only have $coins. ]
Return to [[Town]](set: $ax to $ax + 1)(set: $coins to $coins - 100)
(color:green)[+1 ax!]
You now have a Level $ax ax!
(color:red)[-100 coins.]
You now have $coins coins.
(display:"Market")This is all taken from <a href="https://damonwakes.wordpress.com/2018/01/24/twine-for-beginners-using-variables/"; target="_blank">https://damonwakes.wordpress.com/2018/01/24/twine-for-beginners-using-variables/</a>
He explains it better than I can.
The only thing I added was a countdown where you die if you get to zero.
You [[Open the door...|variable vinnie]]
(set: $countdown to true)
(set: $count to 6)
You have (print:$count -1) turns remaining
Once upon a time, Variable Vinnie decided to go for a pleasant walk in the woods. But wouldn't you know it? The moment he shut his front door, he realised he'd left his keys inside.
He'd have to work out where he'd left his spare key - perhaps in [[the shed]] or [[at the bottom of the garden]] - before he would be able to open [[the door]].
(The inventory stuff isn't for this game so don't look at it. I think you could get it to integrate but I'm not going to take the time to try!)
The countdown code I took from <a href="http://twine.analytical-engine.co.uk/Cookbook.html"; target="_blank">http://twine.analytical-engine.co.uk/Cookbook.html</a> If you want every screen to have a countdown you can do the first version. I just want this part of the game to have a countdown so I am doing the part with the timer tag.
Because I am adding it to a game that loops back to this tile, I actually started the timer on the tile before this. You could probably do it on this tile with an if else statement but that is more work!
I also had to put a -1 in because I put the countdown code in the footer so it runs after the top of the page is generated. if you put that code in the header it shouldn't need the -1
You have (print:$count -1) turns remaining
Vinnie stepped into the shed and looked around.
It was completely empty. He had no idea why he thought his spare house key might be in here.
He decided that he would most likely have to check [[at the bottom of the garden]] if he were to have any hope of opening [[the door]].
Or he could waste a turn by going back to [[the start|variable vinnie]]You have (print:$count -1) turns remaining
(set: $key to true)Vinnie checked the bottom of the garden and saw a gnome.
Suddenly, he remembered: during a session of late night drunk internet shopping, he'd bought one of those garden gnomes with a hollow rubber butt in which to store your spare house key.
(Note from the author: I vaguely recall this being a real product available for sale at one point. If I have in fact just made it up, then I have many concerns.)
Vinnie retrieved his spare house key from the gnome's hollow rubber butt, content in the knowledge that he would now be able to open [[the door]] once more.
Or he could waste a turn by going back to [[the start|variable vinnie]]You have (print:$count -1) turns remaining
{
(if: $key is true)[The key turned in the lock, granting Vinnie access to his beloved home.]
(elseif: $rattled > 5)[Vinnie rattled the door one more time, and it came right off its hinges! Success!!! Except now he had to get a new door...]
(else:)[(set: $rattled to it + 1)Vinnie rattled the door like some kind of helpless loser. Perhaps he should have checked in [[the shed]] or
[[at the bottom of the garden]] instead. That would have been far less embarrassing. Of course, there was nothing stopping him from simply rattling [[the door]] again.]
}
Or he could waste a turn by going back to [[the start|variable vinnie]]{
(set: $key to false)
(set: $friend to "none")
(set: $rattled to 0)
(set: $countdown to false)
(set: $count to 0)
}you died!
Better go back to [[the begining|fonts]] If you want to add audio you can do it in a basic way based on what is on the twine site.
There is also a fancy way with all sorts of things on at this link <a href="https://twinelab.net/harlowe-audio/#/" target="_blank";>https://twinelab.net/harlowe-audio/#/</a>
<img src="https://fsmedia.imgix.net/03/0d/96/5c/75f7/4adb/88c4/f62a6becb774/zombie-cats-are-killing-seals-in-hawaii.gif">
To embed images, find a picture online you like make sure you get the address of the actual image - it should end in gif, jpg, png, or something
then put it inside `<img src="ADDRESS OF THE IMAGE HERE">`
Youtube you can embed the embed code youtube gives you when you click on share
<iframe width="560" height="315" src="https://www.youtube.com/embed/Dx4CQa5tHaI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
You can also do it with movies too (you might have to right click on that and hit play to make it work.
It is basically the same code only use video instead of img. It seems like it won't play anything after the embedded video though so that might be a bug.
So now you can go [[get into a fight|fight]]
<video src="https://i.imgur.com/E5vO3BL.mp4">
(you might have to right click on that and hit play to make it work.
It is basically the same code only use video instead of img