I want to "trap" the player from being able to do anything temporarily

Oddicine
I'm totally new to this so I'm going to have a lot of questions and I apologize for that :|

I need help with figuring out how to do the very beginning of my story.

I'm using quest and I'm just trying to write a good ol' classic text game, no maps or illustrations, just inputs and fun guesses.

I want to "trap" the player, meaning at the beginning of the story, she's strapped down and can't move until someone comes in and lets her loose, therefore she wouldn't be able to grab anything in the room or inspect anything too far away.

I'm just totally unsure of how to do that.

chellkafka
Do you want to give the player a message like "you can't grab that" or "you can't do that?"

Oddicine
No, something more like, "The straps at your wrists prevent you from doing much of anything. The moon outside the window is quite lovely though."

Oddicine
I guess after I thought about it that's more or less the same thing, so yes I suppose, lol

chellkafka
And do you want to keep it simple and be that the only message in that state or do you want to make it a tad more complicated and have for different actions, different messages? And don't worry, it's not that more complicated, you just have to write a bit more code.

Oddicine
A bit more code would be fine but that's all I want it to say in this first screen. However, there is going to be another instance later on where more messages will be necessary so I'd like to learn how to do that anyway, if you don't mind.

TinFoilMkIV
Well there are at least two good options for this I can think of. The first would be creating a duplicate of the room your in, one would be the normal game room when the player is free to do as the game allows normally, and the second version where the player is trapped. The other method would be to use a get input which will basically remove the players ability to use the normal commands and give you complete control over their available actions and the results.

The first option is probably the simpler of the two. basically the trapped room will have all the same descriptions and objects that the normal room does, but you can then change the descriptions or command results on the objects or whatever else in that room, so that the responses will line up with the situation. Then when the even that frees the player occurs, you move them to the normal version of that room.

The second option using get input is a bit more complicated but give you a lot more control. Basically get input will take the next thing the player types and save it as a hidden variable 'result', and nothing will happen unless you tell it to. This takes more work as you will need to account for all the things the player should be able to do, however you have complete control and can give the player as many or as few choices as you'd like. This is particularly useful for menu type situations where you do not want any normal character actions to happen. To actually do stuff with the input you would use either if/else (ie: if(result = help) {//do help stuff here}) or my personal preference of a switch (ie: switch(result) {case(help) {//do help stuff here}})

Oddicine
If I went with the first option, because I also thought of that, how would I silently move them to the duplicate room?

Also, how do I separate room descriptions with character descriptions and story? For example, I want to put a paragraph or two of story before the room description, but I don't want it to come up every time the player types "look around" or something like that, same with the players situation. I'd like the story, players situation (i.e. You're wrists are strapped to the bed frame, prohibiting any movement.), and then the room description, but when the player types something like, "look around" I only want the room description to come up, but so far the only way I know how to input text is in object descriptions. :oops:

TinFoilMkIV
I'm not sure about silently. I imagine there's a way but I don't know of it myself. Personally I'd probably just try to script the sequence of events in a way where it doesn't seem to odd to end up looking around the room again, or like a 'continue....' prompt after the description of you being freed then resetting the screen to the room description so it looks more like it was just clearing the text, although that wouldn't work if you want most of your text to be persistent.

As for some tools to get messages that you don't want always in the room description, there's some useful stuff about the text processor, namely the one time display

{once:text}
Displays the text only once. The text will not be printed on subsequent occasions.



A different way to achieve something similar is have a scripted event leading up to the room where you have text being displayed before the room coming from the script and not just the room description. You can also manually force a room description in a script with ShowRoomDescription ()

HegemonKhan
Are you using Text Adventure version of quest or the Game Book version of quest?

the below, is for using the Text Adventure version of quest, but a good bit of it is applicable for the Game Book version of quest too.

------------

if you haven't already, I highly suggest that you go through as much of the tutorial as you you can (asking us questions on how to do parts of the tutorial that you're stuck upon), as it teaches (or at least gets you familiar) with the basics of using quest, then afterwards, ask all the questions that you want from us (as at least now from the tutorial you might have some ability to be able to understand us a bit as we try to help you), hehe:

http://docs.textadventures.co.uk/quest/tutorial/

----------

and other useful links, for after you've done the tutorial:

http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/guides/
viewforum.php?f=18 (more guides: libraries and code samples)

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

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

---------

probably the easiest way for you (though it's the most tedius), is to create (add) a Boolean Attribute to your 'player' Player Object:

'player' Player Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)

(Object Name: player)
Attribute Name: immobilize (or whatever you want to call~name~label it as)
Attribute Type: boolean
Attribute Value: false (or do 'true' instead if you want your 'player' to start out unable to do anything)

and then when ever~where ever, you have scripting (actions~events: run as script -> add new script, such as with using Verbs), you use this the 'if' (if~else if~else) Script:

run as script -> add new script -> scripts -> 'if' Script -> if [expression] player.immobilize = true
-> then -> add new script -> output -> 'print a message' Script -> print [expression] "You can't do anything because you're immobilized."
else if -> add new script -> scripts -> 'if' Script -> if [expression] player.immobilize = false
-> then -> (add whatever scripts that you want, for when you're able to do whatever, due to not being immobilized)

---------

lastly, to change your state of being 'immobilized' vs 'mobile (lol) ~ non-immobilized', you do~use these Scripts:

to immobilize yourself:

run as script -> add new script -> variables -> 'set a variable or attribute' Script -> (see below)

set variable player.immobilize = [expression] true

to mobilize (to non-immobilize) yourself:

run as script -> add new script -> variables -> 'set a variable or attribute' Script -> (see below)

set variable player.immobilize = [expression] false

The Pixie
The way I would do it is to set up a flag on the player, say called "stuck", a boolean set to true. Then for all the actions, check the state of the boolean. For example, for each object in the room, have a "take" script that looks like this:
if (player.stuck) {
msg( "The straps at your wrists prevent you from doing much of anything. The moon outside the window is quite lovely though.")
}
else {
this.parent = player
msg("Taken.")
}

That you are doing this from the start will make that easier, as they will be limited actions possible in the starting room.

When the player is freed:
player.stuck = false

Oddicine
Thank you all for the help! I understand it a little better now so I can mess around with it. And yeah, it's a text adventure rather than the game book. I did go through the tutorial, that's how I have at least a vague idea of this scripting, I just have yet to apply it to events in my actual story so I'm sure with experience comes ease and understanding, lol. So thank you all again! :mrgreen:

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

Support

Forums