I'm new and need help getting Quest to work.

I'm almost through the step by step start up tutorial, I left off on the "using containers" section. I'm trying to make the character creation section of my game, and it won't work. I have read the character creation document, even went as far as to copy and paste the code that they had (but it just says "internal error" when I try to input). When running a test and I type in a name for the player, the game shoots back "okay, player.alias" instead of " okay, peter nincompoop" (or whoever). Then when I try to make a menu pop up for male or female, it doesn't work at all. I understand it says I need a list for the options, but that I can make a quick list by: Split ("Male;Female", ";") I did that, and it doesn't recognize any part of the menu script. How do I make a split list script? what words will the program recognize and what ones will it not? why won't it recognize the name input? I am using the web browser, is that a problem?


You should be able to do all that on the web version, though it does have some limitations. What character creation document are you following? There are a few around.

When running a test and I type in a name for the player, the game shoots back "okay, player.alias" instead of " okay, peter nincompoop" (or whoever).

Put in some curly braces to let the Quest text processor know it should be doing something to the text:

"okay, {player.alias}"

You usage of Split looks fine; could you copy and paste the entire code into a post, so we can see it? I guess it is another part of the ShowMenu script.


@ Pixie:

he's/she's probably using your original character creation guide:

http://docs.textadventures.co.uk/quest/guides/character_creation.html


@ Grandclam:

The web version may NOT be able to do the popup window 'show menu' Function/feature. But, I think it can still do the in-line (hyperlink) menu Function:

the in-line (hyperlink) menu Function (should work with web version):

ShowMenu ("Sex?", split ("male;fmale", ";"), false) {
  player.sex_string_attribute = result
}

VS

the popup window menu Function (may/probably NOT able to work with web version):

show menu ("Sex?", split ("male;fmale", ";"), false) {
  player.sex_string_attribute = result
}

here's my own example full code and explanation of it (hopefully you can match it with the GUI/Editor's script options if the code confuses you):

msg ("What is your name?") // this is the 'print a message -> print [MESSAGE]' Script in the GUI/Editor
get input {
  // quest automatically (hidden from you) stores your typed-in input into the built-in 'result' (local/temporary) Variable VARIABLE:
  // result = YOUR_TYPED_IN_INPUT
  player.alias = result // we're now storing YOUR_TYPED_IN_INPUT into the built-in 'alias' (global/temporary) Attribute VARIABLE, which can now be used (player.alias) repeatedly/anywhere in your game
  ShowMenu ("Sex?", split ("male;female", ";"), false) { // ShowMenu ("PROMPT", LIST_VARIABLE, BOOLEAN_VALUE: able to cancel out of menu:true, or not able to cancel out of menu: false) {
    // quest automatically (hidden from you) stores your selected input into the built-in 'result' (local/temporary) Variable:
    // result = YOUR_SELECTED_INPUT
    player.sex_string_attribute = result // we're now storing YOUR_SELECTED_INPUT into a custom (you can name it whatever you want, this is just my naming/labeling system/convention as I like underscores and describing what it is) 'sex_string_attribute' (global/temporary) Attribute VARIABLE, which can now be used (player.alias) repeatedly/anywhere in your game
    msg ("(testing msg 1) The Player's Alias is: " + player.alias)
    msg ("(testing msg 2) The Player's Sex_String_attribute is: " + player.sex_string_attribute)
  }
}

or, you can do it like this too:

msg ("What is your name?") // this is the 'print a message -> print [MESSAGE]' Script in the GUI/Editor
get input {
  // quest automatically (hidden from you) stores your typed-in input into the built-in 'result' (local/temporary) Variable VARIABLE:
  // result = YOUR_TYPED_IN_INPUT
  player.alias = result // we're now storing YOUR_TYPED_IN_INPUT into the built-in 'alias' (global/temporary) Attribute VARIABLE, which can now be used (player.alias) repeatedly/anywhere in your game
  game.sex_stringlist_attribute = split ("male;female", ";") // the 'split' creates (and returns) a 'male/female' String List, which is then stored into (in this case) the custom 'game.sex_stringlist_attribute' Attribute VARIABLE
  ShowMenu ("Sex?", game.sex_stringlist_attribute, false) { // ShowMenu ("PROMPT", LIST_VARIABLE, BOOLEAN_VALUE: able to cancel out of menu:true, or not able to cancel out of menu: false) {
    // quest automatically (hidden from you) stores your selected input into the built-in 'result' (local/temporary) Variable:
    // result = YOUR_SELECTED_INPUT
    player.sex_string_attribute = result // we're now storing YOUR_SELECTED_INPUT into a custom (you can name it whatever you want, this is just my naming/labeling system/convention as I like underscores and describing what it is) 'sex_string_attribute' (global/temporary) Attribute VARIABLE, which can now be used (player.alias) repeatedly/anywhere in your game
    msg ("(testing msg 1) The Player's Alias is: " + player.alias)
    msg ("(testing msg 2) The Player's Sex_String_attribute is: " + player.sex_string_attribute)
  }
}

