GetInput()

Boneclubbing
03 Apr 2012, 21:24
Hi there, I'm having trouble understanding using the GetInput function, I've found a few threads about it but couldn't quite work out from the posts how to use it -

What I want to do is simple - the player is forced into answering a yes or no question, within the text of the game, rather than in a pop-up window - with one answer moving them to another room, one not. As far as i can tell GetInput is the way to do this, rather than 'Ask' or 'If player answers yes to...' or using menus...

I am pretty inexperienced with the scripting side of quest, mostly stayed with the friendly stuff, so any help would be really appreciated. In this thread viewtopic.php?f=10&t=2891&p=19875&hilit=getinput#p19875 there is a post about a webcast Alex has done on this very subject, which I've been unable to find, so even that would be useful.

Thanks :)

sgreig
04 Apr 2012, 04:07
Yeah, if you're not looking to use the popup menu, then GetInput() is probably what you want to use. Fortunately, it's actually pretty easy to use. Obviously, I don't know how your game is set up or anything, so I'm just going to write an example here to show how to use GetInput() properly. Hopefully you'll be able to extrapolate from that how to incorporate it into your game. This example will print a message asking the player a question, and then store their answer in the variable "answer":


msg ("Do you like cheese?")
answer = GetInput()


It's that easy. From that point, you could either do a switch or an if statement to check if the answer was yes or no. Hope that helps.

Boneclubbing
16 Apr 2012, 14:47
great, thankyou, I'll give this a go!

Pertex
16 Apr 2012, 15:20
@Alex: Is GetInput deprecated now?

Boneclubbing
16 Apr 2012, 16:00
apologies, where exactly do I enter the GetInput script? do I put in manually as a new function or command? I think I now understand how it works but I'm not entirely sure how and where I implement it - I've yet to do any 'freehand' scripting in quest, only the interfaced stuff!
thanks again.

Pertex
16 Apr 2012, 18:32
You could have a look at this:
http://quest5.net/wiki/Introduction

sgreig
17 Apr 2012, 07:10
It's really easy to do in the interface editor as well. Just add a "Set variable or attribute" enter whatever variable name you want to store the user input as then after the equals sign you can either leave the dropdown field as expression and enter GetInput(), or choose player input from the the drop down. It'll work either way. Here's a screenshot showing both methods:

Quest - Test-020857.png

Alex
17 Apr 2012, 14:29
@Pertex yes GetInput is deprecated in Quest 5.2. There's a new "get input" script command which should be used instead.