Random posts

Twine macro: << addtag >>, << removetag >>, << toggletag >>

This extends my code for applying Twine tags to passage divs, and extends on it as a mechanism for CSS selection. What these macros do, in order, is add a tag to the current passage's tag attribute, remove a tag, and toggle its presence (remove it if it's there, add it if it isn't). This means that conditional application of CSS, controlled by << if >> statements, is possible.
Usage examples: <<addtag "dream">> <<toggletag "lightworld">> <<removetag "darkworld">>

These are guaranteed to work both inside passages, inside << replace >> macros, and, tantalisingly enough, inside << display >> macros. Interesting, very interesting.

If you're using the latest Twine 1.3.6 Alpha (28-1-13) , use this code:

version.extensions["toggletagMacros"]={major:1,minor:1,revision:0};macros["toggletag"]={handler:function(a,b,c){var p=e(a);var d=document.body;if(p){var t=p.getAttribute("data-tags");var i=t.indexOf(c[0]);if(b!="addtag"&&i>=0){var r=t.replace(c[0],"");p.setAttribute("data-tags",r);d.setAttribute("data-tags",r);}else{if(b!="removetag"&&i<0){var r=t+" "+c[0];p.setAttribute("data-tags",r);d.setAttribute("data-tags",r);}}}function e(f){while(f.parentNode&&!f.classList.contains("passage")){f=f.parentNode;
}if(f!=document&&f.getAttribute("data-tags")){return f;}return null;}}};macros["addtag"]=macros["toggletag"];macros["removetag"]=macros["toggletag"];


If you're using a standard version of Twine, use this code instead:

version.extensions["toggletagMacros"]={major:1,minor:1,revision:0};macros["toggletag"]={handler:function(a,b,c){var p=e(a);var d=document.body;if(p){var t=p.getAttribute("data-tags");var i=t.indexOf(c[0]);if(b!="addtag"&&i>=0){var r=t.replace(c[0],"");p.setAttribute("data-tags",r);d.setAttribute("data-tags",r);}else{if(b!="removetag"&&i<0){var r=t+" "+c[0];p.setAttribute("data-tags",r);d.setAttribute("data-tags",r);}}}else{var t=state.history[0].passage.tags;var i=t.indexOf(c[0]);if(b!="addtag"&&i>=0){t.splice(i,1);
}else{if(b!="removetag"&&i<0){t.push(c[0]);}}d.setAttribute("data-tags",t.join(" "));}function e(f){while(f.parentNode&&!f.classList.contains("passage")){f=f.parentNode;}if(f!=document&&f.getAttribute("data-tags")){return f;}return null;}}};macros["addtag"]=macros["toggletag"];macros["removetag"]=macros["toggletag"];

Version history:

  1. 1.1.0 - Now adjusts tags on the body element as well.
  2. 1.0.1 - Fixed not working in Jonah.
  3. 1.0.0 - Initial.
Feel free to report any bugs to @webbedspace.

Klogg's KrapSack

KrokScreen.png

yahhh

Author: 
thecatamites
Made For: 
testing

Reverse Breakout

rbreak.jpg
Game File: 

Because it's a terrible, unplayable idea!

Event Created For: 
Made For: 
An event
SpindleyQ's picture

MarMOTS update

So now that Game Maker is $40 and Construct 2 will eventually be $65, I've found myself turning back to MarMOTS and wondering what it would take to get it into shape as a game-making tool.

My first focus has been getting my scripting language / editor into shape. I lump the two together because the scripting language, while textual, is never parsed from free text; instead, the user is edits the source tree directly using a friendly structured editor, with lots of autocomplete help, and in which it is literally impossible to forget a semicolon or a closing parenthesis. For power users, it should be as fast or faster to type in programs with this editor than with a text editor, and yet newbies will still be able to discover all of their options in a nicely readable self-describing English syntax.

So over the past couple of weeks I have torn apart my previous attempt at this language and rebuilt it. I've arrived at the point where I can type in any programs I like, and add features to the language without much effort. The UI is still pretty painful to use at this point, but that's mostly because I haven't focussed on improving the interaction at all besides making sure auto-complete is usable.

I was thinking I should maybe do like a screencast or something, but the scripts don't DO anything yet. I'm thinking that the next step will be to start integrating the scripting language with ANSI layouts that I draw in MarMOTS. I'm pretty excited to start hacking on that stuff! You should be too.

SophieH's picture

CrappyBoarder

crappyb.JPG
Game File: 

A very rough attempt at making SSX, turns out I didn't have the grasp on math I thought I did.
making it was a little like line rider-3D though, which is nifty I guess.

press space to jump, though the board will get to the end of the track if you dont...

Event Created For: 
Made For: 
An event
qrleon's picture

Ball and Chain and Dinosaur and Roman and Tennis Court

ballroma.png
Game File: 

Approaching dinosaurs must be stopped. Are you challenged to the task?

Made For: 
An event
thesycophant's picture

Chickenfall

screenshot125.png
Game File: 

You're a chicken falling helplessly through a dangerous chute of some kind. Don't fall into a crate, or you'll die! Flap your wings to resist gravity for just a moment and flap yourself to the safety of your nest!

Author: 
John D. Moore
Made For: 
An event
SpindleyQ's picture

Fucking Spambots

Man, fuck spambots. I just installed an anti-spam module and painstakingly hand-deleted like 50 identical posts, so hopefully we won't have this kind of trouble again.

Plus, this is what the new user signup email looks like now:

Quote:
Word up, !username,
Glorious Trainwrecks Dot Com is delighted to have you aboard! Assuming you're not a spambot. You're totally a human being, right? Right. That's why I don't need to put a direct login link in this email.

Anyway, here's your username and password:

username: !username
password: !password

This is a one-time login, so it can be used only once.

After logging in, you will be prompted to change your password, because who wants computer-generated passwords? Godless spambots, that's who.

A spambot killed my parents, you know.

-- The Glorious Trainwrecks Dot Com User-Authenticating Robot


GOOD LUCK SCRAPING THAT, YOU JACKASS SPAMBOTS

ExciteMike's picture

Moneytize

moneytization.png
Game File: 

Learn about making a living in the exciting world of free-to-play online games!

I've got a Flash version of it up over here.

Made For: 
Klik of the Month Klub #33 (Mar 2010)
Syndicate content
pensive-mosquitoes