you can also take a look here, when I was learning this exact same stuff, 5 years ago, hehe:

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22036 (specific starting post on the character creation topic)

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread (the thread/first page)


P.S.

here's a guide on using Attributes and the 'if' Script:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

and for learning the basics of Attribute usage: here's a step by step walkthrough demo game you can create (except it requires that you use the desktop/offline/download version of quest):

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help


player.alias = result
msg ("Okay then. What gender is {player.alias} ?")
ShowMenu ("Is {player.alias} male or female?", split ("Male;Female".";"), false) {
}

That is the code thus far. I've downloaded the desktop version because it seems easier to use. the squiggles make the name work great, but it still doesn't like the menu. I forget how to screencap, but the error message now gives me:

Error running script: Error compiling expression 'split ("Male;Female".";")': SyntaxError: Unexpected token "";"" <STRING_LITERAL>; expected one of


apparently that didn't copy n paste


oic, its copy and pasting but the computer is reading it as code and disamappearing it.


You have this:

split ("Male;Female".";")

It should be this (capital at start, comma not full stop):

Split ("Male;Female",";")

i had typed it correctly before but I got it to work just a bit ago in the desktop version. i had the dropdown menu in desktop and hit function then selected Split and then typed in the rest.
Thanks so much for all the help getting started, now comes the horrible trial and error part where I try to figure out the other functions as I go. Quick question, does the "If" command have a function such as "If {player.gender} = Male, then/else" ?
(sorry, hedgemonk I know u gave me a pdf on IF, but it was super long and super confusing to me at this point.)
I'm making a simple sci-fi rpg influenced heavily by Phantasy Star and trying to stay away from modern scifi cliches, player attributes will only come into play every once in a while: a rock only robots can move, a racist human settlement, etc.


Short answer: yes...
Slightly longer answer: "you are standing on it..."
if (player.gender="Male") {
msg("You are male.")
}
else {
msg ("You are female.")
}
But, looking at your code again, that looks like the "if" in the room description...
I think that one has no else option.


Altho...
there is the "either" command that looks like an if/else...
"'Oh, {either player.male**flag:he|she} is not worth it.'"
-> "'Oh, he is not worth it.'",
(I assume the player is male in this case...)


@ grandclam:

for posting here (either code or really long text walls, lol), you can preserve formating by using this posting code tag:

m```
(your content)
m```

(those weird characters/symbols is the keyboard key in the upper-left corner of your keyboard: to the left of the '1' key and above the 'tab' key)

but without the m's in front, which will produce/look-like this:

(your content)

the syntax for 'split' is this:

split ("NAME_OF_ITEM_1 SEPARATOR NAME_OF_ITEM_2 SEPARATOR NAME_OF_ITEM_3 SEPARATOR MORE_OR_LESS_ITEMS" COMMA "SEPARTOR")

and you got to have a comma between your list of items and your separator character/symbol

the common convention for the 'SEPARATOR' is a semicolon:

split ("item1; item2; item3", ";")

but, I think you can use anything (with possible exceptions), for example:

split ("item1Mitem2Mitem3", "M")

split ("item1+item2+item3", "+")

basically, what the 'split' Function is, is it's breaking apart ('separating') a string (a collection of characters/symbols):

string (english alphabet): abcdefghijklmnopqrstuvwxyz (one item)

'split' Function conceptually is doing this: abc-def-ghi-jkl-mno-pqr-stu-vwx-yz: abc (item 1), def (item2), ghi (item3), jkl (item4), mno (item5), pqr (item6), stu (item7), vwx (item8), yz (item9)

in actual code (using the semicolon as separator convention):

split ("abc; def; ghi; jkl; mno; pqr; stu; vwx; yz", ";")

