Help with start script. Im new at all of it.

Hi, I'm new to Quest and I'm a complete newbie when it comes to coding but I am trying to make my own start script. I followed the tutorial at the beginning for newbies so I won't be completely lost but I guess I still am. It didn't look too hard but I ran into a problem, and I don't quite understand why.

So, I'm trying to do a simple character creation thing before the game starts, where it asks the player some questions about their looks. So far I have:

"What is you name?"
"How tall are you?"

and using the "get input" option in the scripts, it works fine. but when I try to do a multiple question thing like:

"What is your skin tone?" with answers like:
"peach, red, green, blue, yellow"

with the "show menu with caption" script, my game starts before I select my answer and finish the character creation.
The multiple questions are still there, and if I ignore the game and finish answering, the next set of questions come up.

I just want to finish the character creation before the game starts. What am I missing or need to fix in my script? It looks like this so far:

msg ("Welcome. You are slowly finishing up your move in the suburban area. You only have a few boxes left. Let's get a good idea what you look like.")
msg ("What is your name?")
get input {
player.alias = result
msg ("" + player.alias + ", alright. ")
msg ("How tall are you? In ft.")
get input {
player.height = result
msg ("ok")
ShowMenu ("What is your skin tone?", Split ("peach; red; green; blue; yellow", ";"), false) {
player.skin = result
msg (player.skin + ", oki doki")
ShowMenu ("What colour is your hair?", Split ("blonde; black; gray; brown", ";"), false) {
player.hair = result
msg ("You have " + player.hair + " hair.")
}
}
}
}


There is a guide here that may be some help:
http://docs.textadventures.co.uk/quest/character_creation.html


One of the problems I see with Quest, is that the program does not stop for a get input...
They have to be nested to work.


your scripting is perfect, which is a great start! You likely just got screwed up with clicking on the correct 'add new script' circle buttons using the GUI/Editor, changing the scripting's 'order of operations', causing it to not work as you desired


the 'order of operations' for scripting/scripts can be a bit weird, sometimes it cuts-or-ends-out of the scripting strangely (not sure exactly why or what causes it), and then pops back into your remaining scripting after you do something within the game


in general, scripting works the same as an outline:

simple nested contigious (consecutive) scripting is the best, it is a straight ordering:

I. XXX
  A. XXX
    1. XXX
       a. XXX

[I -> A -> 1 -> a]

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

but, it gets weird/complicated with any other type of patterns, for example:

I. XXX
  A. XXX
II. XXX

as in this case, the 'A' and the 'II' is happening at the same time, which goes first?

[I -> A] and [I -> II]

so, if possible, try to have your scripting as simple contigious (consecutive) nested scripting (to avoid problems/issues/"hair-pulling"), for example, with your script, have it like this:

