Allow any command with some exceptions.

OurJud
27 Nov 2014, 02:08Sorry if my title's not clear, but I couldn't think how best to phrase it.
Let's say I've just had a conversation with someone in his office. When the conversation is over, the player will hopefully understand that the scene is over and he's meant to leave. I've set up a few commands for this; leave; leave office; go out; go... all of which will move him from the office to the building's foyer. But, I want to set up some kind of script where any input other than those I've set, will get a response such as, 'There's nothing more to be done here." or words to that effect.
I'm thinking along the lines of the 'get input >> if result=... >> otherwise print this...', which brings me to a question I've been meaning to ask for some time. Does the 'if result="...' script allow for multiple entries, i.e 'if result="leave"; "leave office"; "go out"; "exit" '?
I appreciate the game already does this to a certain degree, with default responses such as 'You can't do that' or 'I don't understand that command', but I want to give the player the sense that the game is at least listening... if that makes any sense.
Is this possible, or would it involve lots of complex coding?
Thanks in advance.
Let's say I've just had a conversation with someone in his office. When the conversation is over, the player will hopefully understand that the scene is over and he's meant to leave. I've set up a few commands for this; leave; leave office; go out; go... all of which will move him from the office to the building's foyer. But, I want to set up some kind of script where any input other than those I've set, will get a response such as, 'There's nothing more to be done here." or words to that effect.
I'm thinking along the lines of the 'get input >> if result=... >> otherwise print this...', which brings me to a question I've been meaning to ask for some time. Does the 'if result="...' script allow for multiple entries, i.e 'if result="leave"; "leave office"; "go out"; "exit" '?
I appreciate the game already does this to a certain degree, with default responses such as 'You can't do that' or 'I don't understand that command', but I want to give the player the sense that the game is at least listening... if that makes any sense.
Is this possible, or would it involve lots of complex coding?
Thanks in advance.
george
27 Nov 2014, 04:11To answer your question, yes you can do something like this:

FYI a more wordy way to write the if test is
However unless you have a good reason I wouldn't suggest doing it this way. Custom get inputs like this are pretty easy to break. If you want to end the scene I would just do that and not require further input. If you want a command in order to allow the player to do some further examining of the scene or whatever, I recommend implementing the command with the aliases you want.
FYI a more wordy way to write the if test is
if (result = "red" or result = "blue" or result = "green") {...
However unless you have a good reason I wouldn't suggest doing it this way. Custom get inputs like this are pretty easy to break. If you want to end the scene I would just do that and not require further input. If you want a command in order to allow the player to do some further examining of the scene or whatever, I recommend implementing the command with the aliases you want.
HegemonKhan
27 Nov 2014, 07:42also... the 'if' scripting has the:
if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if ....
...and on and on...
] else {
xxx
}
the 'else' is a great finally check, as it deals with any remaining input choice.
if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if (xxx) {
xxx
} else if ....
...and on and on...
] else {
xxx
}
the 'else' is a great finally check, as it deals with any remaining input choice.

jaynabonne
27 Nov 2014, 10:14Check out the switch statement. You can switch on result and have multiple matches go to the same code.

OurJud
27 Nov 2014, 14:25george wrote:If you want to end the scene I would just do that and not require further input.
I did consider this, but wasn't sure how best to go about it. I don't like the 'continue' hyperlink or even 'press any key to continue'. I could 'move' the player automatically after a set time, but that's out of the question as I have no way of knowing when they'll be finished reading the scene.
I even have the NPC in the office telling you to leave, but I just don't know best to trigger the leaving.
So if I did nothing, would the move be triggered on key press?
Thanks to all for the info on 'if result...' functionality. Good to know.
george
27 Nov 2014, 18:51Yes on key press. A continue link might be friendlier for mobiles. I can't remember if Quest turns a press key message into one automatically.

OurJud
27 Nov 2014, 18:52Thanks.

OurJud
04 Dec 2014, 00:11OurJud wrote:Sorry if my title's not clear, but I couldn't think how best to phrase it.
Let's say I've just had a conversation with someone in his office. When the conversation is over, the player will hopefully understand that the scene is over and he's meant to leave. I've set up a few commands for this; leave; leave office; go out; go... all of which will move him from the office to the building's foyer. But, I want to set up some kind of script where any input other than those I've set, will get a response such as, 'There's nothing more to be done here." or words to that effect.
I've just discovered how to do this, and can only imagine I hadn't made it clear what I wanted to do, as I refuse to believe I'm the only one who knows about this.
Anyway, I added a command to the room in question and just put '#text#' followed by a script which gets two thugs to boot the player out of the room.
Now, if I type ANYTHING, other than the commands I've set OR the other, normally recognised IF commands (in other words anything that would normally get 'I don't understand that command'), the player gets thrown out by the two thugs.
