Help! new person

pacattack25
Hello - I felt like trying to get into the quest world and ... there's a lot of stuff for me to get into I've been playing around and I find that there are certain things that are unintuitive to me. Like for instance get input is INFURIATING to me - after 6 years of JAVA/c++ I expect a method called "GetInput" to get the input maybe even put it into the variable that I want it to do... But this leads me to a problem... I find no way to set where the get input is going, and I don't know where the getinput is going to validate said input. I honestly have no idea what 'log' is supposed to do and the help files that I have seen don't explain it, picking inventory adds to inventory by default and doesn't give me an option to take from inventory, if not handled the best way (I can't put in if (Variable != "true" in the actual code without producing an error)) I feel like this is a programmer's nightmare - of course it said scripting language and C++ and Java aren't those... but I have done some powershell and Terminal practice under my belt as well, and the if is the same for just about everything. A method called "GetInput" is about the same in any language this is just... unintelligent to me personally that I can't get a hold of someone's input to validate it. I even put "Validating input" into the search bar and got NOTHING - this means one of three things: 1 either it's SO hard and unintuitive that no one has ever gotten a hold of how to do it, 2: it's so easy to do it I just have to get my programming knowledge out of the way first and restart from a world that expects no one to be a programmer - I just haven't figured it out yet, 3: The search doesn't find general terms meaning the same thing as what you put in... either way of the three there's a problem.

Pertex
DId you really check the wiki? If you search for "getInput" you get the answer that this function is deprecated and "get input" should be used (with link to the correct wiki page). And there you will find an example how to use it. And a programmer should know that some languages use "<>" instead of "!=" .

Silver
Like this:

viewtopic.php?f=10&t=5055

HegemonKhan
some links for you:

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

2. http://docs.textadventures.co.uk/quest/ ... notes.html

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

4. http://docs.textadventures.co.uk/quest/tutorial/
5. http://docs.textadventures.co.uk/quest/guides/
6. viewforum.php?f=18
7. http://docs.textadventures.co.uk/quest/ ... ation.html

8. http://docs.textadventures.co.uk/quest/elements/
9. http://docs.textadventures.co.uk/quest/types/
10. http://docs.textadventures.co.uk/quest/functions/ (category order)
11. http://docs.textadventures.co.uk/quest/ ... tions.html (alphabetical order)
12. http://docs.textadventures.co.uk/quest/scripts/

13. http://docs.textadventures.co.uk/quest/ ... mmand.html
14. http://docs.textadventures.co.uk/quest/ ... input.html

15. http://docs.textadventures.co.uk/quest/ ... lists.html
16. http://docs.textadventures.co.uk/quest/ ... aries.html

17. http://docs.textadventures.co.uk/quest/ ... ching.html
18. http://docs.textadventures.co.uk/quest/ ... lates.html

19. http://docs.textadventures.co.uk/quest/scopes.html , and the 'Gets' and the 'Alls' Functions too.

-----------

you can use:

'get input' Script
and
COMMANDS

for using user~player (during game play) inputs

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

'get input' sets whatever you type to a built-in Variable named~called~labeled as 'result'

result = your_typed_in_input_during_game_play

---------

a quick thing about quest:

