Random posts

Twine macro: <<revision>> and <<revise>>

The <<revision>> macro is a more powerful variation of the <<replace>> macro. It lets you alter a span of passage text by clicking a link from anywhere in the passage.

Install my <<Replace>> Macro Set to use these macros.

Basic usage
First, use the <<revision>> macro to define two different versions of some text:

You see here <<revision tome>>a closed book.<<becomes>>an open book.<<endrevision>> Each section of text separated by <<becomes>> is a different "version" of the text. The name "tome" in the macro is an identifier. You can use any single word you want as an identifier.

Then, you can create a link using the <<revise>> like so:
<<revise tome "Open the book.">>
This creates a link reading "Open the book" that changes any "tome" revision in the passage into the next version - in this case, changing "a closed book" into "an open book".

(Notice that the word "revise" is the verb form of "revision", reflecting the fact that the hyperlink serves as a verb for the player to perform.)

Running code in revisions
Just like with <<replace>>, any macros inside a revision are run as soon as they are made to appear:

<<revision button>>You see a button.<<becomes>>The button is pushed.<<set $button=true>><<endrevision>>
<<revise button "Push it.">>

The above code will set $button to true when you click the "Push it." link.

Multiple versions
You can have many versions of a span of text:

You see here <<revision books>>a closed book.<<becomes>>a chewed book.<<becomes>>paper scraps.<<endrevision>>
<<revise books "Chew book">>

In this case, the link "Chew book" will change "a closed book" into "a chewed book", then "paper scraps". When it reaches the end, the link vanishes.

Back and forth
The <<revert>> macro functions to reverse the effects of the <<revise>> macro.

<<revision box>>Here is a closed box.<<becomes>>Here is an open box.<<endrevision>>
<<revise box "Open the box.">>
<<revert box "Close the box.">>

The <<revert>> macro's link won't be displayed if it's at the first revision, just as the <<revise>> macro won't be visible if it's at the last revision.

Cycling link text options (New)
The <<revise>> and <<revert>> macros have a number of additional options similar to the <<cyclinglink>> macro. You can supply additional link text strings after the first, and it will change to the next string after you click it.
<<revise wall "Smash wall" "Smash it again" "Keep smashing">>

If the second parameter begins with the "$" sigil, then it will interpret it as a variable to be altered by clicking the link. When the player clicks the link, the variable will be changed to match the text of the link.
<<revise heat $warmth "Set it to warm" "Set it to hot" "Set it to boiling">>

If the last parameter is the word "end", then it will disable the link at the parameter before last, leaving just the text. If the last parameter is the word "out", then it will vanish altogether once it's reached the final string.
<<revise roast "Devour roast" "Munch some more" "You're too full now" end>>
<<revise amphora "Drink wine" out>>

Click here to read about <<hoverrevise>>.

<<becomes>> vs. <<gains>>
Just as the <<replace>> macro has a variation, <<insert>>, so too does <<becomes>>.

The vase contains:<<revision vase>>Two roses<<gains>>, an orchid<<gains>>, a pencil<<gains>>, a straw<<endrevision>>.
<<revise vase "Put something in the vase">>.

When you click "Put something in the vase", the text changes from "Two roses" to "Two roses, an orchid", then to "Two roses, an orchid, a pencil" and so forth.

You can mix and match <<gains>> and <<becomes>> at will:

<<revision count>>One<<becomes>>Two<<gains>>and a half<<becomes>>Three!<<endrevision>>

This changes from "One" to "Two", "Two and a half", and finally "Three!".

Normally, when a <<revision>> macro reaches the end of its revisions, its links disappear. If you change "revision" to "cycle", then you can keep clicking the link to return to the first revision.

You see here <<cycle pet>>a dog<<becomes>>a cat<<endcycle>>.
<<revise pet "Change pet">>

This will change "a dog" to "a cat" and vice-versa, with the link never expiring.

<<insertion>> and <<removal>>
Two other variations exist, which are roughly analogous to <<timedinsert>> and <<timedremove>>.
You look at the plate. <<insertion grain>>1 grain.<<becomes>>2 grains.<<becomes>>3 grains.<<endinsertion>>
For <<insertion>>, the first version "1 grain" is initially invisible. Clicking a <<revise>> link will make it visible. Then, it functions as normal.
You look at the plate. <<removal seed>>3 seeds.<<becomes>>2 seeds.<<becomes>>1 seed.<<endremoval>>
For <<removal>>, the <<revise>> link will remain when you get to "1 seed". Clicking it a final time will remove the text altogether.

Example program