or, we can do it this way too (using the desktop version) to create a list of items (though we're NOT actually breaking apart a string: one item into many items):

game.example_stringlist_attribute = NewStringList ()
list add (game.example_stringlist_attribute, "abc")
list add (game.example_stringlist_attribute, "def")
list add (game.example_stringlist_attribute, "ghi")
list add (game.example_stringlist_attribute, "jkl")
list add (game.example_stringlist_attribute, "mno")
list add (game.example_stringlist_attribute, "pqr")
list add (game.example_stringlist_attribute, "stu")
list add (game.example_stringlist_attribute, "vwx")
list add (game.example_stringlist_attribute, "yz")

and we can combine the broken apart items back into one item too:

http://docs.textadventures.co.uk/quest/functions/string/join.html
http://docs.textadventures.co.uk/quest/guides/using_lists.html

join (game.example_stringlist_attribute, ";") // it'll return: abcdefghijklmnopqrstuvwxyz

don't worry if my links/guides were coonfusing... they're indeed long and code-heavy (though I do also match them up with their GUI/Editor script options, I think), as I'm not the best at explaining this stuff, despite making them to help people new to coding / game-making, sighs. Pixie and others however, are excellent at explaining/helping with stuff.

maybe after you start learning quest and coding better, they'll make more sense... if you want to then try looking at them again..


about 'if' Script (and scripting in general)

first, in general, there's:

'normal' scripting and 'text processor commands' scripting (http://docs.textadventures.co.uk/quest/text_processor.html)

the 'normal' scripting is more difficult (as it uses concatenation, which is difficult if you don't know the 'trick' to it) but has full functionality, for example:

player.alias = "HK"
msg ("The player's name is " + player.alias + ".")
// output: The player's name is HK.

the 'text processor commands' scripting is much easier/quicker-shorter, but has some less functionality, for an example:

player.alias = "HK"
msg ("The player's name is {player.alias}.")
// output: The player's name is HK.

so, if you can, use the text processor commands, but if not there's always the fall back of/onto the 'normal' scripting


as for 'if'...

if you mean the text process command usage of 'if'

{if NAME_OF_OBJECT.NAME_OF_ATTRIBUTE OPERATOR VALUE_OR_EXPRESSION: OUTPUT_TEXT}

for example (a very poor/lame/bad/non-practical example, but it's an example so who cares lol):

(I'm not sure on the syntax in whether we use the: ="xxx" or not, if there's an error than take out the double quotes from the: ="xxx")

player.alias = "HK"
player.sex = "male"
player.hair_color = "brown"
msg ("{player.alias} is a {player.sex} with {if player.hair_color="brown":brown hair}{if player.hair_color="black":brown hair}{if player.hair_color="yellow":yellow hair}.")
// output: HK is a male with brown hair.

player.alias = "HK"
player.sex = "male"
player.hair_color = "black"
msg ("{player.alias} is a {player.sex} with {if player.hair_color="brown":brown hair}{if player.hair_color="black":brown hair}{if player.hair_color="yellow":yellow hair}.")
// output: HK is a male with black hair.

player.alias = "HK"
player.sex = "male"
player.hair_color = "yellow"
msg ("{player.alias} is a {player.sex} with {if player.hair_color="brown":brown hair}{if player.hair_color="black":black hair}{if player.hair_color="yellow":yellow hair}.")
// output: HK is a male with yellow hair.

you can do nesting too (and the use of 'not' as well)... so it has much (but not all) of the same functionality as normal scripting, but the nesting can get confusing...)


whereas, here's some examples of normal scripting of the 'if' Script (direct code syntax, as it differs a bit from the GUI/Editor's scripting syntax):

there's 4 different patterns of 'if' blocks:

// the 'if' if block:

if (player.current_life_integer_attribute < 0) {
  player.condition_string_attribute = "dead"
}

the 'if/else' if block:

if (player.current_life_integer_attribute < 0) {
  player.condition_string_attribute = "dead"
} else {
  msg ("Player's Life: " + player.current_life_integer_attribute + "/" player.maximum_life_integer_attribute)
}

the 'if/else if' block:

if (player.current_life_integer_attribute < 0) {
  player.condition_string_attribute = "dead"
} else if (player.current_life_integer_attribute > player.maximum_life_integer_attribute) {
  player.current_life_integer_attribute = player.maximm_life_integer_attribute
}
// if you want/need: as many more 'else ifs' as you want

the 'if/else if/ else' if block:

if (player.current_life_integer_attribute < 0) {
  player.condition_string_attribute = "dead"
} else if (player.current_life_integer_attribute > player.maximum_life_integer_attribute) {
  player.current_life_integer_attribute = player.maximm_life_integer_attribute
}
// if you want/need: as many more 'else ifs' as you want
else {
  msg ("Player's Life: " + player.current_life_integer_attribute + "/" player.maximum_life_integer_attribute)
}

@ DarkLizard:

the text processor commands are a bit more limited than normal scripting, but not by too much as you can do nesting (though, this can get complicated...), and there is also the use 'not' as well.

for examples:


'else' via text processor commands (you got to be bit more creative, due to their more limited functionality):

(I'm not sure if you put in the double quotes or not, so if get errors than take off the double quotes on the: ="xxx", or, :"xxx")

msg ("{if player.sex_string_attribute="male":"You are a male"}{if player.sex_string_attribute="female":"You are a female"}")
or
msg ("{if player.sex_string_attribute="male":"You are a male"}{if not player.sex_string_attribute="male":"You are a female"}")

nesting with text processor commands (it gets complicated... normal scripting is much less complicated):

msg ("{if player.species_string_attribute="human":{if player.race_string_attribute="european":"You are a european human"}{if player.race_string_attribute="asian":"You are a/an asian human"}}{if player.species_string_attribute="elf":{if player.race_string_attribute="ljosalfar":"You are a ljosalfar (light) elf"}{if player.race_string_attribute="dokkalfar":"You are a dokkalfar (dark) elf"}}")

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

Support

Forums