2013-07-27

Small victories!

Aside from writing, I've been looking into adding more features to my Twine projects. A while back I stumbled upon a <<replace>> macro, which is a really useful way to display links that turn into more text when clicked. This is something that is really helpful depending on your game, and I can think of a lot of good uses for it. I've already begun using it as a way to compress extra information on the title page for NDGA. The text that is inside the replace macro will only run after the link is clicked, so it can be used for variables BUT one issue is that if the user has the ability to go backwards in your game, variables might not save properly. There is probably some workaround to that, but even so it is a really useful tool.

One of the things I've thought about doing is saving information between Twine games. The built in Twine <<remember>> macro allows you to save a variable in a cookie, which can then be read from multiple stories. This is exactly what I needed, but the problem is that it was not working properly in Twine 1.3.5. This was incredibly frustrating to me, and nearly made me want to give up on Twine. After some digging I found a story format update that fixes the macro, and saving cookies works! I am considering using this to break up Midnight Room into separate games.

Another thing that came to mind was the ability to change the color of passages with a macro. I figured this would be simple enough to do with a macro, so I went about looking for info on how to write them. I don't have a lot of experience coding with Javascript for the web so a lot of the technical stuff is new to me. Luckily I found a great blog post on creating your own macros. I was able to mess around with things to the point of getting the page background color to change with a macro like this <<backgroundColor "#fff">>. Changing text color was stumping me, so I dug further and found another useful post with something similar to what I was after. My final macro looks like this <<recolor "#ff0" "#0fe">>.  Here is the little macro I put together.



Twine is great not so much because of what it does, which is pretty cool, but more so because of the awesome developers and community (although small) around it.

No comments:

Post a Comment