Hi, I'm new to twine and have very little knowledge of programming... ha. Sooo, onwards. Um, I've been playing around with this macro -
https://www.glorioustrainwrecks.com/node/5108. It's the <<timedgoto>> stuff. My question is - Is there anyway, in this, or in another macro that anyone knows of, that I can create something whereby, the player is given 10 seconds to act and depending on how long they take to answer, is taken to a different passage? Say 0-3 seconds you go to passage 1, 3-6 seconds you go to passage 2, 6-10 seconds you go to passage 3? Anything like that? Thanks and fingers crossed!
Comments
You can't use a normal passage link like <<if $choice is 1>>Passage 2<</if>> because the game measures values for displaying the if statements on passage load, so you need something like a click macro that measures what variable you have on the click.
Alternatively you could also ways do something like forward the player to a transitional passage containing a <<goto>> macro that redirects the player instantly based on what variable they have now.
E.g. instead of that click macro write:
And in transitional passage write:
Just be careful with <<timedcontinue>> adjusting variables because it will do so in the background even after you leave the passage, so $choice in that example will always eventually end up at 3 after 9 seconds, so you may also need later code to reset the variable back to the chosen choice, or just not use that variable again for anything.
@Claretta ... So... if it keeps running in the background, is there a "Stop" call or something? I ask because I want to keep presenting the choices... and yes, I am always seeing it hit the last mark.
Any ideas?
Thanks in advance.
Sage
EDIT: I am already doing the following, but it keeps running anyway.
Hmm. I should update <<timed>> to die on passage navigation.
For now, you could do something like the following: The timers will still run if the player navigates away, but they won't modify $choice this way.
Wait.... are we on a "bro" basis? Hmm....
Thanks Mr. @TheMadExile
/headdesk
I agree...
I just don't know where it would go otherwise.
I actually use the feature of <<timedcontinue>> not updating on passage navigation. For example, for a spam blocker on voice acting. I want to set a spam blocker to last 2 seconds after a player leaves a passage while voice is playing so when they go to another passage, a voice doesn't start, but is sufficiently delayed for the previous to fade out. Timedcontinue does this easily at present due to it lasting beyond passage transitions.
I also use the feature to control graphics transitions, which might not be smooth if they were in lockstep to passage transitions. I can understand that some people may want it to die on transitions, but for me it is a highly useful feature.
At first glance I think you're trying to control it only in 1 passage? You need to set a variable in the next passage.
Say you want to do some real time mechanics where you set a time limit to make a decision otherwise the player gets booted: But you don't want that to happen if they click on the link to "Decision Passage" before 20 seconds is up.
So then you write instead:
And then in "Decision Passage" write:
That way when the timed continue macro reaches 20, it won't activate the goto after the player visits Decision Passage.
Alternatively you can do the same thing with the (visited) command. So
That way the player will never be moved to New Passage if they have visited Decision Passage first.
And due to the power of not being able to edit your posts, the mistake will sink a thousand newbies. Why did we switch away from the old forums again? /sigh
I truly am. I should be able to take that and run... but it doesn't perform as expected.
Don't get me wrong, your work is fantastic. Maybe I'm just too new at this.
Now it doesn't work at all. I mean, you know, it works but the timer is blown to hell.
Here is the upshot of the code (and there are samples and gameplay below, but the gist is important for the sake of expediency)
This is a fight mini-game. You're reading a glorified novel, you get to a fight scene, then you act out the fight. After which, you go back to reading. This is a largely word-based experience.
The in-game goes like this: The word "Fight" appears on screen and it moves. The faster you click it, the more likely you hit the guy. The slower you click it, the more likely he hits you.
The sliding scale of the 0 - 3 goes like this:
(0 - 3 being reaction times, and 0 is the fastest)
0 - you hit him for 2 points of damage
1 - you both miss
2 - he hits you for 1 point of damage
3 - he hits you for 2 points of damage
TL;DR: you click fast, you hit him. If not, you don't.
For some reason, the timer does practically the opposite it seems. I'm sure it's just still running in the background or something... but still.
I even added <<set $choice to 0>> on every new "result of your combat" page. Still nothing.
EDIT: Not only that, but there is a kill-switch at 1 health that is supposed to incapacitate you. It used to work. Now... with the new turns() code in place... it doesn't. For either character.
So... here is the link to the playable mini-game:
superheropress.com/fight
And here is the link to the exported file so you can see where I may have screwed it up:
.zip of 1 document
Notice of Copyright : The music is from our in-house composer so yes, it's copyrighted, but (obviously) since he is our composer, I do have permission to use it. Forum users please be kind and don't reuse his work. You can take this mini-game and use it as you like—hell, at this point it's more of TheMadExile's work than mine anyway—but please don't take the music. It's not mine to give. Thank you for understanding.
You should create a separate passage for your widgets and tag that with widget, then move your widgets to it and remove the widget tag from StoryInit.
I'd forgotten what you were working on. The problem is that since you're going back to the same passage again and again ("Fight"), you keep resetting the value of $timedTurn. Meaning that, except for a very brief window, the test ($timedTurn is turns()) will always be true and thus <<timed>> macros from a previous instance of "Fight" can still alter $choice. So, for what you're doing, specifically, the situation with code I gave here is pretty much the same as without it unfortunately. Basically, you're still hosed until I publish a new release. Sorry.
That said, I do plan to release another 2.x beta soon, probably today, so you won't have to wait long for a fix.
Also, I'm not seeing the kill-switch problem in the version I compiled myself. It could be caused by something else you had tried to fix this problem and thus isn't in the archive.
Well, the audio isn't compiled into the file, and you didn't include it in the archive, so you don't have to worry about it. ;}
So…???
As for the kill-switch I had it set with an "if/else" based on health and if you had anything less than a 2, the fight was stopped and you were shown different things. Strangely, I now get to negative 3 and I'm still in the fight. Which, yay, great tenacity... but not how it was supposed to work.
Thank you again, I will look into what I broke in the if/else.
Thank you also for the upcoming update!
Fully updated Fight 2 example attached (including updated Bleached style and some cleanup).
So... stupid question... you don't have to answer it: How are you compensated? Because seriously! You help a lot of people! Like, many.
Or... or... and this is my personal favorite. You're Mark Zuckerberg and you just do it because you like it and you don't need the money!
I'm going with that one.
Well, actually, that's not entirely true now that I think about. I did once have someone gift me something off of my Steam wishlist as payment/thank you/whatever for some bit of Twine work I did for them.
I've though about adding some kind of voluntary tipping thing to my website, but I don't know. It just seems boorish to wave a tip jar in peoples faces for something I'd probably be doing anyway. /shrug
And we're kind of veering way off-topic.
I thought you were saying you had updated your replace macro set. I didn't realise you had created an entirely new macro. <<timed>> and <<timedcontinue>> sound suspiciously similiar.
@Sage: As an FYI. You could also write the Fight passage without using <<timed>> at all by using the time() story function. For example (the entire Fight passage):
It's really bad when you look at the example I give for the time() function, which is exactly what you are doing here. I swear, some days I think I must have left my brain on the nightstand.
Awesome. Much more simple to read as well.
Thank you.