Technical details

  1. Each version inside a <<revision>> macro is a <span> classed with "revision-span" as well as the kind of version they are ("becomes", "gains"). When they appear, they are given the class "revision-span-in" and their display is set to "inline". When they disappear, they gain the class "revision-span-out" and, after 1 second, their display is set to "none". All of these are inside a container <span> classed with the name of the macro ("insertion", "removal", "cycle", "revision") and the name of the identifier ("book" or whatever the author set it to be).

Version history:

  1. 27-9-2013: Fixed several bugs, including:
    <<revision>> macros were being called twice on passage load.
    <<revision>> macros were still taking effect while they were animated being removed by other macros.
    Multiple <<revision>> macros with the same ID weren't all being revised at the same time.
  2. 16-6-2013: Updated regarding Combined Replace Macro Set.
  3. 26-4-2013: Added extra options to <<revise>>.
  4. 20-4-2013: Added <<hoverrevise>> and support for <<randomise>>.
  5. 18-4-2013: Initial

Feel free to report any bugs to @webbedspace.

TwineMacro-RevisionTest.html68.47 KB
TwineMacros-Revision-1.2.0.txt9.87 KB
SpindleyQ's picture

MarMOTS Vision #1 Nearly Attained!

MarMOTS is back up, and more awesome than ever.

For reference, here is my 8-part vision. The only difference between the server that is now live and Vision #1 is that the current system is still missing a chatbox. That will not be hard. I'm also hoping to get bright colours up and running soon; have to run some experiments still. Smiley face support is unfortunately absent.

The current whiteboard-specific code is about 250 lines of Python; the whole server / framework is about 1400 lines. I love you, Stackless and Twisted.


Game File: 

Spambot roams the internet wastelands until a chance meeting occurs.

UPDATED VERSION: now with two different enemy types and sound...

Made For: 
An event

update i guess



apologies for shilling commercial stuff here but i figured this would be appropriate epilogue to marker games: i finally got around to compiling them and putting together a commerce pack (PC only at the moment, but i plan to buy the html5 exporter with monies from this version). it's at my website here http://harmonyzone.org/50SHORTGAMES.html .
The idea of MONETIZE THE PIRATE KART is kind of a dubious achievement but oh well. i really liked making all the games n hope to go back to releasing semi regular things here at some point n hope maybe the idea of weird commercial compilation loaders for trainwreck games catches on. i love multicarts and scrappy stuff so anything that encourages it seems ok to me.

hope ya have a good year in 2014,
stephen XOXOXO

3D trainwrecks?

Hey, just wanted to tell you guys about this program I found called 3D Rad. Judging by the tutorial, it's easy to use. Who knows, I may make something in it in the next few days...


Dino Pit

Game File: 

ok guys i made you a game
its dinosaurs

Sebastian Janisz
Made For: 
An event
Radix's picture

Ladies Auxiliary POPOVKAST

Podunkian wasn't able to attend this weekend's Klik of the Month, and he was feeling really beat up about it. I mean seriously depressed. Trying to drink himself into oblivion depressed. And that's terrible, you know?
So we had this thing: one hour time limit, sprite sheet theme. Both of us drinking, Pod all kliking through tears, so expect quality.



garfeildadventure.png6.52 KB
garfieldknight.png13.66 KB

Jackson Pollock Experience


Paint like Jackson Pollock, but only bad cause you don't paint as good as Jackson Pollock... Oh well.

Controls: Mouse = Painting, Shift = Different Painting, Spacebar = Start Over.

Vince Betteridge
Made For: 
An event

Pixel Perfect 2

pp2 screen.png

Yeah I made another one.

Made For: 
An event
KlikBot's picture

Timezone Lottery Klik Jam #14

Sat, Jul 07 2012 05:00 AM
07/07/2012 - 12:00
07/07/2012 - 14:00

The time is right... for making videogames! The Timezone Lottery Klik Jam happens on the first Saturday of every month, at a time chosen randomly by our top-of-the-line numerical hour-choosing machines. This month, it takes place at 12:00 pm UTC. Whenever that time rolls around for you, you have two hours to make a game!

How can I possibly make a game in that short a timespan, you gasp? There are many game-making tools available, but the most ludicrous and welcoming of all is Klik & Play. If you want to give K&P a shot, we have a Learning KNP FAQ available, as well as some advice on making it work on modern machines.

Making games is its own reward, but it can be much, much more rewarding when you're doing it with friends. To get the most out of this worldwide internet game jam, come talk with everyone on IRC. It's a great way to share this awesome experience, and get quick help when things aren't going right. Our server is irc.freenode.net, and our channel is #glorioustrainwrecks.

After you've made your game, upload it here!

For more information, check out the N00B FAQ.

Sign up below to get a reminder email the day before the jam!

Games made for Timezone Lottery Klik Jam #14

Syndicate content