Getting object as input
63horses
29 Mar 2016, 17:27Hi all,sorry if this is a noob question but I am trying to use the 'get input' command in the GUI to have the player enter the name of an object. The game will then check if that object has a particular attribute and if so will perform an action. I am having trouble getting the game to realize the 'result' the player types is in fact an object. Any suggestions would be much appreciated
HegemonKhan
29 Mar 2016, 18:23this isn't very intuitive for people new to quest and especially coding/programming.
the 'get input' gets your typed-in input, which is a string (string/text: a sequence of characters/symbols). A String is not an Object, so you got to get the actual Object (that has that same 'name' String Attribute, which is its ID, as what you typed-in for your input), if it exists, in order to then act upon that Object.
so you need these (not sure where to find/do them within/via the GUI~Editor, you got to figure that out, as I don't know it at all):
http://docs.textadventures.co.uk/quest/ ... bject.html
and/or
http://docs.textadventures.co.uk/quest/ ... bject.html
as to how to implement this stuff, that's a bit more difficult to do...
some simple examples in code:
the 'get input' gets your typed-in input, which is a string (string/text: a sequence of characters/symbols). A String is not an Object, so you got to get the actual Object (that has that same 'name' String Attribute, which is its ID, as what you typed-in for your input), if it exists, in order to then act upon that Object.
so you need these (not sure where to find/do them within/via the GUI~Editor, you got to figure that out, as I don't know it at all):
http://docs.textadventures.co.uk/quest/ ... bject.html
and/or
http://docs.textadventures.co.uk/quest/ ... bject.html
as to how to implement this stuff, that's a bit more difficult to do...
some simple examples in code:
get input {
msg (GetAttribute (GetObject (result), "whatever attribute")))
}
get input {
Set (GetObject (result), "whatever attribute", whatever value)
}
get input {
if (Contains (whatever object, GetObject (result))) {
// whatever script(s)
}
}
get input {
if (GetObject (result) = object name) {
// scripts
}
}
The Pixie
29 Mar 2016, 18:26Why are you trying to do this? What you describe is exactly what commands do, and it might be easier to create a new command to do it. If you could give some specifics, we might come up with an easy solution.