(using spacing to make it easier to read, which quest can handle, so it's good to get into practice of doing it, though it does make your code much longer with all of the spacing, but who cares about that, lol)


IMPORTANT:

Also, using the GUI/Editor, it's not easy (and is confusing) with clicking on the correct 'add new script' circle button, to get the correct indenting/nesting required/needed, got to really be careful and make sure you got it right

it might be easier/better to learn to do the coding directly, as the GUI/Editor's 'add new script' circle buttons can be pretty confusing on their nested indenting level/layer and/or in not being nested/indented layers/levels

also, it's easy to mess up and lose entire chunks of scripting when using the GUI/Editor... which is not fun.... lol

using the GUI/Editor's scripting is a bit clunky because of these issues with it


msg ("Welcome. You are slowly finishing up your move in the suburban area. You only have a few boxes left. Let's get a good idea what you look like.")

msg ("What is your name?")

get input {

  player.alias = result

  msg (player.alias + ", alright.")

  msg ("How tall are you? In ft.")

  get input {

    player.height = result

    msg ("ok")

    ShowMenu ("What is your skin tone?", Split ("peach; red; green; blue; yellow", ";"), false) {

      player.skin = result

      msg (player.skin + ", oki doki")

      ShowMenu ("What colour is your hair?", Split ("blonde; black; gray; brown", ";"), false) {

        player.hair = result

        msg ("You have " + player.hair + " hair.")

      } // ending tag of inner 'ShowMenu'

    } // ending tag of outer 'ShowMenu'

  } // ending tag of inner 'get input'

} // ending tag of outer 'get input'

whereas, here's an example of messing up the nested scripting (clicking on the wrong 'add new script' circle buttons in the GUI/Editor):

msg ("Welcome. You are slowly finishing up your move in the suburban area. You only have a few boxes left. Let's get a good idea what you look like.")

msg ("What is your name?")

get input {

  player.alias = result

  msg (player.alias + ", alright.")

  msg ("How tall are you? In ft.")

} // ending tag of first 'get input'

get input {

  player.height = result

  msg ("ok")

  ShowMenu ("What is your skin tone?", Split ("peach; red; green; blue; yellow", ";"), false) {

    player.skin = result

    msg (player.skin + ", oki doki")

  } // ending tag of first 'Show Menu'

  ShowMenu ("What colour is your hair?", Split ("blonde; black; gray; brown", ";"), false) {

    player.hair = result

    msg ("You have " + player.hair + " hair.")

  } // ending tag of second 'ShowMenu'

} // ending tag of second 'get input'

Ok, Thank you all for your replies.

I was following
http://docs.textadventures.co.uk/quest/character_creation.html
as a guide. but i didn't realize the my "nested script" might have been out of order.
@hegemonkhan: oh my god. that helps a lot. Especially because I don't know what little things I might be doing wrong and having some clear directions with which questions I need to ask myself helps. Also didnt realize what "nest script" meant until I read this.

So, yea, I'll try fixing this if it doesn't work, I'll try putting my character in a blank room like the tutorial suggested.
Thanks again.


'parent-child' ("nesting" / containment) hierarchy:

(exactly the same as how 'folders' on your computer works, the same is true for 'Objects' within Quest)

grandfather
-> father
->-> son
->->-> grandson

grandfather is the 'root' parent

grandfather is the direct parent of father
grandfather is the indirect parent of son and grandson

father is the direct child of grandfather
father is the direct parent of son
father is the indirect parent of grandson

son is the indirect child of grandfather
son is the direct child of father
son is the direct parent of grandson

grandson is the indirect child of grandfather and father
grandson is the direct child of son

indirect: nesting within nesting / deeper nesting / (multiple, 2 or more, layers/levels of nesting)


it's the same for Objects as well, Objects can be "nested" (contained within) in other Objects:

HK
-> pants
->-> wallet
->->-> coin

<object name="HK">

  <object name="pants">

    <object name="wallet">

      <object name="coin">

      </object>

    </object>

  </object>

</object>

let's take a look at the default new game code for quest:

(I'm using an older version of quest, but hopefully its still the same default new game code, aside my older '550' version in the top/beginning 'asl' tag line (the beginning tag line is also known as a 'header' or 'signature' as it often has some special parameters in it, such as the 'version', in the 'asl' beginning/header/signature tag line)

<asl version="550">

  <include ref="English.aslx" />
  <include ref= "Core.aslx" />

  <game name="NAME_OF_GAME">

    <attr name="author" type="string">NAME_OF_AUTHOR</attr>
    <attr name="version" type="string">1.0</attr>
    <attr name="firstpublished" type="string">2019</attr>

  </game>

  <object name="room">

    <inherit name="editor_room" />

    <object name="player">

      <inherit name="editor_object" />
      <inherit name="editor_player" />

    </object>

  </object>

</asl>

do you see that the 'asl' tag block is the 'root' parent?

the 'asl' tag block IS THE GAME OBJECT ITSELF (it is your game): everything (all code / all game content) must be "nested" (contained within) the 'asl' tag block

which, indeed everything is "nested" (contained within) the 'asl' tag block

can you spot other further nested layers/levels?

the 'author', 'version', and 'firstpublished' String Attributes are "nested" (contained within) the special and required 'game' Object (as can be seen, this holds the publishing info, and not seen here, it also holds game-wide/global options/controls, the 'pov' feature, the special 'start' Script, and etc such stuff)

the 'player' Player Object is "nested" (contained within) the 'room' Room Object

the 'editor_room' Inherited Attribute is also "nested" (contained within) the 'room' Room Object

the 'editor_object' and 'editor_player' are "nested" (contained within) the 'player' Player Object

the 'English.aslx' Include tag line, 'Core.aslx' Include tag line, the 'game' Object tag block, and the 'room' Room Object tag block are all direct children (directly "nested" / directly contained wtihin) of the 'asl' tag block

the 'asl' tag block
-> the 'English.aslx' include ref tag line
-> the 'Core.aslx' include ref tag line
-> the special and required 'game' Object tag block
->-> the 'author' String Attribute tag line
->-> the 'version' String Attribute tag line
->-> the 'firstpublished' String Attribute tag line
-> the 'room' Room Object tag block
->-> the 'editor_room' Inherited Attribute tag line
->-> the 'player' Player Object tag block
->->-> the 'editor_object' Inherited Attribute tag line
->->-> the 'editor_player' Inherited Attribute tag line

or, as an outline:

I. the 'asl' tag block
  A. the 'English.aslx' include ref tag line
  B. the 'Core.aslx' include ref tag line
  C. the special and required 'game' Object tag block
    1. the 'author' String Attribute tag line
    2. the 'version' String Attribute tag line
    3. the 'firstpublished' String Attribute tag line
  D. the 'room' Room Object tag block
    1. the 'editor_room' Inherited Attribute tag line
    2. the 'player' Player Object tag block
      a. the 'editor_object' Inherited Attribute tag line
      b. the 'editor_player' Inherited Attribute tag line

now, this containment hierarchy, is actually controlled by the 'parent' Object reference/pointer Attribute

for example, these are the exact same thing:

<object name="room">

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

</object>

the 'room' Room Object
-> the 'player' Player Object

and

<object name="room">
</object>

<object name="player">

  <attr name="parent" type="object">room</attr>

</object>

the 'room' Room Object
-> the 'player' Player Object


so, let's have some fun, using scripting (in/as direct code, as it's quick to type/write for me, lol):

creating the 4 Objects: grandfather, father, son, and grandson

create ("grandfather")
create ("father")
create ("son")
create ("grandson")

setting/arranging their containment hierarchy:

grandfather.parent = null
father.parent = grandfather
son.parent = father
grandson.parent = son

hierarchy:

grandfather
-> father
->-> son
->->-> grandson


but, now let's screw up (re-setting/re-arranging) the hierarchy:

grandson.parent = null
son.parent = grandson
father.parent = son
grandfather.parent = father

can you guess now what the hierarchy looks like?

answer (new hierarchy):

grandson
-> son
->-> father
->->-> grandfather


let's do some more playing:

grandfather.parent = null
father.parent = null
son.parent = null
grandson.parent = null

hierarchy:

grandfather
father
son
grandson


some more playing (examples):

grandfather.parent = null
father.parent = grandfather
son.parent = grandfather
grandson.parent = son

hierarchy:

grandfather
-> father
-> son
->-> grandson


and one last example:

grandfather.parent = null
father.parent = grandfather
son.parent = grandfather
grandson.parent = father

hierarchy:

grandfather
-> father
->-> grandson
-> son


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

Support

Forums