VARIABLES:
-> Variables: local~temporary: only works for the scripting that it is directly within
-> Attributes: global~'permanent'~'save+load able' (as they're attached to Objects, ?Object-Oriented Programming?, so, so long as the Object exists, its Attribute can be referenced)
-> Parameters: Commands and Functions use them (this is probably what you're more used to in what you're talking about in your OP)

---------

Variable examples:

(see Attribute Types, http://docs.textadventures.co.uk/quest/types/ , for syntax for the different types of Attributes)

variable_string_label = Value_or_Expression

result = "blah"
handled = "blah2"
you_go_first = true
value = 5

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

Attribute examples:

(see Attribute Types, http://docs.textadventures.co.uk/quest/types/ , for syntax for the different types of Attributes)

Object_name.Attribute_name = Value_or_Expression

player.strength_integer = 100
orc.dead_boolean = false
game.flag_string = "1"
game.greeting_string = "hi, what is your name?"
player.left_hand_object = shield
player.right_hand_object = sword
game.primary_color_stringlist = split ("red;blue;yellow", ";")
player.condition_string = "poisoned"
player.condition_stringlist = split ("poisoned;paralyzed;petrified", ";")
player.equipment_body_slots_objectlist = split ("head;chest;waist;arms;legs;feet;hands;left_hand;right_hand", ";")
player.equipment_body_slots_objectlist2 = split ("helmet;mail;tasset;vambraces;greaves;boots;guantlets;shield;sword", ";")
etc etc etc

player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100 - orc.armor.armor_class - orc.armor.armor_class * orc.endurance / 100

-----

anyways back to 'get input'... examples:

<function name="name_function">
msg ("What is your name?")
get input {
// I type in: HK
// quest automatically (hidden from you) does this: result = HK
msg ("Your name is " + result + ".")
}
</function>

<function name="name_function_2">
msg ("Your name is " + result + ".")
// ERROR !!!! 'result' is not defined
</function>


or

<function name="name_function">
msg ("What is your name?")
get input {
// I type in: HK
// quest automatically (hidden from you) does this: result = HK
// conceptually: player.alias = result = HK
player.alias = result
msg ("Your name is " + player.alias + ".")
}
</function>

<object name="player">
</object>

<function name="name_function_2">
msg ("Your name is " + player.alias + ".")
// no error occurs
</function>


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

Commands:

this allows for none, one, or multiple inputs (as Parameters) to be used within its scripting

(really lame examples)

pattern: 'activator text~word' (then optionally) 'connector text~word' (then optionally) '#Variable~Parameter1#' ... (optionally) '#Variable~Parameter2#' ... etc etc etc

<command name="help_command">
<pattern>help</pattern>
<script>
// in the command bar during game play, you type: help
msg ("hi")
</script>
</command>

<command name="help_command">
<pattern>help #text#</pattern>
<script>
// in the command bar during game play, you type: help (whatever you want, for this example: hint or godmode)
//
// in the command bar during game play, you type: help hint
// or
// in the command bar during game play, you type: help godmode
//
if (text = "hint") {
msg ("Here's a hint for you to get past this part of the game")
} else if (text = "godmode") {
player.invincible = true
}
</script>
</command>

<command name="help_command">
<pattern>help #text1# and #text2#</pattern>
<script>
// in the command bar during game play, you type: help (whatever you want, for this example: hint or godmode)
//
// in the command bar during game play, you type: help hint and red
// or
// in the command bar during game play, you type: help godmode and blue
// or
// in the command bar during game play, you type: help blah and blah
//
if (text1 = "hint" and text2 = "red") {
msg ("Here's a hint for you to get past this part of the game")
} else if (text1 = "godmode" and text2 = "blue") {
player.invincible = true
} else {
msg ("bye")
}
</script>
</command>


instead of #text#, you can also use #object#, both #text# and #object# have there pro and con uses (in requiring a bit of extra and different scripting)

----------

We can get into (more) Parameter usage with Functions, just let me know, as I'm tired right now, lol.

----------

in quest the 'NAME' String Attribute is the ID for the quest engine, it~they must be unique. Whereas, 'ALIAS', is just a built in string that doesn't have to be unique for each thing.

<object name="player">
</object>

<object name="player">
</object>

// ERROR !!!!


vs

<object name="player">
<attr name="alias" type="string">HK</attr>
// String Attributes are shortened by the quest engine to this tag syntax: <alias>HK</alias>
</object>

<object name="player2">
<attr name="alias" type="string">HK</attr>
</object>

// NO error


vs

<object name="player">
<attr name="strength" type="string">strong</attr>
<attr name="strength" type="int">100</attr>
</object>

// ERROR !!!!


vs

<object name="player">
<attr name="strength_string" type="string">strong</attr>
<attr name="strength_integer" type="int">100</attr>
</object>

// NO error


--------

the quest engine does a lot of the programming stuff already for us (to make it easy to use for non-coders), you just need to learn its language, terms, and how quest works.

P.S.

Quest uses 'XML (eXtensible Markup Language)', but can also use: JQuery (I think) and JS too

Alex is currently recreating~rebuilding quest (as the 'QuestKit' version) to use JS, as I guess XML isn't a common language, sighs (as I learnt all of my limited coding knowledge from quest and its XML usage, lol ~ I guess I'll be learning JS next, laughs)

lastly, being a programmer, you're probably aware of good software already, but if not, I like using this one:

notepad++ ( http://notepad-plus-plus.org/ )

which, allows you to select 'XML' (along with MANY~MOST~ALL other languages), which can help you to learn its format~structure~syntax, if you need, as well as for reading, writing, and troublshooting the~quest's code, too.

pacattack25
This is a LOT of response - First: My bad that was the tutorial I was looking at - which really didn't help. I still can't find input VALIDATION (checking it) though...

2nd: Get input - it's written ON THE BOX get input - how was I supposed to know I needed to put something in there? (an example of not being intuitive) I figured I needed to do SOMETHING - but had no idea what as I wasn't prompted wasn't told that I needed to do something, if fact I only figured out I needed to do something because I saw get input then and found no way to put that into the variable in the then. But thank you for showing me how I need to make it work and like I said Java/C++ I had heard of some languages using <> but just haven't needed to use them thanks for that too in between that and the now knowing result is what I need to put into something I can check that with if.

3rd: WARNING INFORMATION OVERLOAD: It might take me a little bit to get through that all - especially if I'm only trying to do a simple starter game to get a grip on the most basic tools I have and eventually work from the ground up. I'm sure that will all be useful to read when I get a chance though - thanks.

Silver
I've never used get input with the gui. Just seems faster to do in code view.

HegemonKhan
Are you using the GUI~Editor, or you working with (writing in) the code directly?

------

you got to add~write in the 'msg' Scripts yourself, telling that an input is required and what type of input is being asked for, as the 'get input' is just that, a Script for the engine (telling it to get what is typed into the command box during game play), for example:

in code:

msg ("What is your name?")
get input {
player.alias = result
}


in GUI~Editor:

run as script -> add a~new script -> output -> 'print a message' Script -> [MESSAGE]:text or [EXPRESSION]:text+VARIABLES -> (your message~question)
add a~new script -> output -> 'get input' Script
-> add a~new script -> variables -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.alias = result

-------

to understand quest (XML), all you need is to understand are these things:

Object Oriented Programming:

the main unit in quest are the ELEMENTS ( http://docs.textadventures.co.uk/quest/elements/ ):

Objects (Room Objects, Player Objects, non-room non-player Other-Object Objects, and the special Game Object), Exits (Room Object connectors), Attributes (Strings, Scripts, Objects, Booleans ~ 'true or false' flags, Integers, Doubles ~ Floats ~ Floating Points ~ Decimal Numbers, Stringlists, Objectlists, Stringdictionaries, Objectdictionaries, Scriptdictionaries, Inherited, etc), Commands, Functions, Verbs, Object Types, Timers, Turnscripts, Templates, and etc

The ELEMENTS act as containers~baskets, being able to either hold Objects, Attributes, and~or Scripting. This is the concept of Object Oriented Programming (as best as I presume to understand it, lol).

Objects: able to hold other Objects and~or Attributes
Verbs, Commands, Functions, Timers, and Turnscripts: able to hold Scriptings
Object Types: able to hold Attributes, including Inherited Attributes (other Object Types)

Scripting:

Object_name.Attribute_name = Value_or_Expression
or
variable_string_label = Value_or_Expression

Tag Blocks:

<ELEMENT name="xxx">
// contents: Attributes, Objects, and~or Scriptings
</ELEMENT>


Attributes (setting, re-setting, and~or altering):

Object_name.Attribute_name = Value_or_Expression

'if' Scripting:

if (Object_name.Attribute_name OPERATOR Value_or_Expression) {
// scripting
} else if (Object_name.Attribute_name OPERATOR Value_or_Expression) {
// scripting
} else {
// scripting
}


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

just to highlight this link from my previous post, as it'll be a lot of help for you:

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

(and also the rest of the guides here too: http://docs.textadventures.co.uk/quest/guides/ )

as this 'character creation' covers the basics of quest, laughs.

The Pixie
pacattack25 wrote:This is a LOT of response - First: My bad that was the tutorial I was looking at - which really didn't help. I still can't find input VALIDATION (checking it) though...

Most of what the player types gets validated by Quest behind the scenes, and by the time it has passed control to your command, it has already found the items the player is referring to and determined they are in the vicinity at least. The get input command is for exceptional cases, say you are asking the player his name or for the password. There is no built-in validation for that, as it would be specific to your situation (but there are functions that will let you do it yourself).

HegemonKhan
just to add to Pixie explaining this better then me and Silver (as we're still noobs to programming~coding), if you want to see all of the underlying code that quest already has built into it (the engine does a lot of this programming stuff already for us, such as your 'validating inputs', which me and Silver weren't understanding as we're noobs to programming~coding), then in Quest's GUI~Editor mode, in the lower left corner of the screen is:

Filter -> Show Library Elements -> (toggle~check it in~on)

this will show all the built-in stuff as light grey text on the left pane's 'tree of stuff', (which you can alter ~ though obviously be careful or your game will be messed up, but not the quest program itself, due to the forced 'copy' button requirement safeguard that Alex has implemented in), and to then further look at the stuff, look under the 'Attributes' Tab on the right pane.

I think the 'HANDLECOMMAND' does a lot of the needed programming, but Pixie can help better with where to find the 'validating inputs' within the built-in code, as I've not yet tried to learn it.

Or, you can always just open up quest program folder's 'CORE' .aslx files too, don't mess up these, or you'll have to re-download and~or install quest again.

Silver
Not sure what you mean by validate, but you can do this:

if result = ("yes") {
// run script
}
else {
// run a different script
}


Unless I've coded that wrong - not sitting near any of my own code presently!

HegemonKhan
the 'validating' he's refering to is at a deeper ~ more base ~ foundational, level, is if there wasn't the quest software~engine doing this for us already.

I think it's like how we do (not the best example ~ but it's all I can think of at the moment):

MoveObject (player, room2)

quest is already programmed to take 'room2' and search for an Object called room2, as well as with the 'player' Object too. This is a level of real programming that we don't understand. He~she as a programmer is wondering how to script in what the engine already does for him~her. We, just take the quest engine's programming for granted, laughs. Thus we've no idea what this 'validating' of input is, that he~she is talking about, lol.

------

or...

maybe he~she was just needing help with how to set the input to a variable, not knowing that for 'get input', quest uses the built-in variable: 'result'

as, I've no idea what C++, JS, and etc real programming languages' format~syntax~structure looks like, nor how it works, compared to quest's XML

I think some languages (AS ~ Action Script like how flash player, .swf, uses) are something like this:

var result="yes"

-------

and you're just slightly off in your syntax:

if (result = "yes") {
-> // script
} else {
-> // script
}

but, I don't think this has to do with what he~she is asking about.

Silver
I see, and cheers! I can't even program basic stuff from memory yet lol.

HegemonKhan
the entire expression for the 'if' Script is, result = "yes", so this must be within the: if (________) { script }, as:

if (result = "yes") { script }

Silver
I sort of knew that with functions

name.capitalised = CapFirst (result)


But that knowledge didn't carry over to the If script for some reason.

HegemonKhan
just a typo by you, wink, you're only off by ~ 6 spaces with your left parenthesis, hehe. Yes, a simple typo mistake, and we all make typo mistakes.

if result = ("yes") { script }

Silver
Well it wasn't really a typo, it was a misunderstanding. But I guess talking about it on here helps correct and reinforce this stuff until it's muscle memory (I've seen that expression used before and quite like it).

The Pixie
Silver wrote:Not sure what you mean by validate, but you can do this:

if result = ("yes") {
// run script
}
else {
// run a different script
}


Unless I've coded that wrong - not sitting near any of my own code presently!

If you fill in a form on a web page that asks for your e-mail address, it might check that it has one and only one @ in it, before sending the form to the server. That is validation.

In Quest, if the player types READ BOOK, Quest will look for an appropriate object, book, and will only run the script on your READ command (or verb) if it is successful, so that is a type of validation too.

Silver
That's interesting. I did notice with Quest (if I'm remembering correctly) that you could type "read the book" and it would ignore 'the' and respond to 'read' and 'book' which is helpful regarding what people may input.

HegemonKhan
that has to do with Commands (their 'pattern' setting):

<command name="read_command">
<pattern>read the #object#</pattern>
<script>
if (object = null) {
foreach (object_x, AllObjects () ) {
if (object_x.alias = ToString (object) ) {
object = object_x
}
}
}
if (object = null) {
msg ("Sorry, the object doesn't seem to exist")
} else {
msg ("You read the book, " + object.name +".")
}
</script>
</command>


my syntax or scripting-structure is probably wrong, as I've only used #text#, never learned how you work with using #ojbect#, lol

The Pixie
#object# is how Quest does the validation, so most of what you have in your script is not needed. The value in object has already been identified as an object in scope. All you have to do is check the item can be read. Say you have an attribute on books called readtext, check that is present, and print it if it is.
<command name="read_command">
<pattern>read the #object#</pattern>
<script>
if (HasString(object, "readtext") {
msg ("You read the " + object.name +": " + object.readtext)
}
else {
msg("There is nothing worth reading on the " + object.name +".")
}
</script>
</command>

HegemonKhan
Ah, thanks Pixie, I was confused at what to do with using #object# within the scripting.

(you basically just check for an attribute, if that is what your command's purpose is, to involve an attribute in doing something, otherwise, I guess you'd just be doing a simple msg with the Object's name~alias, or whatever else you could do, that I'm not able to think of at the moment. But, all the stuff that is needed when using the #text# isn't needed with using #object#, as that was what was confusing me, if and what I need to do of that stuff with the #object# or not)

----------

what happens if you type in something that isn't an object though? does it just display the 'else msg', or does it generate an error msg, or just does nothing (no notification of it failing) ???

also, were you saying that the underlying code validation, will already check if what you typed in is the alias of the object, or does it not do this type of check, and you do need to write in that check yourself in the scripting ??? exactly how thorough and~or what exactly takes place with the underlying code's validation? what are all of the validation checks that the underlying code does?

jaynabonne
It says the same thing as it does in other cases (e.g. if you type "x foobie" when foobie isn't in the room), which is typically to print "I can't see that."

And it does all of those checks just as it does in other cases.

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

Support

Forums