Best Way to Add "Artistic" Pauses

Watcher55
At certain places in the game, I like to have "artistic" or suspenseful pauses -- description 1 <pause x seconds> description 2 <pause x seconds> ... and so on.

So far I have done this using nested SetTimeout (4) { scripts }

However this has a significant problem, namely the user has the power to click on the compass, thus moving while my brilliant timed prose is still slowly being revealed, and/or to click on hyperlinks in room descriptions, inventory etc -- again, doing things when they shouldn't be.

The basic problem here is to "maintain the suspense" while doling out things slowly happening in the player's world, while preventing the player from doing things while the doling out is in progress.

My question is, does anybody have an optimum solution to this?

I figure that instead of using SetTimeOut I can just use the Pause() function. I'm not sure that actually works (I'm sure I tried it...), and I also thought that it had been deprecated in favour of timed scripts, but I see now looking at the online manual that there is no indication that is true. Failing that, I see a number of solutions in the various forum posts, such as using javascript blockWindow() and unblockWindow() (these don't seem to work for me though...?), or turning off interface elements like the compass via JS.eval ("$('#compassAccordion').css('display', 'none')") etc; or individually preventing commands during the timed revelations -- requiring a lot of customised handling.

I was wondering if the many wiser heads than mine out there have an optimum solution to this question? Will Pause() do it, or is that asking for trouble? Or should I just bite the bullet and in cases where I want to add suspenseful doling out of information, add individual exit scripts etc?

XanMag
I need to do this too in X3, but I haven't been motivated enough to make any real progress. I did find this but have no idea how to implement it or even if it would work with Quest. Perhaps others can assist.

http://stackoverflow.com/questions/8595 ... ouse-click

Near the bottom of this thread. Let me know if you get it working or some other solution.

HegemonKhan
I think this is probably related to how it can be done, but I don't understand it (edit: I just looked over it now and now I do understand it... not sure why I didn't understand it before, lol. However I'm not sure if this prevents you from doing other actions/clicks), Pixie should be able to help and explain it to you, or to adjust it for what you need of it or for it to implement as needed by you:

viewtopic.php?f=10&t=5267&p=36333&hilit=notarealturn#p36326

-----------

ways to prevent you from being able to do other actions/clicks:

1. toggle (hide/show) the command-text bar at the bottom of the screen, so people can't type in any Commands
2. have the prose be part of a scripting chain that locks you to it
3. move into a special room for handling it (not having anything to click on), and then moving back to the room that they were in
4. toggle (remove/add) the stuff to click on
5. etc ???

The Pixie
Turning off the panels on the right would make the text expand to the wider margin, so would look bad.

I would see if you can do it with JavaScript and CSS, laying a translucent layer across the panels on the right (so it looks greyed out). All mouse and key actions would (I think) be caught be that, rather than the normal control, and so do nothing. You should also be able to disable the command bar.I have not tried it, but something like this:
JS.eval ("$('#txtCommand').prop('disabled', 'true')")

Watcher55
Yes, completely turning off the panels on the right works but is aesthetically ghastly, with the text expanding to fill the window then contracting again when the panels are shown again.
I already disable the command bar (if you mean the text input field), but unfortunately that doesn't stop clicking on hyperlinks or directions.
My main problem is in fact the generation of a "scripting chain". Using timed scripts simply doesn't do it: the user can merrily input anything during the "gaps".

I am thinking that what would be nice would be timed scripts with a parameter to allow or disallow user input. Though I imagine that would require a change to Quest and I doubt it would be a high priority!

I like Pixie's idea of a translucent mask, unfortunately that is way above my pay grade. In the meantime I'll check out some of the other ideas. Thanks.

Watcher55
OK, by bringing together a few things found on the forum, I've come up with a method that works well enough. At the start of the TimeOut it hides the command bar, blocks user input, and hides the compass etc at the right (otherwise they're visible and look like they can be clicked). Then it reverses that at the end. Hyperlinks in the text remain visible but the cursor doesn't change when you hover, so the user should get the drift.

No doubt there are more elegant solutions, but this works.

First add this Javascript, which combines someone's "window blocking" and unblocking script with hiding/showing things in the Panes that allow input (note that this includes "Inventory2" because my game also has a spell inventory).

function blockWindow()
{
$('#compassAccordion').css('display', 'none')
$('#placesObjectsAccordion').css('display', 'none')
$('#inventoryAccordion').css('display', 'none')
$('#Inventory2Accordion').css('display', 'none')
var div = document.createElement('blockdiv');
div.id='blockdiv';
div.style.cssText = 'position:absolute;'
+ 'width:100%;top:0;left:0;text.align:center;'
+ (navigator.userAgent.indexOf('MSIE') > -1
? 'filter:alpha(opacity=50);'
: 'opacity:0_5;'
) + 'background.color:#ffffff;';
var height = (window.innerHeight
? window.innerHeight
: (document.documentElement
? document.documentElement.offsetHeight
: document.body.offsetHeight
)
);

div.style.height = height + 'px';
document.body.appendChild(div);
}

function unblockWindow(){
var div = document.getElementById('blockdiv');
document.body.removeChild(div);
$('#compassAccordion').css('display', 'block')
$('#placesObjectsAccordion').css('display', 'block')
$('#inventoryAccordion').css('display', 'block')
$('#Inventory2Accordion').css('display', 'block')
}


And to the Quest program add this function that calls the Javascript as well as handling the Command line. Here it also scrolls to the end on unblocking, as my purpose for this always involves text:

 <function name="BlockInput" parameters="blocking">
if (blocking) {
request (Hide, "Command")
JS.blockWindow ()
}
else {
JS.unblockWindow ()
request (Show, "Command")
JS.scrollToEnd ()
}
</function>


Then if using a SetTimer (sec) {block}, call BlockInput (true) at the start and BlockInput (false) at the end, like this:
     BlockInput (true)
SetTimeout (4) {
msg ("Exciting text 1!")
JS.scrollToEnd ()
SetTimeout (4) {
msg ("Exciting text 2!")
JS.scrollToEnd ()
SetTimeout (4) {
msg ("Exciting text 3!")
JS.scrollToEnd ()
SetTimeout (4) {
msg ("Exciting text 4!")
IncreaseScore (100)
EnableTurnScript (BeastChase)
BlockInput (false)
}
}
}
}

HegemonKhan
there is the option of toggling (removing/adding) the Objects' buttons and their texts' hyperlinks (since that is already the method you're using for the other stuff), which is controlled via:

a room's built-in 'displayverbs' String List Attribute
the player's built-in 'inventoryverbs' String List Attribute

Pixie, got a nice guide on them:

viewtopic.php?f=18&t=5023

and also Pixie's guide on Verbs:

viewtopic.php?f=18&t=4953

and their obscure mention in the documentation:

http://docs.textadventures.co.uk/quest/ ... ments.html

Pertex
This should work, too: Disable the option to show the room description when entering a room by script. Then move the player into an emtpy room without exits or objects. There you can call your timer. At the end move the player back to the old room and enable the option again. Something like this:


game.showdescriptiononenter = false
player.parent = roomx
msg ("do something")
wait {
player.parent = oldroom
game.showdescriptiononenter = true
}

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums