Newbie Questions

Blackstar
Hi everyone,

I just downloaded Quest 5 and started to work with it. So far it's been a very pleasant thing and I can surely tell that I took a liking to it. But as of right now I have encountered some issues which the search option didn't provide me with. (If I have been just unaware of them I apologize in advance.)

1.) Save the game. I'm planning on working something bigger and since I can't really tell how long it's going to be I'm asking myself if there is an actual save-function to let the player save his progress.

2.) Starting screen. While I am not planning on creating a picture I rather want to display some text first, let the player decide to have some features (such as skills for example) and then get going with the whole thing. How do I manage to do that? I've tried to use scripts but they never seemed to work. I chose a "before entering room" and then print message in order to let some Text pop up first. My plan is to actually create some sort of starting dialogue which lets the player chose what kind of character he/she wants to play.

3.) Text before objects. As of right now the game shows interactive objects first and displays the description of the room afterwards. Is there a way to reverse that? I think it's quite confusing to have interactive objects displayed first.

Thanks in advance (and sorry if these have been asked before).

HegemonKhan
I think you're probably using the web~online version, and~or the GameBook version.

so, it's a bit different from what I know, the desktop~ofline version and the text adventure version.

I don't know anything about the web~online version

------

the Gamebook version, I believe you got a "start" script in your "game" Object (not sure what tab the "start" script is under, if there's even tabs for the "game" object), which allows those scripts in it, to be run at the start of the game. for example, a "character creation" script block is often put into the "start" script within your "game" object.

in the desktop~offline version and text adventure version, it looks like this (it's 'path' is this):

"game" Object -> Scripts (Tab) -> "Start" Script -> Add Scripts -> (add them; set them up)

---------

for changing the order of room displayment:

in the desktop~offline version and text adventure version, it looks like this (it's 'path' is this):

"game" Object -> Room Descriptions (Tab) -> change the settings (the check boxes) of the ordering of them

---------

if you haven't already, I highly suggest that you go through the tutorial, trying to do it all:

http://quest5.net/wiki/Tutorial

it is really helpful!

Blackstar
Thanks so far but no, I'm using the offline version.
I've worked through a decent part of the tutorial, I'll do the rest and take a look if I can get more ideas out of it.

jaynabonne
My take on your questions:

1) People can save their progress, both in the offline and online versions (the latter if they're logged). There is either a UI element (e.g. a Save button) or the player can type "save" as a command. You can also kick off the Save process yourself (request (RequestSave, "")), but that's rarely needed.

2) The technique I have used for a start/title screen is to have a dedicated room (or a sequence of rooms) that is separate from the starting room of the actual game. You can start the player off there and have scripts to do what you want without having to worry about the normal room behavior kicking in. Then, when you're done getting the initial player info, you can just move the player to the game's first real room to begin play.

3) As HK said, you can change the order of the automatically generated items in the "Room description layout" section of the Room Descriptions tab of the "game" object.

HegemonKhan
blackstar wrote:... I rather want to display some text first, let the player decide to have some features (such as skills for example) and then get going with the whole thing. How do I manage to do that? I've tried to use scripts but they never seemed to work. I chose a "before entering room" and then print message in order to let some Text pop up first. My plan is to actually create some sort of starting dialogue which lets the player chose what kind of character he/she wants to play.


this stuff is a bit more complicated~advanced, for a new person, but we'll help you get it down, hehe:

take a look into "character creation", "get input", "show menu", also learn how to add attributes to objects, and also how to use them in scripts too:

this thread has much of this already posted there:

viewtopic.php?f=10&t=4222

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

messages are a bit difficult and~or confusing too:

run as script -> add a script -> output -> print a message -> [MESSAGE] or [EXPRESSION] -> (set it up)

if you purely just want to type in text, then choose: [MESSAGE], for example: Hi, my name is HK.

but if you want to apply attributes to the message, then you got to do this (in code):

choose: [EXPRESSION] ~ see below
run as script -> add a script -> output -> print a message -> [EXPRESSION] -> (set it up, see below)

for example:

"Hi, my name is " + game.pov.alias + "."

for example:
game.pov.alias = HK
outputs: Hi, my name is HK.

for example:
game.pov.alias = blackstar
outputs: Hi, my name is blackstar.

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

hope this helps, if not, let us know, and we'll help you.

Blackstar
Alright, I'm slowly getting behind this.
So first of all comes a bit text. (Print message - could be shorter so you don't have to scroll down, but it's okay for a start!)
-Wait for key input
-clear screen
-Menu option

Then you have to chose. This would most likely require two variables but I've read that variables are bound to the script they're running within. Is this true? I'd need global variables which are kept throughout the game.

Edit: Woops. Thanks for the effort!

Edit 2: I'm dumb. I try it using attributes.

Edit 3: Okay, I'm slowly starting to resolve my issue.

I've worked a bit with the actual http://quest5.net/wiki/Character_Creation site and it surely helped me to understand. I'm still getting a few weird things here but I managed to make the menu work as I wanted it to happen. I think this just might be a bit much for a start as you already pointed out, so I think I may be approaching in a more easy way and avoid a lot of the scripting since I still haven't figured out much of it yet.

HegemonKhan
if you're having trouble getting the "print message [EXPRESSION]" to work, don't worry, as its syntax is very difficult to get it correct.

the "rules" (the trick) for getting it to work (writing in a correct syntax), is to break it down into "chunks":

" text "
+ Object.Attribute +

for example (this is how you'd write it in) for the GUI~Editor (what you're using I presume, with the windows, buttons, and etc):

(the below should be on a single long line)

game.pov.alias + " is a " + game.pov.age_integer + " year old " + game.pov.gender_string + " " + game.pov.age_string + " " + game.pov.species_string + " " + game.pov.race_string + " " + game.pov.class_string + "."

but, in code form, it writes like this:

msg (game.pov.alias + " is a " + game.pov.age_integer + " year old " + game.pov.gender_string + " " + game.pov.age_string + " " + game.pov.species_string + " " + game.pov.race_string + " " + game.pov.class_string + ".")

example output of it:

HK is a 18 year old male adult human european warrior.
(I wish I was still 18, lol)

the "chunks" of it:

game.pov.alias +
" is a "
+ game.pov.age_integer +
" year old "
+ game.pov.gender_string +
" (space) "
+ game.pov.age_string +
" (space) "
+ game.pov.species_string +
" (space) "
+ game.pov.race_string +
" (space) "
+ game.pov.class_string +
"."

-----------

if your "character creation" script block doesn't work properly~fully:

the most likely cause is that you don't have it properly "nested" (indented):

in the GUI~Editor, you need to make sure you click on the correct circle "add a script" buttons, or you won't have it properly "nested" (indented) correctly.

to explain "nesting~indenting" and "parent~child", let's look at some simple and familiar things:

(my left-most sided arrows, -> , symbolize your indenting)

c:\\
-> programs
->-> quest
->->-> game file 1
->->-> game file 2

HK
-> HK's pants with pockets
->-> wallet
->->-> $ 1.00
->->-> $ 5.00

an outline:
I. blah
-> A. blah
->-> 1. blah
->->-> a. blah
->-> 2. blah
-> B. blah
II. blah
-> A. blah
->-> 1. blah
->->-> a. blah
->-> 2. blah
-> B. blah

Quest Scripting:

<function name="character_creation_function">
-> msg ("What is your name?")
-> get input {
->-> player.alias = result
->-> msg ("What is your age?")
->-> get input {
->->-> player.age = result
->->-> gender_string_list = split ("male;female", ";")
->->-> show menu ("What is your gender?", gender_string_list, false) {
->->->-> player.gender_string = result
->->->-> show menu ("What is your race?", global_data_object.race_string_list, false) {
->->->->-> player.race_1_string_list = result
->->->->-> show menu ("What is your race?", split ("human;dwarf;elf;gnome;halfling", ";"), false) {
->->->->->-> player.race_2_string_list = result
->->->->-> }
->->->-> }
->->-> }
->-> }
-> }
</function>

<function name="party_member_character_creation">
-> msg ("What is party member's name?")
-> get input {
->-> player_2.alias = result
->-> msg ("What is party member's age?")
->-> get input {
->->-> player_2.age = result
->->-> show menu ("What is party member's gender?", gender_string_list, false) { // see the line below
->->->-> player_2.gender_string = result // ERROR, because "gender_string_list" is a local variable for the "character_creation_function" Function only, it can't be used here (unless, it is set up, aka defined, here, too)
->->-> show menu ("What is your race?", global_data_object.race_string_list, false) {
->->->-> player_2.race_1_string_list = result
->->->->-> show menu ("What is your race?", split ("human;dwarf;elf;gnome;halfling", ";"), false) {
->->->->->-> player_2.race_2_string_list = result
->->->->-> }
->->->-> }
->->-> }
->-> }
-> }
</function>

<object name="global_data_object">
-> <inherit name="editor_object" />
-> <attr name="race_string_list" type="simplestringlist">human;dwarf;elf;gnome;halfling</attr>
</object>

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

ERROR from improper "nesting":

(numbers show the "nesting" order of what is run~executed)

runs this:
1a. show menu ("What is your gender?", split ("male;female",";"), false) {
-> 2a. game.pov.gender_string = result
}
runs this too (aka: at the same time as the above "show menu" script):
1b. show menu ("What is your race?", split ("human;dwarf",";"), false) {
-> 2b. game.pov.race_string = result
}
// ERROR !!!!

quest can't display, nor run, two popup show menus at the exact same time... which is what happens above, due to not "nesting" it in the correct order, which is:

//runs this first:
1. show menu ("What is your gender?", split ("male;female",";"), false) {
-> 2a. game.pov.gender_string = result
-> // then, it runs this:
-> 2b. show menu ("What is your race?", split ("human;dwarf",";"), false) {
->-> 3. game.pov.race_string = result
-> }
}
// NO error

~OR, there's this script command ("on ready") too~

"on ready" stops the held script of it ( aka: on ready {the held script of "on ready"} ) from running, until the above~prior script is finished running

show menu ("What is your gender?", split ("male;female",";"), false) {
-> game.pov.gender_string = result
}
on ready {
-> show menu ("What is your race?", split ("human;dwarf",";"), false) {
->-> game.pov.race_string = result
-> }
}
// NO error

Blackstar
Alright, I slimmed my first stuff down and made it work properly on a choiceless basis so I have that working without any flaws.

I'm currently confused by one thing: Usually you define a global variable (and I call this strictly variable based on my little knowledge in terms of programming) somewhere. My current guess would be the library but I think there might be a way to do that in a seperate way. I understand that the expression is the result of questioning the system down to the chunks of the given variables. As far as I've read, the term "variable" in Quest means just locally accepted and used variables, whereas "attributes" are globally active variables.

My idea was that I define certain variables (for example the Gender or the Class of the player) at the beginning of the game in a centralized spot so I can easily check on my list of globally active variables. These would then be used to determine the path the player can take (e.g. a policeman has different choices in some situation whereas a lawyer might not have). I'm just not sure on how or where to do such a thing if it's possible at all.

jaynabonne
The only global "things" in Quest are objects - the game object, the player object, rooms, exits, etc. You can also define arbitrary objects of your own. (They don't have to correspond to directly manipulable items in a room like books, keys etc. They can just be abstract holders for attributes.) Objects are the things you can hang attributes off of. As you have discovered, variables in scripts that are not attached to objects are local and disappear once the script or function exits.

The player object seems a natural place to hang attributes like gender, class, etc. that are specific to the player.

HegemonKhan
1. you're correct about the terminology of quest's 'variable' and 'attribute', though do note that to be global, it must be attached to an object (Object.global_variable_aka_quest's_attribute), but otherwise quest's 'variable' and 'attribute' is the same thing: it's merely a string value that equals an Attribute Type's Value. Sorry, I couldn't word this very clearly, lol. keep reading below, to hopefully have a more clear reading~understanding of it, lol.

(Variable) = (Value_or_Expression)
(String) = (Value_or_Expression)
example: strength = 100

(Attribute) = (Value_or_Expression)
(Object.String) = (depends on the type of attribute that it is: string, integer~int, boolean, list, dictionary, double, etc)
example: player.strength = 100

------

Quest's terminology is a bit different from the generic programming terminology:

(quest's "double" is the same as a "float~floating point", ie a decimal number amount)
(quest's "dictionaries", and maybe "lists" too ~ not sure, is the same as "arrays", I think anyways ~ arrays confused me, lol)

In quest, the generic programming terminology of "Variable" is split into two sub-categories:

"Variable" and "Attribute"

A "Variable" is local, as it is *NOT* attached to something permanent (an Object, well so long as the Object still exists, anyways, of course, lol)

Variable = Value_or_Expression
ie: handled = false
ie: you_go_first = true
ie: strength = 100
ie: primary_pigment_color_string_list = split ("red;blue;yellow",";")
ie: x = 5
ie: x = 4 * (5 + y)

An "Attribute" is global, as it *IS* 'attached' (has the dot~period between the "Object" and the "Attribute") to something permanent (an Object, well... so long as the Object still exists, anyways, of course, lol)

Object.Attribute_or_Variable_whatever_you_want_to_call_this_String_Value_lol = Value_or_Expression
ie: room.radiation = 30
ie: table.material = "wood"
ie: game.x = 5
ie: game.turns = 0
ie: player.turns = 0
ie: player.strength = 20
ie: HK.strength = 100
ie: HK.favorite_color = black
ie: HK.favorite_color_string_list = split ("black;red",";")
ie: HK.dead = false
ie: orc.fight => { see scripting below, shown in the Tag for the "orc" Object }

<object name="orc">
-> inherit name="editor_object" />
-> <attr name="fight" type="script">
->-> if (orc.dead = true) {
->->-> msg ("It is already dead, silly.")
->-> } else if (orc.dead = false) {
->->-> orc.hp = HK.damage - orc.hp
->->-> msg ("HK attacks the orc for " + HK.damage + " damage, leaving the orc with only " + orc.hp + " hp left.")
->->-> if (orc.hp <= 0) {
->->->-> orc.dead = true
->->->-> msg ("You killed the orc.")
->->-> }
->-> }
-> </attr>
-> <attr name="displayverbs" type="listextend">Fight</attr>
</object>

-----

see that dot~period, separating the "Object" from the "Attribute" (Object.Attribute) ??? this is how you "attach" it in scripting

or in the GUI~Editor:

you would "add" an Attribute to an Object to do the 'attachment'

ie: "HK" Object -> Attributes (Tab) -> Attributes -> Add -> (set it up)

-----

when you have an "Object.Attribute" defined (ie: HK.strength), you can then "call upon or use" that Attribute in any scripting:

<object name="HK">
-> <inherit name="editor_object" />
-> <attr name="strength" type="int">100</attr>
</object>

<function name="blah_1_function">
-> if (HK.strength = 100) {
->-> msg ("HK is strongest in the world, muwhahaha!")
-> }
</function>

<function name="blah_2_function">
-> orc.hp = (HK.strength - orc.endurance) - orc.hp
</function>

<function name="blah_3_function">
-> HK.strength = HK.strength + 100
</function>

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

whereas, if you set a 'Variable', it's local, it's only useable for that script that you set~defined it within:

<function name="blah_1_function">
-> you_go_first = false
-> if (HK.speed > orc.speed) {
->-> you_go_first = true
-> }
-> if (you_go_first = true) {
->-> orc.hp = HK.damage - orc.hp
-> } else if (you_go_first = false) {
->-> HK.hp = orc.damage - HK.hp
-> }
</function>

<function name="blah_2_function">
-> if (you_go_first = true) {
->-> HK.mp = spell.cost - HK.mp
-> } else if (you_go_first = false) {
->-> orc.mp = spell.cost - orc.mp
-> }
</function>

// ERROR, as "you_go_first" is never defined, and because it's local (no attachment to an object), it can't be used outside of the "blah_1_function" Function, such as within the "blah_2_function" Function.

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

A Library is merely a code file (think of a Library as like being a "patch", an "expansion_pack", or even the "game_engine_source_code_itself"), quest itself, is actually made up of libraries:

English.aslx
Core.aslx (which is merely a database, ie it runs~executes, of all the many individual core files, if I understand it correctly)

and you can add in other libraries too:

<asl version="540">
<include ref="English.aslx"/>
<include ref="Core.aslx"/>
<include ref="Pixie's Spell Library File.aslx"/>
<include ref="Chase's Wearables Library File.aslx"/>
<game name="Testing Game Stuff">
<gameid>d67ec73f-f879-4911-9d88-c02ea527c534</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>


or, heck, create your own quest game engine:

<asl version="540">
<include ref="English.aslx"/>
<include ref="HK's Game Engine Library File.aslx"/>
// the code design would be totally different, lol
</asl>


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

2. it depends on the variable (aka 'attributes'), if it's an attribute specific to an object, then you'd want to define it within that object obviously, but if its a game attribute, than there's a few ways of doing this. but let me explain first what I mean here.

"strength" would be set~defined on every "actor~character~pc~npc" Object, obviously, as it's a (RPG common) in-game stat attribute for those type of objects.

HK.strength = 100
blackstar.strength = 50 // hehe
orc.strength = 25
etc...

but say you've got "game progression event flag~boolean" variables~attributes, such as:

dragon_slayer_sword_acquired = false
dragon_killed = false
rescued_princess = false

<turnscript name="global_turn_script">
-> <enabled />
-> <script>
->-> if (dragon_slayer_sword_acquired = true) {
->->-> // script that moves or creates the "dragon" Object into the game world
->-> }
->-> if (dragon_killed = true) {
->->-> // script that unlocks the door to the "princess" Object
->-> }
->-> if (rescued_princess = true) {
->->-> msg ("You won the game!")
->->-> finish
->-> }
-> </script>
</turnscript>

these, would be "game event" ("progression") boolean attributes, which aren't applied to multiple objects as "strength" would be.

so, you can "add" these attributes to the "game" Object:

in the GUI~Editor:

"game" Object -> Attributes (Tab) -> Attributes -> Add -> (set them up)

but, the "game" Object is already crowded enough already...

so, a nifty thing to do, is to create an Object, which isn't within a room type Object:

<object name="game">
</object>
<object name="room" >
-> <object name="player">
-> </object>
</object>
<object name="global_data_object"
-> <attr name="dragon_slayer_sword_acquired" type="boolean">false</attr>
-> <attr name="dragon_killed" type="boolean">false</attr>
-> <attr name="princess_rescued" type="boolean">false</attr>
</object>

HOWEVER, the only problem with this, is that if you want this stuff to be displayed during game play in the right panel, you must use the "game" Object (or the Player Objects). Though, you can display it by using, a Command, for example to display it within the left text window~pane during game play:

<command name="quest_command">
-> <pattern>show quest</pattern>
-> <script>
->-> msg ("Dragon Slayer Sword Acquired?: " + global_data_object.dragon_slayer_sword_acquired)
->-> msg ("Dragon Killed?: " + global_data_object.dragon_killed)
->-> msg ("Princess Rescued?: " + global_data_object.princess_rescued)
-> </script>
</command>

here's an example (feel free to use it ~ ask if you don't know how to copy and paste this into a new game file of yours):

<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<game_is_paused type="boolean">false</game_is_paused>
<game_turns type="int">0</game_turns>
<point_score type="int">0</point_score>
<statusattributes type="simplestringdictionary">game_turns =;game_is_paused =;point_score =</statusattributes>
<start type="script">
msg ("NOTE: Type in something in the command box and hit enter on each turn, to see the attributes being changed.")
msg ("")
</start>
</game>
<function name="show_attributes_function">
msg ("")
msg ("Player's Attributes:")
msg ("")
msg ("Flying: " + player.flying)
msg ("Player Turns: " + player.player_turns)
msg ("")
msg ("Game's Attributes:")
msg ("")
msg ("Game Is Paused: " + game.game_is_paused)
msg ("Game Turns: " + game.game_turns)
msg ("Point Score: " + game.point_score)
msg ("")
msg ("Global Data Object's Attributes:")
msg ("")
msg ("Dragon Slayer Sword Acquired: " + global_data_object.dragon_slayer_sword_acquired)
msg ("Dragon Killed: " + global_data_object.dragon_killed)
msg ("Princess Rescued: " + global_data_object.princess_rescued)
msg ("")
msg ("Turnscript's Scripting Steps's Changed Attributes' Results:")
msg ("")
</function>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<flying type="boolean">false</flying>
<player_turns type="int">0</player_turns>
<statusattributes type="simplestringdictionary">player_turns =;flying =</statusattributes>
</object>
</object>
<object name="global_data_object">
<inherit name="editor_object" />
<dragon_killed type="boolean">false</dragon_killed>
<princess_rescued type="boolean">false</princess_rescued>
<dragon_slayer_sword_acquired type="boolean">false</dragon_slayer_sword_acquired>
</object>
<turnscript name="global_events_turnscript">
<enabled />
<script>
show_attributes_function
if (player.flying=false) {
player.flying=true
} else if (player.flying=true) {
player.flying=false
}
if (game.game_is_paused=false) {
game.game_is_paused=true
} else if (game.game_is_paused=true) {
game.game_is_paused=false
}
if (global_data_object.dragon_slayer_sword_acquired=false) {
global_data_object.dragon_slayer_sword_acquired=true
game.point_score = game.point_score + 50
msg ("dragon_slayer_sword_acquired: " + global_data_object.dragon_slayer_sword_acquired)
msg ("Point Score: " + game.point_score)
if (global_data_object.princess_rescued=true) {
global_data_object.princess_rescued=false
msg ("Princess Rescued: " + global_data_object.princess_rescued)
}
}
if (global_data_object.dragon_slayer_sword_acquired=true) {
global_data_object.dragon_killed=true
game.point_score = game.point_score + 250
global_data_object.dragon_slayer_sword_acquired=false
msg ("Dragon Killed: " + global_data_object.dragon_killed)
msg ("Point Score: " + game.point_score)
msg ("dragon_slayer_sword_acquired: " + global_data_object.dragon_slayer_sword_acquired)
}
if (global_data_object.dragon_killed=true) {
global_data_object.princess_rescued=true
game.point_score = game.point_score + 400
global_data_object.dragon_killed=false
msg ("Princess Rescued: " + global_data_object.princess_rescued)
msg ("Point Score: " + game.point_score)
msg ("Dragon Killed: " + global_data_object.dragon_killed)
}
game.game_turns = game.game_turns + 1
player.player_turns = player.player_turns + 5
</script>
</turnscript>
</asl>


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

@Jay,

aren't technically, most of the ELEMENTS (Objects, Commands, Functions, Timers ~ if global, Turnscripts ~ if global, Types ~ Object Types, and etc?) global (ie: can 'hold~contain', thus 'save-load or call upon~use' any place, attributes~scripts~objects) ?

what is the technical 'object' of the 'object-oriented programming' of quest's design? specifically only the "Object" Element, or are (most of) the Elements (Objects, Commands, functions, and etc) also considered as the technical 'object' of quest's object-oriented programming design ??

jaynabonne
I suppose I used the term "object" a little loosely (generically?), as Quest has a specific "object" tag. In my mind, given the similarity among things like objects, turn scripts, exits, etc. - that is, they are global, named entities that can hold attributes - I was viewing things like command and turn scripts as being specializations ("kinds") of generic objects with special behaviors. However, as I just discovered with my own personal experiment, you can't make things like commands show up in a room regardless of attributes, so they're not "objects" in the sense of the Quest game world (that is, able to be looked at, taken, etc.) So I guess I need to be a bit more careful. :)

Things like functions are global but not objects in any sense - they have no data associated with them (sadly). So I did misspeak in that sense when I said "The only global 'things' in Quest are objects". Perhaps I should have said, "The only global 'things' *that hold data* in Quest are objects." That was my intent since it was in the context of a question about data storage types.

I don't want to get too hung up over the specific meaning of "object". As I said, I personally look at all the global data entities as "objects" (small-"o", perhaps), but that might just be me, and I need to be careful in how I speak, since that can be confusing!

HegemonKhan
I was just curious, and also wanting~trying to better understand the underlying design of quest, so thank you for the detailed explanation of nuances of "global vs data~attribute containing object".

Blackstar
Alright, that was very informative! Thanks for the effort, especially to you HegemonKhan! :)

I get it now (at least I think). I have to attach the attributes towards the "player object" in order to permanently provide it with all the necessary information.

After thinking about a few things I've decided to go with Jays Idea since the menu may be fine but it also disrupts the flow of the game. (meaning a pop-up menu feels awkward given the overall style of the game. So instead I go with a room where I'm capable of not only giving the player a choice to make but also to inform him / her about his choice to make.
Basically my thought was this:

A menu only provides with to choices
"Policeman"
"Detective"

And no further explanation whatsoever without making it look even more awkward. So I can just create another room and define what the player sees with also giving him som information about whats going to happen. E.g.:

"Policeman - physically adept and trained with a gun"
"Detective - Trained with a gun and quite adept at solving puzzles"

Yet I am a bit puzzled on how to archieve that. (Thanks for being so patient with me, folks) I tried several different scripts but none of them seem to work properly.
This would mean that I create the custom verb "chose" in order to either chose the "male" object or the "female" object.
Now I am relying upon an If-function so it goes basically like this:

If player "chose" "male" then attach "male"-attribute to player object. (or set male to 1) Else do nothing.
If player "chose" female" then attach "female"-attribute to player object. (or set female to 1) Else do nothing.

So I've set up a global_data_object just as HK mentioned and added two attributes to it:
"playermale"
"playerfemale"

both bolean with "false" as value.

So this means I have to change the script towards this:

If player "chose" "male" then change "playermale"-attribute to "true". Else do nothing.
If player "chose" female" then change "playerfemale"-attribute to "true". Else do nothing.

And since this made some problems I removed the global_data_object and attached "male" and "female" onto the "player"-object to simplify it's use. Both are initially set onto "false" in order to give the player the choice and lead him further once one of them is set to "true". I've tried to simplify it in order to wait for specific input.

So my problem now is that the game needs to recognize that when the player enters "male" or "female" his character becomes so and therefore change the attached player-attribute "male" or "female" to true.

jaynabonne
Quest has inline menus in addition to the popup ones. I'm not sure if you've seen those. To try it out, add this code to a room:

    <firstenter type="script">
options = NewStringList()
list add(options, "Male")
list add(options, "Female")
ShowMenu("Are you male or female?", options, false) {
if (result = "Male") {
player.male = true
} else {
player.female = true
}
}
</firstenter>


On first entry to the room, it will prompt the player to answer the male/female question.

You can go the custom command route, but that seems more awkward both for you and the player, as it's modeless, and the user can type anything but has to figure out what to input. Just my thoughts... :)

jaynabonne
If you want to go the command route, you can do something like this:

  <command name="ChooseGender">
<pattern>choose #text#</pattern>
<script>
if (text = "male") {
player.male = true
msg("You are male.")
} else if (text = "female") {
player.female = true
msg("You are female.")
} else {
msg("Please choose either male or female")
}
</script>
</command>

You should probably put the command in the room where it's used. Otherwise, the player will be able to change gender at will throughout the game. Just drag the command into the desired room, and it will only be active there.

Blackstar
jaynabonne wrote:Quest has inline menus in addition to the popup ones. I'm not sure if you've seen those. To try it out, add this code to a room:

    <firstenter type="script">
options = NewStringList()
list add(options, "Male")
list add(options, "Female")
ShowMenu("Are you male or female?", options, false) {
if (result = "Male") {
player.male = true
} else {
player.female = true
}
}
</firstenter>


On first entry to the room, it will prompt the player to answer the male/female question.

You can go the custom command route, but that seems more awkward both for you and the player, as it's modeless, and the user can type anything but has to figure out what to input. Just my thoughts... :)

That's.... fantastic! Really! Now it makes sense. Added a short message with the result in order to aknowledge the script works. Fantastic! :)
Alright, I even managed to move the player with his new "true" attribute into the next section where I probably redo the same procedure with more options. It's a bit more tricky since it's "If then else" again but I'm positive that I can achieve that. HUGE step forward.

HegemonKhan
Enjoy, this should be of great help to you, as lazy HK finally put some effort into this post, making it (mostly) clear for once!

Blackstar wrote:I get it now (at least I think). I have to attach the attributes towards the "player object" in order to permanently provide it with all the necessary information.


no, attributes can be attached (or added) to *ANY* (Type: Room, Player, Non-Room Non-Player, and the Game) Object, for them to then also be used in any script, (Object.Attribute), providing that the Object itself still exists, of course, ie the Object isn't "removed" nor is "destroyed").

however, if you want to display those attributes in the right pane during game play (via the special "statusattributes" string dictionary), they can only be done so when added to a Player Object (the default "player", or a custom one, like "HK" for example) or the "game" Object. See, study, play with, and use my code freely below (and also all the other codes of mine below, all are free for you to use and~or to change~alter too):

<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns =</statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<curhp type="int">250</curhp>
<maxhp type="int">500</maxhp>
<current_hit_points type="int">999</current_hit_points>
<maximum_hit_points type="int">999</maximum_hit_points>
<maxhp type="int">500</maxhp>
<hp type="string">0/0</hp>
<strength type="int">100</strength>
<endurance type="int">100</endurance>
<agility type="int">100</agility>
<hit_points type="string">0/0</hit_points>
<statusattributes type="simplestringdictionary">hp = ;hit_points =!;strength =;endurance = !;agility = Your agility is !</statusattributes>
</object>
</object>
<turnscript name="turns_turnscript">
<enabled />
<script>
player.hp = player.curhp + "/" + player.maxhp
player.hit_points = "HP: " + player.current_hit_points + "/" + player.maximum_hit_points
game.turns = game.turns + 1
</script>
</turnscript>
</asl>


blackstar wrote:After thinking about a few things I've decided to go with Jays Idea since the menu may be fine but it also disrupts the flow of the game. (meaning a pop-up menu feels awkward given the overall style of the game.


there's only two methods that I know of for getting a game user's input during game play:

1. forced~locked selection of choices by the game user:

A. "show menu"
B. Verb Buttons and~or Hyperlink commands in the text
C. Commands

2. open typed-in input by the game user:

A. "get input"
B. Commands

blackstar wrote:So instead I go with a room where I'm capable of not only giving the player a choice to make but also to inform him / her about his choice to make.
Basically my thought was this:

A menu only provides with to choices
"Policeman"
"Detective"

And no further explanation whatsoever without making it look even more awkward. So I can just create another room and define what the player sees with also giving him som information about whats going to happen. E.g.:

"Policeman - physically adept and trained with a gun"
"Detective - Trained with a gun and quite adept at solving puzzles"

Yet I am a bit puzzled on how to archieve that. (Thanks for being so patient with me, folks) I tried several different scripts but none of them seem to work properly.


<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<game_is_paused type="boolean">false</game_is_paused>
<game_turns type="int">0</game_turns>
<point_score type="int">0</point_score>
<statusattributes type="simplestringdictionary">game_turns =;game_is_paused =;point_score =</statusattributes>
<start type="script">
msg ("NOTE: Type in something in the command box and hit enter on each turn, to see the attributes being changed.")
msg ("")
</start>
</game>
<function name="show_attributes_function">
msg ("")
msg ("Player's Attributes:")
msg ("")
msg ("Flying: " + player.flying)
msg ("Player Turns: " + player.player_turns)
msg ("")
msg ("Game's Attributes:")
msg ("")
msg ("Game Is Paused: " + game.game_is_paused)
msg ("Game Turns: " + game.game_turns)
msg ("Point Score: " + game.point_score)
msg ("")
msg ("Global Data Object's Attributes:")
msg ("")
msg ("Dragon Slayer Sword Acquired: " + global_data_object.dragon_slayer_sword_acquired)
msg ("Dragon Killed: " + global_data_object.dragon_killed)
msg ("Princess Rescued: " + global_data_object.princess_rescued)
msg ("")
msg ("Turnscript's Scripting Steps's Changed Attributes' Results:")
msg ("")
</function>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<flying type="boolean">false</flying>
<player_turns type="int">0</player_turns>
<statusattributes type="simplestringdictionary">player_turns =;flying =</statusattributes>
</object>
</object>
<object name="global_data_object">
<inherit name="editor_object" />
<dragon_killed type="boolean">false</dragon_killed>
<princess_rescued type="boolean">false</princess_rescued>
<dragon_slayer_sword_acquired type="boolean">false</dragon_slayer_sword_acquired>
</object>
<turnscript name="global_events_turnscript">
<enabled />
<script>
show_attributes_function
if (player.flying=false) {
player.flying=true
} else if (player.flying=true) {
player.flying=false
}
if (game.game_is_paused=false) {
game.game_is_paused=true
} else if (game.game_is_paused=true) {
game.game_is_paused=false
}
if (global_data_object.dragon_slayer_sword_acquired=false) {
global_data_object.dragon_slayer_sword_acquired=true
game.point_score = game.point_score + 50
msg ("dragon_slayer_sword_acquired: " + global_data_object.dragon_slayer_sword_acquired)
msg ("Point Score: " + game.point_score)
if (global_data_object.princess_rescued=true) {
global_data_object.princess_rescued=false
msg ("Princess Rescued: " + global_data_object.princess_rescued)
}
}
if (global_data_object.dragon_slayer_sword_acquired=true) {
global_data_object.dragon_killed=true
game.point_score = game.point_score + 250
global_data_object.dragon_slayer_sword_acquired=false
msg ("Dragon Killed: " + global_data_object.dragon_killed)
msg ("Point Score: " + game.point_score)
msg ("dragon_slayer_sword_acquired: " + global_data_object.dragon_slayer_sword_acquired)
}
if (global_data_object.dragon_killed=true) {
global_data_object.princess_rescued=true
game.point_score = game.point_score + 400
global_data_object.dragon_killed=false
msg ("Princess Rescued: " + global_data_object.princess_rescued)
msg ("Point Score: " + game.point_score)
msg ("Dragon Killed: " + global_data_object.dragon_killed)
}
game.game_turns = game.game_turns + 1
player.player_turns = player.player_turns + 5
</script>
</turnscript>
</asl>


...and...

About Turnscripts (and Timers):

they're very useful, as they're "always running functions", and you can add them to apply only to a specific room (and thus only when you're in that room), or you can add them globally, to apply to the entire game (and thus no matter what room you're in). Lastly, you can have them "enabled" at the start of the game, or you can choose (aka script) when to "enable" them as well.

so for example, creating game (or 'player', or 'non-player non-game Object') turns (and multiple ways of displaying of them):

<object name="game">
-> // blah scripts
-> <attr name="turns" type="int">0</attr>
-> <attr name="statusattributes" type="simplestringdictionary">turns = Turns: !</attr>
-> // blah scripts
</object>

<object name="player">
-> <inherit name="editor_object" />
-> <inherit name="editor_player" />
-> <attr name="turns" type="int">0</attr>
-> <attr name="statusattributes" type="simplestringdictionary">turns = Turns: !</attr>
</object>

<object name="HK">
-> <inherit name="editor_object" />
-> <inherit name="editor_player" />
-> <attr name="turns" type="int">0</attr>
-> <attr name="statusattributes" type="simplestringdictionary">turns = Turns: !</attr>
</object>

<object name="turns_clock">
-> <inherit name="editor_object" />
-> <attr name="turns" type="int">0</attr>
</object>

<turnscript name="global_turn_script">
-> <enabled />
-> <script>
->-> show_turns_function
->-> game.turns = game.turns + 1
->-> player.turns = player.turns + 1
->-> HK.turns = HK.turns + 1
->-> turns_clock.turns = turns_clock.turns + 1
-> </script>
</turnscript>

<function name="show_turns_function">
-> msg ("Game Turns: " + game.turns)
-> msg ("Player Turns: " + player.turns)
-> msg ("HK Turns: " + HK.turns)
-> msg ("Turns Clock Turns: " + turns_clock.turns)
</function>

<command name="show_turns_command">
-> <pattern>show turns</pattern>
-> <script>
->-> show_turns_function
-> </script>
</command>

blackstar wrote:This would mean that I create the custom verb "chose" in order to either chose the "male" object or the "female" object.
Now I am relying upon an If-function so it goes basically like this:

If player "chose" "male" then attach "male"-attribute to player object. (or set male to 1) Else do nothing.
If player "chose" female" then attach "female"-attribute to player object. (or set female to 1) Else do nothing.

So I've set up a global_data_object just as HK mentioned and added two attributes to it:
"playermale"
"playerfemale"

both bolean with "false" as value.

So this means I have to change the script towards this:

If player "chose" "male" then change "playermale"-attribute to "true". Else do nothing.
If player "chose" female" then change "playerfemale"-attribute to "true". Else do nothing.

And since this made some problems I removed the global_data_object and attached "male" and "female" onto the "player"-object to simplify it's use. Both are initially set onto "false" in order to give the player the choice and lead him further once one of them is set to "true". I've tried to simplify it in order to wait for specific input.

So my problem now is that the game needs to recognize that when the player enters "male" or "female" his character becomes so and therefore change the attached player-attribute "male" or "female" to true.


<function name="gender_string_creation_function" parameters="object_x">
msg ("What is your gender?")
msg ("(1) male or (2) female")
get input {
if (IsNumeric (result) = true) {
if (result = "1") {
object_x.gender_string = "male"
ClearScreen
} else if (result = "2") {
object_x.gender_string = "female"
ClearScreen
} else {
ClearScreen
gender_string_creation_function (object_x)
}
} else if (IsNumeric (result) = false) {
if (result = "m" or result = "male") {
object_x.gender_string = "male"
ClearScreen
} else if (result = "f" or result = "female") {
object_x.gender_string = "female"
ClearScreen
} else {
ClearScreen
gender_string_creation_function (object_x)
}
}
}
</function>


<function name="race_string_creation_function" parameters="object_x">
msg ("What is your race?")
msg ("(1) european, (2) asian, (3) african, or (4) american")
get input {
if (IsNumeric (result) = true) {
if (result = "1") {
object_x.race_string = "european"
ClearScreen
} else if (result = "2") {
object_x.race_string = "asian"
ClearScreen
} else if (result = "3") {
object_x.race_string = "african"
ClearScreen
} else if (result = "4") {
object_x.race_string = "american"
ClearScreen
} else {
ClearScreen
race_string_creation_function (object_x)
}
} else if (IsNumeric (result) = false) {
if (result = "eu" or result = "european") {
object_x.race_string = "european"
ClearScreen
} else if (result = "as" or result = "asian") {
object_x.race_string = "asian"
ClearScreen
} else if (result = "af" or result = "african") {
object_x.race_string = "african"
ClearScreen
} else if (result = "am" or result = "american") {
object_x.race_string = "american"
ClearScreen
} else {
ClearScreen
race_string_creation_function (object_x)
}
}
}
</function>


<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<gender_x type="simplestringlist">male;female</gender_x>
<start type="script">
test_function
</start>
</game>
<function name="test_function">
x=0
foreach (string_x, game.gender_x) {
x=x+1
msg (x + ". " + string_x)
}
msg ("What is your choice?")
get input {
choice_x = result
if (choice_x = "1" or choice_x = "male") {
msg ("yes male")
} else if (choice_x = "2" or choice_x = "female") {
msg ("yes female")
}
on ready {
show menu ("Do you want to do it again?", split ("yes;no",";"), false) {
if (result="yes") {
test_function
} else if (result="no") {
msg ("you've choosen to stop")
}
}
}
}
</function>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>

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

Support

Forums