Hi,
I recently found Twine and I'm impressed with its simplicity and extensibility--it seems that anything that can be done in JavaScript can be done in Twine, via JavaScript.
I thought I'd ask about a particular feature, in case anyone has done it already: a menu that pops up when a link is clicked, itself listing one or more links. For example, if I click on a link "door" in the middle of a passage, several options pop up: "examine", "open", "kick down", etc., instead of displaying these in the normal way as "Examine the door", "Open the door", etc.
I'm also interested in real-time game-ey mechanics. Has anyone, for example, implemented features of MUDs with Twine? I mean something like a real-time text adventure, with NPCs acting over time, or random events happening once in a while.
Thanks!
Comments
I ask because a solution to either of your questions that works in one version of Twine may not work in the other unless you were using story format that is common to both versions. (eg. SugarCube or Snowman)
2.x, unless there's a good reason I should use 1.x.
Both Harlowe and SugarCube have a goto macro which can be used to programmatically send the Reader to another passage the same way a standard link does.
The issue your going to have to solve is the displaying of the popup menu, though there a many examples on the internet showing how to use CSS and/or javascript to do this that should also work in a twine passage. Depending on which method you choose there there may be some issues with dynamically calling javascript if your using the Harlowe story format.
2. MUD like: Both of the following may give you ideas.
a. Sharpe's Example Turn-Based RPG (Pre-Alpha v. 0.4) has a SurgaCube version which may work in 2.x
b. guy231's JRPG-like combat system in Twine 2
To do this in SugarCube, the javascript is: Then you need css to define the popup and the popup link (this is just css that works for my game): Use it in sugarcube with:
<<popup "link text to display" "passage title to popup">>
You can then just list links in the popup passage as normal.
As is, this probably won't be exactly what you're after, but you should be able to play around with the CSS to get it displaying where you want.
Here's why I ask: I would like the (hyper)text inside a popup window to have a "Close" link at the end. Granted, there's already the X in the upper right-hand corner, but I think a link with text would add some user-friendliness. (Side note: On my PC, I'm also able to close the popup by clicking outside of the popup, but that technique seems not to work on my iOS device. So I'm looking for an alternative to the X that works on all devices.) Also--although I don't think I need this on my current project--it would be nice if I could put a passage link inside one of these popups and have the popup vanish when the passage link is clicked. As it is, clicking a passage link navigates to the passage but leaves the popup front-and-center.
Apologies if this question is already answered someplace on the forum. I did some looking but didn't find an answer. Thanks in advance for any comments!
Via macros: Via HTML: The first two allow you do close the dialog and do other things, the latter two just close the dialog.
While it’s not a MUD, you can check out my own "Three Dragons" for a real-time battle mechanic:
http://samoff.com/twine/threeDragons
Inherently, the term MUD means "Multi-User Dungeon," which I haven’t seen done in Twine before. On the other hand, Dan Cox did a great tutorial about creating a dungeon crawl style game on YouTube… Here’s the first segment:
https://youtu.be/5_gbzdRVdAc
So the links are now:
a. Sharpe's Example Turn-Based RPG (Pre-Alpha v. 0.4)
b. guy231's JRPG-like combat system in Twine 2
Don't know if I'm just being silly but I can't get it to work...
Regarding the question in your other thread that led here, please note you won't get popups on hover with this code. To do that, you need to use the autopopup code inside a "hover" macro.
This is autopopup:
Where you need to define it in your css as for example:
And then place <<autopopup "passage name">> in an "on hover do something" macro, that you'll need to find somewhere else.
When I start my story, I get this error message:
Is this information enough? I just copied the code from this page so I don't know what the issue could be.
And did you copy and paste the code exactly as I wrote it above?
And yeah, I copied and pasted the code exactly into a script passage.
If you're using 2.0 you don't use script passages but the inbuilt javascript passage.
Sounds like you want to be using 1.4.2.
They do seem to work. Thank you!