How to end Wait using hyperlinks (no command bar) for click-only games?

Hi! I've looked up everything I can find on the forums having to do with this, but come up empty. Here's my big question >>> Is there a way to enable clicking (only) on the "Continue..." link for online play with no command bar, or if that isn't possible, then can I hide the blinking cursor?

I've made a click-only text adventure that has some WAITs in the code. I need the player to click "Continue..." (or any link) to fire the next events. I don't want a key press or get input. Just clicking.

I've tried using the Show/Hide command bar idea, but that doesn't work for online play (it works fine on desktop play). Online, it does nothing but wait, even using...
JS.setInterfaceString("ContinueLabel", "Insert your new label here...") [and yes, I inserted my own label]

...and adding this to the User Interface Initialisation script (I put it right in line with the code above, yes with an opening bracket):
a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none">Continue...

It works one time, but then on the following screen, it just shows the Type Here... command bar, but won't respond to clicking or even show Continue...

I have tried to see if I need some kind of Update Links kind of thing (a command version of UpdateObjectLinks?), but I see nothing like that in forums or tutorials. The best I can do is leave the Command Bar visible, but hide the label from "Type Here..." to a space bar, but then I still have a blinking cursor, and players can still type.

So again, my big question > > > Is there a way to enable clicking (only) on the "Continue..." link for online play with no command bar, or if that isn't possible, then can I hide the blinking cursor?


I guess because of the brackets, it won't display this line in my post (either in the original, or when I try to edit).

I added this to the user interface init JS code:
a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none">Continue...


It looks like you're including a second "Continue…" link; which then overrides the default one when it's unhidden.

My first guess if you want to move the endWaitLink around would be something like:

JS.eval("$('#endWaitLink').appendTo(getCurrentDiv());")

immediately before the wait.


Thank you, mrangel. That is working like a charm so far on desktop Quest. We'll see how it does online.

That line of JS not only works if you put it right before Wait, but also after the events that fire (inside of Wait), but in the latter case without the "Continue..." (players can just click other links).


Drat! Same problem I had before when I upload it for Online Play.

It works fine in the ways I described above, but only for desktop play. The JS does not help either way, mrangel.

If I have the command bar shown, it doesn't work (this is what causes the double Continue, right, and so overrides?) But if I have it hidden, it doesn't work because I must move it down below the Wait line, or else it bisects the rest of the screen's verbiage with the Continue... i.e., if cmd bar is hidden, I can't put the JS line above Wait, because it's aesthetically and logically weird to have that in the middle of the screen's paragraphs.

On desktop Quest, it works fine to place the JS line inside the Wait function. But online, I can't make it work.

. I just don't see how to use Clicking to end a Wait during online play.


I think for some of my events, I can simply do a TurnTimeout instead. It will give much the same result (players may not notice much difference -- they just won't see the "Continue..." and any link will take them there instead).

Still, it would make more sense with Wait (Continue...) And I have a couple of events where it really needs that, so it would be nice to know how to make this work for Click-text Adventures.


This is a very strange error condition. Can you provide a link to an online game that exhibits this error, so I can take a look at what's going wrong?

Also, you said:

I guess because of the brackets, it won't display this line in my post (either in the original, or when I try to edit).

There's a little note to the right of the reply box → saying that to post code, you need to put a line of three backticks (```) above and below it.


mrangel, sorry about the coding ``` (I kept trying that but couldn't get it to work -- maybe I have browser issues).

Here is the link to my finished game -- I used the workarounds mentioned above, and everything acts as it should now. But I would still like to know how to Click links to end a Wait. Do you need code, or just the finished game (I don't know if you're able to see the code somehow -- I've heard of people doing that).

http://textadventures.co.uk/games/view/0n03o9im10yhjjzmnqpuba/treehouse-champion


I've tried the code I posted above, and it works fine for me.

I can only assume you've got some code somewhere that's breaking it.

Do you need code, or just the finished game

It's easy enough to download the game and take a look at it. But as I don't have a Windows computer, I can't run someone else's game. So I can't try it out and see what the problem is unless you can show me a game that has the problem.


Even though I've got my game up and running satisfactorily, I still want to know WHY this doesn't work, in case I make other games in this mode -- it seems like a basic thing that you should be able to do for click-only text adventures. I tried this every which way but got nowhere with it online, whereas on my desktop, it's no problem.

Okay, so I coded over the bits that weren't working, and my previous files got erased to make room in the folder for the whole game (I was pushing very close to 20 MB).

But here's a sample of an event that get messed up when you upload and try to play ONline. This is with the command bar NOT selected in "Interface" options under the Game (up top of the tree hierarchy). This code is the Script for a Room description -- it's what fires when you enter the Room:

if (not GetBoolean(treasure, "victory") and not this.visited) {
  msg ("Before you can get a good look, brutish voices assail you and the monsters rough you up, then toss you back out!<br/>")
  SetObjectFlagOn (clubhouse, "visited")
  MakeExitInvisible (opendoor)
  door.isopen = false
  JS.eval("$('#endWaitLink').appendTo(getCurrentDiv());")
  wait {
    MoveObject (player, Abandoned Playground)
  }
}
else {
  MoveObject (player, dim chamber)
}

If I remember right, putting it above the Wait just did nothing online -- it would hang on that screen until you pressed a button on your keyboard. So I tried moving the JS line of code INSIDE the Wait (above the "MoveObject"). It worked by showing the Continue..., but it bisected the verbiage on the screen, when the monsters in there attacked you on sight (using Pixie's CombatLib). So yes, that was interfering when the JS was INSIDE the Wait.

My other trouble spot came when "summoning" the hero to battle. That WAIT was coded inside an if > foreach > if, so maybe that was interfering? I can show you this code if that would help...


Oh, I have a slightly hacky solution for this that I've been using for a few years, now.

Before a wait, I show the command bar. Immediately after, I hide it again.

request (Show, "Command")
wait {
  request (Hide, "Command")
}

One could probably insert this into the actual wait function somewhere to make it a persistent feature, if you only want to make click-only games like I do.


That would be my normal suggestion. But in the first post, the OP said they were adding an extra a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none">Continue..., so I assume they also want to move the continue link to the current position in the output for some reason.

I believe request is deprecated, and should no longer be used. The recommended way to do this would be:

JS.uiShow ("#txtCommandDiv")
wait {
  JS.uiHide ("#txtCommandDiv")
  // whatever else you're doing after the wait
}

Alternatively, you could add a line to the UI Initialisation script:

$('#endWaitLink').insertBefore('#txtCommandDiv');

Log in to post a reply.

Support

Forums