Gamebook resources
TheDetails
29 May 2016, 16:54I understand the gamebook mode is relatively new compared to the text adventure, and it appears vastly more people use the text adventure build, so there's invariably going to be a lot less documentation on it. I was just wondering if someone was bored enough to assist me briefly.
I'm enamoured of the simplicity of the mechanics, and with just the [HasSeenPage / HasNotSeenPage] and the [random chance] options alone, one can make a pretty reactive gameworld if you're willing to get your elbows dirty.
But I want my game book/world to be just a bit more reactive than that. I was searching around here and elsewhere for the better part of yesterday and have finally given up, so here I am. What I was hoping to find was this:
• I have no idea how to get [input] to react to a certain entered value. For instance if Tropey The Talking Door was asking for the answer to a riddle, how do set the input to return a different page when the correct value is entered?
• Related: I can't find a way to display a counter to the player (preferably in a side window, but even just in the main body?) say if a turn-timer is going down, or if it's just keeping track of their hit points.
• Likewise: I'm having immense trouble getting anything to recognize and react to the counters. For instance, if the player has a 'Personality' score of 4 as defined by a counter, and I wanted to have a page check their Personality score and return a new dialogue option if so ["Hey there big boy, you're pretty handsome, wanna take a moonlit walk on the beach and give me all your gold"?], how would I do that?
I realize these types of things are handled pretty intuitively by text adventure mode, so one suggestion would be I just use text adventure mode. For me, though, I want to create a gameworld that doesn't put too many mechanics and options in it for newb players (who this will be targeted at) and instead the player's abilities and items reveal themselves as the story progresses in the simpler gamebook mode. I feel 'typing stuff to interact and move' is too much for newbs for the same reason, I think people new to this kind of game just want to click options on their phone/laptop and are less inclined to learn a new mechanic (oh crap I can go north, south and east, I can pick up the dagger, shield and potion, I can look at 6 things, talk to two people, and I have stats which interact with everything i do... etc.) their first go around (as awesome as that is for more seasoned gamers).
Thanks for your time, guys!
edit: I realize I can 'cheat' my way to solutions here, specifically by using HasSeenPage. So if someone chose to increase their Personality from 3 to 4 by choosing a text option, then I can run a [if HasSeenPage] check on the page they landed on when they 'increased' their Personality score. It's just that, if I could check counters and inputs and return values, I could make my gamebook world that much more robust. And, also, I forgot to say this in my original post: I'm sure the answers to these questions are incredibly easy or are documented somewhere obvious, and I apologize. I forgot to lead with the fact that I'm mostly a dummy.
I'm enamoured of the simplicity of the mechanics, and with just the [HasSeenPage / HasNotSeenPage] and the [random chance] options alone, one can make a pretty reactive gameworld if you're willing to get your elbows dirty.
But I want my game book/world to be just a bit more reactive than that. I was searching around here and elsewhere for the better part of yesterday and have finally given up, so here I am. What I was hoping to find was this:
• I have no idea how to get [input] to react to a certain entered value. For instance if Tropey The Talking Door was asking for the answer to a riddle, how do set the input to return a different page when the correct value is entered?
• Related: I can't find a way to display a counter to the player (preferably in a side window, but even just in the main body?) say if a turn-timer is going down, or if it's just keeping track of their hit points.
• Likewise: I'm having immense trouble getting anything to recognize and react to the counters. For instance, if the player has a 'Personality' score of 4 as defined by a counter, and I wanted to have a page check their Personality score and return a new dialogue option if so ["Hey there big boy, you're pretty handsome, wanna take a moonlit walk on the beach and give me all your gold"?], how would I do that?
I realize these types of things are handled pretty intuitively by text adventure mode, so one suggestion would be I just use text adventure mode. For me, though, I want to create a gameworld that doesn't put too many mechanics and options in it for newb players (who this will be targeted at) and instead the player's abilities and items reveal themselves as the story progresses in the simpler gamebook mode. I feel 'typing stuff to interact and move' is too much for newbs for the same reason, I think people new to this kind of game just want to click options on their phone/laptop and are less inclined to learn a new mechanic (oh crap I can go north, south and east, I can pick up the dagger, shield and potion, I can look at 6 things, talk to two people, and I have stats which interact with everything i do... etc.) their first go around (as awesome as that is for more seasoned gamers).
Thanks for your time, guys!
edit: I realize I can 'cheat' my way to solutions here, specifically by using HasSeenPage. So if someone chose to increase their Personality from 3 to 4 by choosing a text option, then I can run a [if HasSeenPage] check on the page they landed on when they 'increased' their Personality score. It's just that, if I could check counters and inputs and return values, I could make my gamebook world that much more robust. And, also, I forgot to say this in my original post: I'm sure the answers to these questions are incredibly easy or are documented somewhere obvious, and I apologize. I forgot to lead with the fact that I'm mostly a dummy.

jaynabonne
29 May 2016, 19:22If people don't jump in with this, please understand that (I believe - I could be wrong) those of us who help out here don't have much experience with gamebook mode. I think the main thing you will need to do to vary the pages based on stats is to use the "script only" or "script plus text" page modes, where you can inject some scripting behavior onto a page.
HegemonKhan
29 May 2016, 20:39I don't know GameBook that well, but I'll chime in anyways, as I always do, laughs.
I think the GameBook has most of the same scripting functionality as the TextAdventure, so I think you'll be able to do everything that you stated. So, you can use the much more numerous TextAdventure resources to learn how to do the stuff you want, except that functionality is just accessed differently in a GameBook compared to how its accessed in TextAdventure.
As Jay stated, the way (or only way) to access that scripting Functionality, through the GUI~Editor, is:
for individual Pages, via selecting the:
[SCRIPT] or [SCRIPT+TEXT], options for the 'Page Type' drop down box for your specific pages where you want/need sripting to be done.
These options allow you to use your Pages for doing (or adding) that scripting functionality into/for/with that Page.
'whatever' Page Object -> 'Page' Tab -> Page Type -> [SCRIPT] or [SCRIPT+Text] -> (see below)
add new script -> (choose your scripts and set them up)
and, there's also the:
'game' Game Object -> 'Script' Tab -> add new script -> (choose your scripts and set them up)
which, unlike in the TextAdventure, I believe, is to just run those added/created scripts first everytime you switch Pages.
(In the TextAdventure, the scripts added in this similar area in it: 'start' Script of the 'Scripts' Tab of the 'game' Game Object, will be the first things done/run at the start of playing the game, which for example, is often used for 'character creation' if making a RPG type of game)
To have scripts run as the first thing upon starting a GameBook game, you'll simply set up your starting Page with your desired scripts, via again just by choosing the [SCRIPT] or [SCRIPT+TEXT], and adding the desired scripts and setting them up)
----------
all of the above, is basically how the scripting is done in GameBook, so now it's just a matter of learning scripting (mainly the 'if' Script) and Attributes, unless you already know a bit about them and/or coding.
if you don't know how to do/use Scripting and Attributes, there's a lot of resources on them for the TextAdventure, and there's mostly no difference. The Attribute usage and scripting is mostly the exact same between GameBook and TextAdventures, with only the main difference in that the GameBook only has the 'game' Game Object, the 'player' Player Object, and the 'whatever' Page Objects, to apply/add those Attributes to for using in/for/with the Scripting, whereas the TextAdventure has many more types of Objects that can be used.
these are two super scripts that let you do 90% of everything that you want to do in your game:
1. Attribute Creation-Setting/Manipulating-Changing-Resetting/Usage:
'whatever' Page Object -> Page Type -> [Script] or [Script+Text] -> (see below)
add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> (I don't know the GUI~Editor's options as I just code my games directly - I don't use the GUI~Editor much, so I chose the [EXPRESSION] option as this lets me code in what I want it to do, so I'll show below this way of doing it - otherwise you can just figure out what option to choose instead of [EXPRESSION] and set it up) -> [Expression] -> (see below)
set variable __________ = [Expression] ___________
Attribute Scripting Syntax has this general form (in code):
Object_name.Attribute_name = Value_or_Expression
Attribute Scripting Syntax has this general form (in GUI~Editor):
set variable Object_name.Attribute_name = Value_or_Expression
some examples (in code):
// Object Names: player
// Attribute Names: strength, weapon_damage, damage
player.strength = 100
player.weapon_damage = 10
player.damage = player.weapon_damage + player.weapon_damage * player.strength / 100
// player.damage = 10 + 10 * 100 / 100 = 20
some examples (using the GUI~Editor's form):
// Object Names: player
// Attribute Names: strength, weapon_damage, damage
set variable player.strength = [Expression] 100
set variable player.weapon_damage = [Expresison] 10
set variable player.damage = [Expression] player.weapon_damage + player.weapon_damage * player.strength / 100
// player.damage = 10 + 10 * 100 / 100 = 20
2. and then here's the 'if' Script:
'whatever' Page Object -> Page Type -> [Script] or [Script+Text] -> (see below)
add new script -> (section/cateogery: scripts) -> 'if' Script -> (I don't know the GUI~Editor's options as I just code my games directly - I don't use the GUI~Editor much, so I chose the [EXPRESSION] option as this lets me code in what I want it to do, so I'll show below this way of doing it - otherwise you can just figure out what option to choose instead of [EXPRESSION] and set it up) -> [Expression] -> (see below)
if [EXPRESSION] Object_name.Attribute_name OPERATOR Value_or_Expression
an example:
if [EXPRESSION] player.test_score >= 90
-> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "A"
add else if -> [EXPRESSION]-> if [EXPRESSION] player.test_score >= 80
> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "B"
add else if -> [EXPRESSION]-> if [EXPRESSION] player.test_score >= 70
> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "C"
add else if -> [EXPRESSION]-> if [EXPRESSION] player.test_score >= 60
> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "D"
add else -> add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "F"
---------------
here's some resources for Scripting and Attribute learning:
http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/guides/
http://docs.textadventures.co.uk/quest/ ... ation.html (this is a good guide on how to get and do stuff, from input from the person playing the game. Again, just access the scripting via setting your Pages' Page Type as [SCRIPT] or [SCRIPT + TEXT])
my guide at trying to explain Attributes and 'if' Script usage:
viewtopic.php?f=18&t=5559 (though it was done for the Text Adventure, so some of the explanation stuff doesn't apply and/or its structure is/would_be different for GameBook, than how it is for the Text Adaventure)
I think the GameBook has most of the same scripting functionality as the TextAdventure, so I think you'll be able to do everything that you stated. So, you can use the much more numerous TextAdventure resources to learn how to do the stuff you want, except that functionality is just accessed differently in a GameBook compared to how its accessed in TextAdventure.
As Jay stated, the way (or only way) to access that scripting Functionality, through the GUI~Editor, is:
for individual Pages, via selecting the:
[SCRIPT] or [SCRIPT+TEXT], options for the 'Page Type' drop down box for your specific pages where you want/need sripting to be done.
These options allow you to use your Pages for doing (or adding) that scripting functionality into/for/with that Page.
'whatever' Page Object -> 'Page' Tab -> Page Type -> [SCRIPT] or [SCRIPT+Text] -> (see below)
add new script -> (choose your scripts and set them up)
and, there's also the:
'game' Game Object -> 'Script' Tab -> add new script -> (choose your scripts and set them up)
which, unlike in the TextAdventure, I believe, is to just run those added/created scripts first everytime you switch Pages.
(In the TextAdventure, the scripts added in this similar area in it: 'start' Script of the 'Scripts' Tab of the 'game' Game Object, will be the first things done/run at the start of playing the game, which for example, is often used for 'character creation' if making a RPG type of game)
To have scripts run as the first thing upon starting a GameBook game, you'll simply set up your starting Page with your desired scripts, via again just by choosing the [SCRIPT] or [SCRIPT+TEXT], and adding the desired scripts and setting them up)
----------
all of the above, is basically how the scripting is done in GameBook, so now it's just a matter of learning scripting (mainly the 'if' Script) and Attributes, unless you already know a bit about them and/or coding.
if you don't know how to do/use Scripting and Attributes, there's a lot of resources on them for the TextAdventure, and there's mostly no difference. The Attribute usage and scripting is mostly the exact same between GameBook and TextAdventures, with only the main difference in that the GameBook only has the 'game' Game Object, the 'player' Player Object, and the 'whatever' Page Objects, to apply/add those Attributes to for using in/for/with the Scripting, whereas the TextAdventure has many more types of Objects that can be used.
these are two super scripts that let you do 90% of everything that you want to do in your game:
1. Attribute Creation-Setting/Manipulating-Changing-Resetting/Usage:
'whatever' Page Object -> Page Type -> [Script] or [Script+Text] -> (see below)
add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> (I don't know the GUI~Editor's options as I just code my games directly - I don't use the GUI~Editor much, so I chose the [EXPRESSION] option as this lets me code in what I want it to do, so I'll show below this way of doing it - otherwise you can just figure out what option to choose instead of [EXPRESSION] and set it up) -> [Expression] -> (see below)
set variable __________ = [Expression] ___________
Attribute Scripting Syntax has this general form (in code):
Object_name.Attribute_name = Value_or_Expression
Attribute Scripting Syntax has this general form (in GUI~Editor):
set variable Object_name.Attribute_name = Value_or_Expression
some examples (in code):
// Object Names: player
// Attribute Names: strength, weapon_damage, damage
player.strength = 100
player.weapon_damage = 10
player.damage = player.weapon_damage + player.weapon_damage * player.strength / 100
// player.damage = 10 + 10 * 100 / 100 = 20
some examples (using the GUI~Editor's form):
// Object Names: player
// Attribute Names: strength, weapon_damage, damage
set variable player.strength = [Expression] 100
set variable player.weapon_damage = [Expresison] 10
set variable player.damage = [Expression] player.weapon_damage + player.weapon_damage * player.strength / 100
// player.damage = 10 + 10 * 100 / 100 = 20
2. and then here's the 'if' Script:
'whatever' Page Object -> Page Type -> [Script] or [Script+Text] -> (see below)
add new script -> (section/cateogery: scripts) -> 'if' Script -> (I don't know the GUI~Editor's options as I just code my games directly - I don't use the GUI~Editor much, so I chose the [EXPRESSION] option as this lets me code in what I want it to do, so I'll show below this way of doing it - otherwise you can just figure out what option to choose instead of [EXPRESSION] and set it up) -> [Expression] -> (see below)
if [EXPRESSION] Object_name.Attribute_name OPERATOR Value_or_Expression
an example:
if [EXPRESSION] player.test_score >= 90
-> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "A"
add else if -> [EXPRESSION]-> if [EXPRESSION] player.test_score >= 80
> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "B"
add else if -> [EXPRESSION]-> if [EXPRESSION] player.test_score >= 70
> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "C"
add else if -> [EXPRESSION]-> if [EXPRESSION] player.test_score >= 60
> then, add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "D"
add else -> add new script -> (section/category: variables) -> 'set a variable or attribute' Script -> [EXPRESSION] -> player.test_grade = [EXPRESSION] "F"
---------------
here's some resources for Scripting and Attribute learning:
http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/guides/
http://docs.textadventures.co.uk/quest/ ... ation.html (this is a good guide on how to get and do stuff, from input from the person playing the game. Again, just access the scripting via setting your Pages' Page Type as [SCRIPT] or [SCRIPT + TEXT])
my guide at trying to explain Attributes and 'if' Script usage:
viewtopic.php?f=18&t=5559 (though it was done for the Text Adventure, so some of the explanation stuff doesn't apply and/or its structure is/would_be different for GameBook, than how it is for the Text Adaventure)
TheDetails
30 May 2016, 00:00Oh wow I am a dummy. There's a freaking drop down for interacting with Counters that I somehow didn't see for like 30 hours of going through dropdowns. Jeez.
Ok last question: I don't get the expression stuff, like at all. Instead of rummaging through hours of alien tutorials, just seeing one working line of code will get me up and running way faster. I'm more a 'smash it on the ground and then see if I can put it back together' kind of guy. Maybe it's my ADHD.
Inputs. Player types something into the input. What's the expression/script/attribute/variable/I'm lost that I put there so it reads what the person wrote in the input field, and checks to see if it matches some value, and then returns whatever based on that. Does that make sense? It should be a pretty simple little hunk of code but it eludes me.
EDIT WHOA WHOA WAIT I think I found it. It was result="" I was looking for. That should handle what I'm talking about.
Thanks again!

Ok last question: I don't get the expression stuff, like at all. Instead of rummaging through hours of alien tutorials, just seeing one working line of code will get me up and running way faster. I'm more a 'smash it on the ground and then see if I can put it back together' kind of guy. Maybe it's my ADHD.
Inputs. Player types something into the input. What's the expression/script/attribute/variable/I'm lost that I put there so it reads what the person wrote in the input field, and checks to see if it matches some value, and then returns whatever based on that. Does that make sense? It should be a pretty simple little hunk of code but it eludes me.

EDIT WHOA WHOA WAIT I think I found it. It was result="" I was looking for. That should handle what I'm talking about.
Thanks again!

HegemonKhan
30 May 2016, 06:43ah, my bad, I forgot to mention about that. Whoopsy!
the 'get input' and 'show menu' Scripts/Functions automatically (hidden from you) set a built-in Variable 'result' to hold your input:
result = your_input
as you discovered on your own (good job!), which you can then use:
if (result = "whatever") { /* scripts */ }
------
do note that Variables are local, they're erased/destroyed once the scripting block has been run/finished, so if you want/need to preserve the value (so you can use it elsewhere in your game), then you got to set it to an Attribute, an example in code:
---------------
quest has this structure:
VARIABLES (3 types):
-> (1) Variables, examples: result = "HK", handled = (true/false), you_go_first = (false/true) ... notice that there's no 'dot/period' connector (no 'Object_name.Attribute_name = Value_or_Expression' structure, only 'Variable_name = Value_or_Expression' structure)
-> (2) Attributes, examples: player.strength = 100, player.alias = "HK", game.state = 0, game.dragon_killed = false, game.dragon_killed = true, player.right_hand = sword, weapon.damage = 10, player.weapon.damage = 10, player.damage = player.damage + player.damage * player.strength / 100 ... notice that it has the 'dot/period' connector (uses the 'Object_name.Attribute_name = Value_or_Expression' structure, by having an Object containing that Attribute, this makes it permanent (so long as the Object exists of course), which makes it global, it's 'saveable' and thus 'loadable', anywhere in your game (again, so long as the Object exists)
-> (3) Parameters: deals with Functions/Commands/Etc
------------------
The GameBook doesn't have the ability to create/add Attributes through the non-scripting GUI~Editor, like the TextAdventure does, but let's look at it, as it hopefully will help you understand the scripting better...
in the Text Adventure's GUI~Editor, you can initially create/set ("add") Attributes like this, an example:
'player' Player Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)
(Object Name: player)
Attribute Name: strength
Attribute Type: int (integer)
Attribute Value: 100
which is the same as this in GUI~Editor scripting (same for both Text Adventure and Game Book):
set variable player.strength = [EXPRESSON] 100
// quest can tell what the Attribute Type is by the Value
and in-code (game code), looks like this (the above two methods, just creates the 'attr' (Attribute) code line in this small part, the 'player' Player Object, of your game code below):
--------
conceptual example of the Containment/Child-Parent heirarchy (OOP/OOD: Object-Oriented Programmming/Design):
http://docs.textadventures.co.uk/quest/ ... arent.html
^^^^^
http://docs.textadventures.co.uk/quest/ ... bject.html
^^^^^^
http://docs.textadventures.co.uk/quest/elements/
^^^^^
http://docs.textadventures.co.uk/quest/
(more parent)
C:\\ (drive)
-> Programs (folder)
->-> Quest (folder)
->->-> quest.exe (file)
(more child)
as scripting:
C.Programs.Quest.quest
the 'quest.exe' File is contained within the 'Quest' Folder
the 'Quest' Folder is contained within the 'Programs' Folder
the 'Programs' Folder is contained within the 'C' Drive
(more parent)
HK
-> pants
->-> wallet
->->-> $1
(more child)
(more parent)
grandfather
-> father
->-> son
->->-> grandson
(more child)
'grandfather' is the main (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'
grandfather.parent = null
father.parent = grandfather
son.parent = father
grandson.parent = son
what if I added this script below? how does the heirarchy change? :
grandson.parent = grandfather
~OR this script~
MoveObject (grandson, grandfather)
// http://docs.textadventures.co.uk/quest/ ... bject.html
answer:
and then again:
son.parent = grandson
~OR~
MoveObject (son, grandson)
answer:
I'm not sure if the GameBook uses 'goto' for its Script for moving the 'player' Player Object from one Page Object to another Page Object ... too lazy to open up a Game Book game and see what word/name/label it is for its Script, lol. I think the 'parent' Object Attribute works/exists in Game Book, but I could be wrong (maybe it doesn't).
-------
see... the 'Object' Element is a container that holds Attributes and/or other Objects
either you use the GUI~Editor (not available in Game Book) to "add" Attributes to be contained within the 'Object' Element or you use the GUI~Editor scripting (available in both Text Adventure and Game Book) to 'attach/connect' (via using that dot/period) the Attribute to be contained within the 'Object' element or you do it directly via in-code (not using the GUI~Editor at all).
there are other containers (Elements) too:
Functions: they contain scripting only
Commands: .....
Turnscripts: .....
Timers: ....
etc etc etc ( http://docs.textadventures.co.uk/quest/elements/ )
the 'get input' and 'show menu' Scripts/Functions automatically (hidden from you) set a built-in Variable 'result' to hold your input:
result = your_input
as you discovered on your own (good job!), which you can then use:
if (result = "whatever") { /* scripts */ }
------
do note that Variables are local, they're erased/destroyed once the scripting block has been run/finished, so if you want/need to preserve the value (so you can use it elsewhere in your game), then you got to set it to an Attribute, an example in code:
// 'whatever' Page -> Page Type: [Scripts] or [Scripts+Text]:
msg ("Enter Input:")
// let's say I enter: "HK"
get input {
// automatically done by quest (hidden from you), sets your input to be stored by the built-in 'result' Variable:
// result = "HK"
game.my_input = result // this line is setting the value stored in the 'result' Variable to be stored into the 'game.my_input' Attribute
// game.my_input = result = "HK"
// game.my_input = "HK"
if (result = "HK" and game.my_input = "HK") {
msg (result)
// outputs: HK
msg (game.my_input)
// outputs: HK
} else {
msg ("you didn't input 'HK'.")
}
}
// 'whatever 2' Page -> Page Type: [Scripts] or [Scripts+Text]:
msg (result)
// outputs: (ERROR! the 'result' Variable doesn't exist, as you've never created it for this scripting block to use)
msg (game.my_input)
// outputs: HK
---------------
quest has this structure:
VARIABLES (3 types):
-> (1) Variables, examples: result = "HK", handled = (true/false), you_go_first = (false/true) ... notice that there's no 'dot/period' connector (no 'Object_name.Attribute_name = Value_or_Expression' structure, only 'Variable_name = Value_or_Expression' structure)
-> (2) Attributes, examples: player.strength = 100, player.alias = "HK", game.state = 0, game.dragon_killed = false, game.dragon_killed = true, player.right_hand = sword, weapon.damage = 10, player.weapon.damage = 10, player.damage = player.damage + player.damage * player.strength / 100 ... notice that it has the 'dot/period' connector (uses the 'Object_name.Attribute_name = Value_or_Expression' structure, by having an Object containing that Attribute, this makes it permanent (so long as the Object exists of course), which makes it global, it's 'saveable' and thus 'loadable', anywhere in your game (again, so long as the Object exists)
-> (3) Parameters: deals with Functions/Commands/Etc
------------------
The GameBook doesn't have the ability to create/add Attributes through the non-scripting GUI~Editor, like the TextAdventure does, but let's look at it, as it hopefully will help you understand the scripting better...
in the Text Adventure's GUI~Editor, you can initially create/set ("add") Attributes like this, an example:
'player' Player Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)
(Object Name: player)
Attribute Name: strength
Attribute Type: int (integer)
Attribute Value: 100
which is the same as this in GUI~Editor scripting (same for both Text Adventure and Game Book):
set variable player.strength = [EXPRESSON] 100
// quest can tell what the Attribute Type is by the Value
and in-code (game code), looks like this (the above two methods, just creates the 'attr' (Attribute) code line in this small part, the 'player' Player Object, of your game code below):
<object name="player">
<attr name="strength" type="int">100</attr>
</object>
--------
conceptual example of the Containment/Child-Parent heirarchy (OOP/OOD: Object-Oriented Programmming/Design):
http://docs.textadventures.co.uk/quest/ ... arent.html
^^^^^
http://docs.textadventures.co.uk/quest/ ... bject.html
^^^^^^
http://docs.textadventures.co.uk/quest/elements/
^^^^^
http://docs.textadventures.co.uk/quest/
(more parent)
C:\\ (drive)
-> Programs (folder)
->-> Quest (folder)
->->-> quest.exe (file)
(more child)
as scripting:
C.Programs.Quest.quest
the 'quest.exe' File is contained within the 'Quest' Folder
the 'Quest' Folder is contained within the 'Programs' Folder
the 'Programs' Folder is contained within the 'C' Drive
(more parent)
HK
-> pants
->-> wallet
->->-> $1
(more child)
(more parent)
grandfather
-> father
->-> son
->->-> grandson
(more child)
'grandfather' is the main (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'
grandfather.parent = null
father.parent = grandfather
son.parent = father
grandson.parent = son
<object name="grandfather">
<object name="father">
<object name="son">
<object name="grandson">
</object>
</object>
</object>
</object>
what if I added this script below? how does the heirarchy change? :
grandson.parent = grandfather
~OR this script~
MoveObject (grandson, grandfather)
// http://docs.textadventures.co.uk/quest/ ... bject.html
answer:
<object name="grandfather">
<object name="grandson">
</object>
<object name="father">
<object name="son">
</object>
</object>
</object>
and then again:
son.parent = grandson
~OR~
MoveObject (son, grandson)
answer:
<object name="grandfather">
<object name="grandson">
<object name="son">
</object>
</object>
<object name="father">
</object>
</object>
I'm not sure if the GameBook uses 'goto' for its Script for moving the 'player' Player Object from one Page Object to another Page Object ... too lazy to open up a Game Book game and see what word/name/label it is for its Script, lol. I think the 'parent' Object Attribute works/exists in Game Book, but I could be wrong (maybe it doesn't).
-------
see... the 'Object' Element is a container that holds Attributes and/or other Objects
either you use the GUI~Editor (not available in Game Book) to "add" Attributes to be contained within the 'Object' Element or you use the GUI~Editor scripting (available in both Text Adventure and Game Book) to 'attach/connect' (via using that dot/period) the Attribute to be contained within the 'Object' element or you do it directly via in-code (not using the GUI~Editor at all).
there are other containers (Elements) too:
Functions: they contain scripting only
Commands: .....
Turnscripts: .....
Timers: ....
etc etc etc ( http://docs.textadventures.co.uk/quest/elements/ )
TheDetails
01 Jun 2016, 15:09All of the answers to my questions required a bit more searching on my part (isn't that always the case). I gave up after a day of looking into it and posted here, but after two more days of tinkering and refining searches (and sometimes just stumbling onto something so painfully obvious I'm seriously questioning my intelligence that I missed it for so long) and with the fine user's help above, these are the specific, quite ugly, working answers to my original questions (in case some noob like me is looking at how to do this crap in a Gamebook).
• If you want the reader to be able to type in some text in a gamebook page (it's called an input), and then return a message or new page link depending on what they typed in (this is if you do it in 'code view', all this is handled through snazzy drop down menus, too, where the 'elses' are handled by expressions, and that's where you type result="whatever"), the general idea is this:
GetInput() {
if (result="hello") {
msg ("Why, hello.")
}
else if (result="Hello") {
msg ("Why, hello.")
}
else if (result="HELLO") {
msg ("Why, hello.")
}
else {
msg ("Nope")
}
}
Instead of the 'msgs,' you could give them a new page link with AddPageLink (From Page Name Here, To Page Name Here, "Page Link Text Here"), or whatever you like. The 'else ifs' are just my very ugly way of covering different ways the user might type hello (I couldn't figure out how to put multiple results in one result="" line). The 'else' leading to the msg "Nope" is the 'incorrect answer' placeholder (if they type anything but the predefined results), again leading to a new page if you like.
• Displaying a counter to the player is infinitely easy and handled in the text processor and for some reason I couldn't find it for days on end (and I'm questioning my sanity because of it). Simply type {counter:CounterNameHere}. Seriously. That's it. So if you set a counter called Health to 30, and every time you hit the player in the head with a rock they lose 5 hit points (by using "Change counter" in the Add Script Command menu) and you want it to say so, simply type, directly into the text field:
{counter:Health}
And you'll want to put it in the middle of a sentence, so it reads smoothly for the player:
You get hit in the head with a rock for 5 Health.
You now have {counter:Health} remaining.
• My last question was getting things to "react" to the counters. In Gamebook mode, it's all handled neatly and easily in drop downs. Here's an example:

What it's saying there is "if the counter named Speechcraft is equal to or greater than 1, add the page link to Taking a stand (the current page) to the page Speechcraft check1 (where they will fail or succeed in their speechcraft check), and here is the text to display for that link."
Whew. Easy-peasy.
Ok next question: How do I make a link that returns the player to the previous page they were on? I can't find code for that.
• If you want the reader to be able to type in some text in a gamebook page (it's called an input), and then return a message or new page link depending on what they typed in (this is if you do it in 'code view', all this is handled through snazzy drop down menus, too, where the 'elses' are handled by expressions, and that's where you type result="whatever"), the general idea is this:
GetInput() {
if (result="hello") {
msg ("Why, hello.")
}
else if (result="Hello") {
msg ("Why, hello.")
}
else if (result="HELLO") {
msg ("Why, hello.")
}
else {
msg ("Nope")
}
}
Instead of the 'msgs,' you could give them a new page link with AddPageLink (From Page Name Here, To Page Name Here, "Page Link Text Here"), or whatever you like. The 'else ifs' are just my very ugly way of covering different ways the user might type hello (I couldn't figure out how to put multiple results in one result="" line). The 'else' leading to the msg "Nope" is the 'incorrect answer' placeholder (if they type anything but the predefined results), again leading to a new page if you like.
• Displaying a counter to the player is infinitely easy and handled in the text processor and for some reason I couldn't find it for days on end (and I'm questioning my sanity because of it). Simply type {counter:CounterNameHere}. Seriously. That's it. So if you set a counter called Health to 30, and every time you hit the player in the head with a rock they lose 5 hit points (by using "Change counter" in the Add Script Command menu) and you want it to say so, simply type, directly into the text field:
{counter:Health}
And you'll want to put it in the middle of a sentence, so it reads smoothly for the player:
You get hit in the head with a rock for 5 Health.
You now have {counter:Health} remaining.
• My last question was getting things to "react" to the counters. In Gamebook mode, it's all handled neatly and easily in drop downs. Here's an example:

What it's saying there is "if the counter named Speechcraft is equal to or greater than 1, add the page link to Taking a stand (the current page) to the page Speechcraft check1 (where they will fail or succeed in their speechcraft check), and here is the text to display for that link."
Whew. Easy-peasy.
Ok next question: How do I make a link that returns the player to the previous page they were on? I can't find code for that.
HegemonKhan
01 Jun 2016, 20:48as for the multiple (cap versions of) 'hellos', I'm not sure if Game Book has this, but there's:
http://docs.textadventures.co.uk/quest/functions/ (scroll down to the very bottom, to the 'String Function' category/section)
specifically:
http://docs.textadventures.co.uk/quest/ ... lcase.html
what you'd do is this:
what this does is this:
whether I typed in: hello, HELLO, Hello, HeLlO, etc etc etc combinations of upper/lower caps
the 'LCase(result)' takes the Value (be it: see line above) stored in 'result', and makes ALL of the characters/letters of it, LOWER CASE
so regardless of what upper/lower case combination I did of 'hello', let's say an all upper case: "HELLO", it'll convert that into an all lower case: "hello"
and then this all lower case "hello" is compared to "hello", which it matches (is true), and thus the nested (indented/conained) scripts run for it (the 'if' line, as the condition: if ("hello" = "hello"), was met/TRUE).
-------
you can also use 'and' and/or 'or' logic in the same line too (though this isn't as good as the LCase/UCase, when dealing with unknown lower/upper case of inputs by people playing the game):
https://en.wikipedia.org/wiki/Truth_table (scroll down to the 'logical AND' and 'logical OR' sections, or read the whole thing if interested in it, lol)
http://docs.textadventures.co.uk/quest/functions/ (scroll down to the very bottom, to the 'String Function' category/section)
specifically:
http://docs.textadventures.co.uk/quest/ ... lcase.html
what you'd do is this:
// etc/blah scripts
get input {
if (LCase (result) = "hello") { /* scripts */ }
// blah scripts
}
// etc 'else ifs' and/or an 'else' if needed/wanted
}
// etc/blah scripts
what this does is this:
whether I typed in: hello, HELLO, Hello, HeLlO, etc etc etc combinations of upper/lower caps
the 'LCase(result)' takes the Value (be it: see line above) stored in 'result', and makes ALL of the characters/letters of it, LOWER CASE
so regardless of what upper/lower case combination I did of 'hello', let's say an all upper case: "HELLO", it'll convert that into an all lower case: "hello"
and then this all lower case "hello" is compared to "hello", which it matches (is true), and thus the nested (indented/conained) scripts run for it (the 'if' line, as the condition: if ("hello" = "hello"), was met/TRUE).
-------
you can also use 'and' and/or 'or' logic in the same line too (though this isn't as good as the LCase/UCase, when dealing with unknown lower/upper case of inputs by people playing the game):
https://en.wikipedia.org/wiki/Truth_table (scroll down to the 'logical AND' and 'logical OR' sections, or read the whole thing if interested in it, lol)
if (result = "hello" or result = "HELLO" or result = "Hello" or result = "HeLlO" or result = "hElLo" or .... etc combinations ....) {
msg ("ah, thank you for saying hello, let me return the greeting to you: hello, what is your name?")
} else if (LCase (result) = "hk") {
msg ("oh, wow, I can't believe I'm speaking to the amazing HK! This is so cool! can I have your autograph?")
} else if (LCase (result) = "john doe") {
msg ("hmm, I never heard of you...")
} else {
msg ("wrong input, try again")
}
HegemonKhan
01 Jun 2016, 21:09P.S.
there's another new person, using the Game Book too, and that thread of his/her addresses returning to a previous page.
viewtopic.php?f=10&t=6068 (lol... "Enhanced Game Book" vs "Game Book Resources" as thread titles, lol)
(the basic idea is that you've got to store the previous page's name in an Attribute, which you can then use to, goto/go-back-to, that page)
(before you go to a new page, you need to store the current page that you're in/on as this will become 'the previous page' when you goto a different page)
previous page: Page1
current page: Page1
goto Page2
previous page: Page1
current page: page2
goto Page3
previous page: Page2
current page: Page3
pseudo-code wise:
// you're in/on Page1:
player.previous_page = player.parent // storing the page you're in/on (Page1) into a 'previous page' Attribute
player.current_page = player.parent // storing the page you're in/on (Page2) into a 'current page' Attribute
// you goto Page2:
player.previous_page = player.current_page // storing the 'current page' Attribute's Value (Page1) into the 'previous page' Attribute
// and *THEN* (AFTER storing the the old page, Page1, into the 'previous page' Attribute) we now can update the 'current page' Attribute (from the old page, Page1) to the new current page (Page2) we're now currently in/on:
player.current_page = player.parent // storing the page you're in/on into a 'current page' Attribute (changing the stored 'current page' Attribute's Value from Page1 to Page2)
// you goto Page3:
player.previous_page = player.current_page // storing the 'current page' Attribute's Value (Page2) into the 'previous page' Attribute
// and *THEN* (AFTER storing the the old page, Page2, into the 'previous page' Attribute) we now can update the 'current page' Attribute (from Page2) to the new current page (Page3) we're now currently in/on:
player.current_page = player.parent // storing the page you're in/on into a 'current page' Attribute (changing the stored 'current page' Attribute's Value from Page2 to Page3)
there's another new person, using the Game Book too, and that thread of his/her addresses returning to a previous page.
viewtopic.php?f=10&t=6068 (lol... "Enhanced Game Book" vs "Game Book Resources" as thread titles, lol)
(the basic idea is that you've got to store the previous page's name in an Attribute, which you can then use to, goto/go-back-to, that page)
(before you go to a new page, you need to store the current page that you're in/on as this will become 'the previous page' when you goto a different page)
previous page: Page1
current page: Page1
goto Page2
previous page: Page1
current page: page2
goto Page3
previous page: Page2
current page: Page3
pseudo-code wise:
// you're in/on Page1:
player.previous_page = player.parent // storing the page you're in/on (Page1) into a 'previous page' Attribute
player.current_page = player.parent // storing the page you're in/on (Page2) into a 'current page' Attribute
// you goto Page2:
player.previous_page = player.current_page // storing the 'current page' Attribute's Value (Page1) into the 'previous page' Attribute
// and *THEN* (AFTER storing the the old page, Page1, into the 'previous page' Attribute) we now can update the 'current page' Attribute (from the old page, Page1) to the new current page (Page2) we're now currently in/on:
player.current_page = player.parent // storing the page you're in/on into a 'current page' Attribute (changing the stored 'current page' Attribute's Value from Page1 to Page2)
// you goto Page3:
player.previous_page = player.current_page // storing the 'current page' Attribute's Value (Page2) into the 'previous page' Attribute
// and *THEN* (AFTER storing the the old page, Page2, into the 'previous page' Attribute) we now can update the 'current page' Attribute (from Page2) to the new current page (Page3) we're now currently in/on:
player.current_page = player.parent // storing the page you're in/on into a 'current page' Attribute (changing the stored 'current page' Attribute's Value from Page2 to Page3)
TheDetails
01 Jun 2016, 22:23We should merge the two threads into Enhanced Gamebook Resources!
I've done just about every combination I can think of with your code. The best I can get it to work, it works exactly as before: stacking up Back links based on however many times I've gone to the Inventory page.
To be clear, let's say we have Page1, Page2 and Page3:
Page1 is a page in the story, "You're fighting a million orcs while riding a war pony."
on Page 1 you have the option to Check your inventory, which will take you to Page2.
Page2 is your inventory, with a backlink to the previous page, which is Page 1.
Page 3, which you get to from Page 1, is the next page in the story where you are allowed to check your inventory again, "You're fighting TWO million orcs now, but you're still riding a war pony."
On this page, Page3, you have the ability to check you inventory again, which goes to Page 2, which is the inventory page.
This time the back link on Page2 sends back you to Page3.
I believe I'm not following what you're saying, so I'm putting hunks of code in the wrong places, because of the Page1, Page2, Page3 analogy, and also because I'm dumb as dirt. But no matter the combination I put everything in, either the back links pile up, or it doesn't work at all.
I should clarify: no matter what combinations of:
player.previous_page = player.parent
player.current_page = player.parent
I put on whichever page.
I've done just about every combination I can think of with your code. The best I can get it to work, it works exactly as before: stacking up Back links based on however many times I've gone to the Inventory page.
To be clear, let's say we have Page1, Page2 and Page3:
Page1 is a page in the story, "You're fighting a million orcs while riding a war pony."
on Page 1 you have the option to Check your inventory, which will take you to Page2.
Page2 is your inventory, with a backlink to the previous page, which is Page 1.
Page 3, which you get to from Page 1, is the next page in the story where you are allowed to check your inventory again, "You're fighting TWO million orcs now, but you're still riding a war pony."
On this page, Page3, you have the ability to check you inventory again, which goes to Page 2, which is the inventory page.
This time the back link on Page2 sends back you to Page3.
I believe I'm not following what you're saying, so I'm putting hunks of code in the wrong places, because of the Page1, Page2, Page3 analogy, and also because I'm dumb as dirt. But no matter the combination I put everything in, either the back links pile up, or it doesn't work at all.
I should clarify: no matter what combinations of:
player.previous_page = player.parent
player.current_page = player.parent
I put on whichever page.
HegemonKhan
01 Jun 2016, 23:07see, the other thread... I just posted hopefully a solution... or at least a near solution (my code/instructions/design might be wrong and/or have some mistakes in it) ...
HK edit, here it is:
.
sorry... took a bit more than 10 minutes... lol...
----------
okay... this is a bit complex... not sure if I can explain/guide well enough for you to follow along... I'll try but you may have to wait for someone who can explain and guide you through it better than I...
the built-in page linking, actually uses String Dictionary Attributes:
http://docs.textadventures.co.uk/quest/ ... aries.html
http://docs.textadventures.co.uk/quest/ ... onary.html
http://docs.textadventures.co.uk/quest/ ... y_add.html
http://docs.textadventures.co.uk/quest/ ... emove.html
new game code (sample part) of the built-in String Dictionary Attribute that the page linking uses:
the good news is that it seems to have the same functionality as the Text Adventure... as I think I tested it correctly, getting it to work, but the bad news is that dictionaries are a bit more confusing than lists, and also this entire endeavor requires a bit of setup... hopefully you can follow along... HK crosses his fingers... as he's not good at explaining/guiding... lol
(I used red font to indicate it's what you type in into the text boxes)
'game' Game Object -> 'Script' Tab -> 'script when entering page' Script -> (see below)
add new script -> variables -> 'set a variable or attribute' Script -> [expression] -> (see below)
set variable player.previous_page = [expression] player.current_page
add new script -> variables -> 'set a variable or attribute' Script -> [expression] -> (see below)
set variable player.current_page = [expression] player.parent
add new script -> scripts -> 'if' Script -> [expression] -> (see below)
if [expression] player.current_page = Inventory
then,
-> add new script -> variables -> 'set a variable or attribute' Script -> [expression] -> (see below)
set variable player.parent.options = [expression] NewStringDictionary()
-> add new script -> 'add to dictionary' Script -> (see below)
Add to dictionary player.parent.options Key [expression] player.previous_page.name [EditorScriptsVariablesvalue] [expression] player.previous_page
and lastly, you also of course got to setup the 'current_page' and 'previous_page' Attributes on your 'player' Player Object, unless you can go into the code directly and know how to work with it, this means that you're going to need to use your first page, to set these Attributes on your 'player' Player Object. Hopefully, you won't get an error at the start of your game... if you do... let me know... as this would mean the 'on enter page' Script in the Game Object is running before your first page's scripts are setting the 'current_page' and 'previous_page' Attributes (which the 'on enter page' needs to be already created/setup, hence the error, if there is one).
--------
hopefully this will work for you..... leaving intact all of your normal page's links... only changing the Inventory Page links (so it is just a single link back to the page that you came from), which is hopefully what you wanted...
HK edit, here it is:
.
sorry... took a bit more than 10 minutes... lol...
----------
okay... this is a bit complex... not sure if I can explain/guide well enough for you to follow along... I'll try but you may have to wait for someone who can explain and guide you through it better than I...
the built-in page linking, actually uses String Dictionary Attributes:
http://docs.textadventures.co.uk/quest/ ... aries.html
http://docs.textadventures.co.uk/quest/ ... onary.html
http://docs.textadventures.co.uk/quest/ ... y_add.html
http://docs.textadventures.co.uk/quest/ ... emove.html
new game code (sample part) of the built-in String Dictionary Attribute that the page linking uses:
<object name="Page1">
<options name="stringdictionary">
<item>
<key>Page2</key>
<value>This link goes to page 2</value>
</item>
<item>
<key>Page3</key>
<value>This link goes to page 3</value>
</item>
</options>
</object>
the good news is that it seems to have the same functionality as the Text Adventure... as I think I tested it correctly, getting it to work, but the bad news is that dictionaries are a bit more confusing than lists, and also this entire endeavor requires a bit of setup... hopefully you can follow along... HK crosses his fingers... as he's not good at explaining/guiding... lol
(I used red font to indicate it's what you type in into the text boxes)
'game' Game Object -> 'Script' Tab -> 'script when entering page' Script -> (see below)
add new script -> variables -> 'set a variable or attribute' Script -> [expression] -> (see below)
set variable player.previous_page = [expression] player.current_page
add new script -> variables -> 'set a variable or attribute' Script -> [expression] -> (see below)
set variable player.current_page = [expression] player.parent
add new script -> scripts -> 'if' Script -> [expression] -> (see below)
if [expression] player.current_page = Inventory
then,
-> add new script -> variables -> 'set a variable or attribute' Script -> [expression] -> (see below)
set variable player.parent.options = [expression] NewStringDictionary()
-> add new script -> 'add to dictionary' Script -> (see below)
Add to dictionary player.parent.options Key [expression] player.previous_page.name [EditorScriptsVariablesvalue] [expression] player.previous_page
and lastly, you also of course got to setup the 'current_page' and 'previous_page' Attributes on your 'player' Player Object, unless you can go into the code directly and know how to work with it, this means that you're going to need to use your first page, to set these Attributes on your 'player' Player Object. Hopefully, you won't get an error at the start of your game... if you do... let me know... as this would mean the 'on enter page' Script in the Game Object is running before your first page's scripts are setting the 'current_page' and 'previous_page' Attributes (which the 'on enter page' needs to be already created/setup, hence the error, if there is one).
--------
hopefully this will work for you..... leaving intact all of your normal page's links... only changing the Inventory Page links (so it is just a single link back to the page that you came from), which is hopefully what you wanted...

XanMag
01 Jun 2016, 23:28I have a solution!! Make it a Text adventure and not a gamebook. Lol
In all seriousness, there is a library, I believe, that you can use that makes a TA LOOK like a gamebook if that is what you want. TAs really aren't that hard to create especially if you stick to the basics, which are essentially a GB with more flexibility. Just a thought.
In all seriousness, there is a library, I believe, that you can use that makes a TA LOOK like a gamebook if that is what you want. TAs really aren't that hard to create especially if you stick to the basics, which are essentially a GB with more flexibility. Just a thought.
HegemonKhan
01 Jun 2016, 23:31TheDetails wrote:I should clarify: no matter what combinations of:
player.previous_page = player.parent
player.current_page = player.parent
I put on whichever page.
don't get frustrated... you can have the code design perfect... but you made one little typo/spelling mistake... coding is very picky... so if something is not working... it doesn't necessarily mean that you're totally far off from getting it to work, but of course you can also be very far off from getting it to work, too, lol. The problem is in knowing whether you're far off or close... laughs.
If you don't know how to code well... it's better to stay out of it, as if you mess up, we'll then need you to post your game code, find and clean up your mess up, and then help you get it setup/coded-in correctly... wait for others instead, as they'll give you better or more direct help/game file, whereas I just post code, often confusing everyone, sighs.
anyways, this is my mistake, not yours...
it should be this instead (I'll red font the change) for EVERY PAGE (except your first page):
player.previous_page = player.current_page
player.current_page = player.parent
the first page, needs to set the 'previous_page' to the name of your first page (which I did by using 'player.parent', but this caused you confusion, as for all the other pages, you need it to be 'player.previous_page = player.current_page')
the logic is a bit difficult to explain for me... hmm...
when you start, either:
1. you don't have a 'previous page' stored
or
2. your 'previous_page' stored is the same as your 'current_page' stored
but once you move around after your starting position/page, the 'previous_page' and 'current_page' will no longer remain being the same page, as that's the whole point of setting up these two Attributes, one to store the old previous page, and the other to store the new current page, and upon switching pages, this enables you to now transfer what was the current page (still stored in 'current_page') into the 'previous_page' as it is now the previous page as you've moved to a new page, and once you do that, then you can store the new page you're currently in, into the 'current_page', so that when you move again, you can repeat this transference, thus enabling this system, of storing the correct previous page, each time you move from page to page.
as can be seen, the logic is quite a bit advanced and complex, it takes some time to grasp, this type of logic needed for doing things in a game (with making a game work as you want).
TheDetails
02 Jun 2016, 15:47I'm almost there, I think. I entered all that fun stuff into the 'game' page. In the next post you say to add this to every page except the first page of the game book
player.previous_page = player.current_page
player.current_page = player.parent
Correct?
Next you say "the first page needs to set the 'previous_page' to the name of your first page". So if the name of my first page is, for instance, "Start", do you mean put this on my first page?
player.Start = player.current_page
player.current_page = player.parent
Certainly I'm missing something again. When I try various combinations, I get this error when trying to return from the Inventory page:
Error running script: Error adding key 'Example Page Name' to dictionary: Unable to cast object of type 'TextAdventures.Quest.Element' to type 'System.String'.
My game page script is:
player.previous_page = player.current_page
player.current_page = player.parent
if (player.current_page = Inventory) {
player.parent.options = NewStringDictionary()
dictionary add (player.parent.options, player.previous_page.name, player.previous_page)
}
player.previous_page = player.current_page
player.current_page = player.parent
Correct?
Next you say "the first page needs to set the 'previous_page' to the name of your first page". So if the name of my first page is, for instance, "Start", do you mean put this on my first page?
player.Start = player.current_page
player.current_page = player.parent
Certainly I'm missing something again. When I try various combinations, I get this error when trying to return from the Inventory page:
Error running script: Error adding key 'Example Page Name' to dictionary: Unable to cast object of type 'TextAdventures.Quest.Element' to type 'System.String'.
My game page script is:
player.previous_page = player.current_page
player.current_page = player.parent
if (player.current_page = Inventory) {
player.parent.options = NewStringDictionary()
dictionary add (player.parent.options, player.previous_page.name, player.previous_page)
}
HegemonKhan
03 Jun 2016, 00:46if you use my game page scripting, then you do *NOT* need to manually place the:
player.previous_page = player.current_page
player.current_page = player.parent
in each page, as that is what my game page scripting is doing for you:
(the 'game' Game Object's 'on enter page' Script will run these scripts every time you goto a page)
player.previous_page = player.current_page
player.current_page = player.parent
if (player.current_page = Inventory) {
player.parent.options = NewStringDictionary()
dictionary add (player.parent.options, player.previous_page.name, player.previous_page)
}
-------
hopefully... the only other matter is in creating/adding (and initially setting: player.previous_page = name_of_your_first_page, player.current_page = name_of_your_first_page) those Attributes. If you can work with code, then you'll not have any error, as you coded in the Attributes already, but if you add those Attributes using your first page's 'add new scripts', you may get an error, if quest runs the 'on enter page' Script before the first page scripts run.
if you don't know how to work with the code, then try this:
'whatever name of your first page' Page Object -> Page Type: [scripts] or [scripts+text] -> add new script -> (see below, repeat for 2nd attribute-script)
set variable player.previous_page = [expression] name_of_your_first_page
set variable player.current_page = [expression] name_of_your_first_page
~ or (they're the same thing) ~
set variable player.previous_page = [expression] player.parent
set variable player.current_page = [expression] player.parent
...actually... the above will wipe out your stored previous room, if you're able to go back to your first page... messing up being able to go back to the previous page... so, the easiest thing would be if you can design your game so you're never linking back to your first page (making it like a page 0 that goes to page 1, which other pages can link back to page 1, but not your 'page 0' first page), otherwise, the next easist method is to use the 'firsttime/otherwise' Script Function (if the Game Book has it), as this way you can do this (in code - don't know where to find it in the GUI~Editor's script options):
http://docs.textadventures.co.uk/quest/ ... ttime.html
http://docs.textadventures.co.uk/quest/ ... sited.html
firsttime: pageX.visited = false
otherwise: pageX.visited = true
as this would have those scripts only run at the very start of the game, and NOT run upon returning to the first page
--------
and if everything else of my code works, let me know if you get an error or not
if you do, then I can help you to just put/give/write those Attributes directly in code to/onto/into the 'player' Player Object
----------
I don't have the time right now... but soon as I do (hopefully on the weekend), I'll upload/post a sample game for you of it working, so you can use it to see how it's done, compared to my haphzard attempt at trying to explain it through my posts.
player.previous_page = player.current_page
player.current_page = player.parent
in each page, as that is what my game page scripting is doing for you:
(the 'game' Game Object's 'on enter page' Script will run these scripts every time you goto a page)
player.previous_page = player.current_page
player.current_page = player.parent
if (player.current_page = Inventory) {
player.parent.options = NewStringDictionary()
dictionary add (player.parent.options, player.previous_page.name, player.previous_page)
}
-------
hopefully... the only other matter is in creating/adding (and initially setting: player.previous_page = name_of_your_first_page, player.current_page = name_of_your_first_page) those Attributes. If you can work with code, then you'll not have any error, as you coded in the Attributes already, but if you add those Attributes using your first page's 'add new scripts', you may get an error, if quest runs the 'on enter page' Script before the first page scripts run.
if you don't know how to work with the code, then try this:
'whatever name of your first page' Page Object -> Page Type: [scripts] or [scripts+text] -> add new script -> (see below, repeat for 2nd attribute-script)
set variable player.previous_page = [expression] name_of_your_first_page
set variable player.current_page = [expression] name_of_your_first_page
~ or (they're the same thing) ~
set variable player.previous_page = [expression] player.parent
set variable player.current_page = [expression] player.parent
...actually... the above will wipe out your stored previous room, if you're able to go back to your first page... messing up being able to go back to the previous page... so, the easiest thing would be if you can design your game so you're never linking back to your first page (making it like a page 0 that goes to page 1, which other pages can link back to page 1, but not your 'page 0' first page), otherwise, the next easist method is to use the 'firsttime/otherwise' Script Function (if the Game Book has it), as this way you can do this (in code - don't know where to find it in the GUI~Editor's script options):
http://docs.textadventures.co.uk/quest/ ... ttime.html
http://docs.textadventures.co.uk/quest/ ... sited.html
firsttime: pageX.visited = false
otherwise: pageX.visited = true
firsttime {
set variable player.previous_page = [expression] player.parent
set variable player.current_page = [expression] player.parent
}
as this would have those scripts only run at the very start of the game, and NOT run upon returning to the first page
--------
and if everything else of my code works, let me know if you get an error or not
if you do, then I can help you to just put/give/write those Attributes directly in code to/onto/into the 'player' Player Object
----------
I don't have the time right now... but soon as I do (hopefully on the weekend), I'll upload/post a sample game for you of it working, so you can use it to see how it's done, compared to my haphzard attempt at trying to explain it through my posts.
HegemonKhan
03 Jun 2016, 01:30P.S.
I'm not sure exactly what is causing this error:
Error running script: Error adding key 'Example Page Name' to dictionary: Unable to cast object of type 'TextAdventures.Quest.Element' to type 'System.String'.
a guess of mine:
possibly did you do something like this in your game:
player.parent.options = NewStringDictionary ()
dictionary add (Inventory, page99, Back)
and I think it'd need to be this:
player.parent.options = NewStringDictionary ()
dictionary add (Inventory, "page99", "Back")
~or~
dictionary add (Inventory, page99.name, "Back")
------
or, another guess of mine:
if you did this, it might be wrong:
dictionary add (player.parent.options, player.previous_page.name, player.previous_page)
change it to this:
dictionary add (player.parent.options, player.previous_page.name, player.previous_page.name)
~or~
dictionary add (player.parent.options, player.previous_page.name, "back")
~or~
whatever you want
-------
if you chose/did this:
player.parent.options = NewObjectDictionary ()
then, I think you'd do this:
dictionary add (Inventory, page99, "Back")
-----
if the Value has double quotes, it's a String Value (and thus the Attribute must be a String Attribute), for examples:
player.condition = "poisoned" // poisoned is a string, and the Attribute is a String Attribute
game.state = "0" // the 0-zero is a string, not an integer amount... and the Attribute is a String Attribute, not an Integer (int) Attribute
// game.state = game.state + 5 -> ERROR, can't add a string value and an int value together (example: "M"+5 = does not exist)
vs
game.state = 0 // the 0-zero is an integer, not a string ... and the Attribute is an Integer (int) Attribute, not a String Attribute
// game.state = game.state + 5 -> 0+5 = 5 -> game.state = 5
player.right_hand = "sword" // sword is just a string (text), it's not refering to an actual Object, and the Attribute is a String Attribute.
// NO error
vs
<object name="sword">
</object>
player.right_hand = sword // sword is an actual Object('s name), and the Attribute is an Object Attribute
// NO error
vs
player.right_hand = sword // sword is an actual Object('s name), and the Attribute is an Object Attribute
// ERROR, there is no existing/created 'sword' Object
the except to a Value which doesn't have the double quotes, NOT being an Object Value, the special/reserved keywords of:
'true' and 'false', as these are applied for a Boolean Attribute's values
orc.dead = true // true is NOT an actual Object, the Attribute is a Boolean Attribute, not an Object Attribute
orc.dead = false // false is NOT an actual Object, the Attribute is a Boolean Attribute, not an Object Attribute
------------
i used this part for testing (see the bolded part below), as it shows the name of the previous page (page1..2..3) so I could see if it was working or not:
dictionary add (player.parent.options, player.previous_page.name, player.previous_page.name)
but you can do this instead if you want:
dictionary add (player.parent.options, player.previous_page.name, "back")
~or~
dictionary add (player.parent.options, player.previous_page.name, "previous page")
~or~
whatever you want it, the link, to be displayed/named/labeled/shown as, lol
I'm not sure exactly what is causing this error:
Error running script: Error adding key 'Example Page Name' to dictionary: Unable to cast object of type 'TextAdventures.Quest.Element' to type 'System.String'.
a guess of mine:
possibly did you do something like this in your game:
player.parent.options = NewStringDictionary ()
dictionary add (Inventory, page99, Back)
and I think it'd need to be this:
player.parent.options = NewStringDictionary ()
dictionary add (Inventory, "page99", "Back")
~or~
dictionary add (Inventory, page99.name, "Back")
------
or, another guess of mine:
if you did this, it might be wrong:
dictionary add (player.parent.options, player.previous_page.name, player.previous_page)
change it to this:
dictionary add (player.parent.options, player.previous_page.name, player.previous_page.name)
~or~
dictionary add (player.parent.options, player.previous_page.name, "back")
~or~
whatever you want
-------
if you chose/did this:
player.parent.options = NewObjectDictionary ()
then, I think you'd do this:
dictionary add (Inventory, page99, "Back")
-----
if the Value has double quotes, it's a String Value (and thus the Attribute must be a String Attribute), for examples:
player.condition = "poisoned" // poisoned is a string, and the Attribute is a String Attribute
game.state = "0" // the 0-zero is a string, not an integer amount... and the Attribute is a String Attribute, not an Integer (int) Attribute
// game.state = game.state + 5 -> ERROR, can't add a string value and an int value together (example: "M"+5 = does not exist)
vs
game.state = 0 // the 0-zero is an integer, not a string ... and the Attribute is an Integer (int) Attribute, not a String Attribute
// game.state = game.state + 5 -> 0+5 = 5 -> game.state = 5
player.right_hand = "sword" // sword is just a string (text), it's not refering to an actual Object, and the Attribute is a String Attribute.
// NO error
vs
<object name="sword">
</object>
player.right_hand = sword // sword is an actual Object('s name), and the Attribute is an Object Attribute
// NO error
vs
player.right_hand = sword // sword is an actual Object('s name), and the Attribute is an Object Attribute
// ERROR, there is no existing/created 'sword' Object
the except to a Value which doesn't have the double quotes, NOT being an Object Value, the special/reserved keywords of:
'true' and 'false', as these are applied for a Boolean Attribute's values
orc.dead = true // true is NOT an actual Object, the Attribute is a Boolean Attribute, not an Object Attribute
orc.dead = false // false is NOT an actual Object, the Attribute is a Boolean Attribute, not an Object Attribute
------------
i used this part for testing (see the bolded part below), as it shows the name of the previous page (page1..2..3) so I could see if it was working or not:
dictionary add (player.parent.options, player.previous_page.name, player.previous_page.name)
but you can do this instead if you want:
dictionary add (player.parent.options, player.previous_page.name, "back")
~or~
dictionary add (player.parent.options, player.previous_page.name, "previous page")
~or~
whatever you want it, the link, to be displayed/named/labeled/shown as, lol
TheDetails
03 Jun 2016, 17:02What's the quote, "if a given technology is sufficiently advanced it will appear as magic?"
It worked like a charm. My last problem was not naming the "Back" link in quotes, and I still had redundant code on the Inventory page itself that I forgot to remove. Now it's all handled from that add to dictionary thing you made for me on the 'game' page. Amazing. I'm humbled! Now my players can look at how many pieces of wyvern jerky they have in their rucksacks anytime they want in a game book (as opposed to a text adventure, which a another user rightfully mentioned I should probably just have been using in the first place). But it's nice to have this added layer of functionality to the lesser-used game book mode.
You wrote some really helpful stuff in your last couple of posts just about concepts in general, like what does what and why. It's really helpful for someone like me who doesn't really 'get' code, but isn't afraid to screw around with it until it starts making sense. I really, really appreciate it!
It worked like a charm. My last problem was not naming the "Back" link in quotes, and I still had redundant code on the Inventory page itself that I forgot to remove. Now it's all handled from that add to dictionary thing you made for me on the 'game' page. Amazing. I'm humbled! Now my players can look at how many pieces of wyvern jerky they have in their rucksacks anytime they want in a game book (as opposed to a text adventure, which a another user rightfully mentioned I should probably just have been using in the first place). But it's nice to have this added layer of functionality to the lesser-used game book mode.
You wrote some really helpful stuff in your last couple of posts just about concepts in general, like what does what and why. It's really helpful for someone like me who doesn't really 'get' code, but isn't afraid to screw around with it until it starts making sense. I really, really appreciate it!
HegemonKhan
04 Jun 2016, 00:56laughs, most people just get more confused by my posts, so if you understood/got something out of them, bravo, lol. Glad I could be of help for once!
if you don't get stuff, speak up, though I'll probably fail again to make it more clear, as I try to help make it more understandable for people.
--------
if you're interested, I have a post trying (failing) to help people with understanding the big-main fundamentals of programming, Attributes and the 'if' Script:
viewtopic.php?f=18&t=5559
good luck trying to understand it though...
Pixie (and Jay and many others) has many and much more clearer threads/posts/libraries/etc that you can read, to learn more.
-----
also, this post might be of some help to you too:
viewtopic.php?f=10&t=6381&p=43259#p43250
------
coding isn't too hard to learn (it's easier than people think it is), but it is a very slow process to learn it, as it's a lot of training of your brain to think in a way that it's never done so before, so it takes some time, but it's not too difficult to learn if you're interested.
if you don't get stuff, speak up, though I'll probably fail again to make it more clear, as I try to help make it more understandable for people.
--------
if you're interested, I have a post trying (failing) to help people with understanding the big-main fundamentals of programming, Attributes and the 'if' Script:
viewtopic.php?f=18&t=5559
good luck trying to understand it though...
Pixie (and Jay and many others) has many and much more clearer threads/posts/libraries/etc that you can read, to learn more.
-----
also, this post might be of some help to you too:
viewtopic.php?f=10&t=6381&p=43259#p43250
------
coding isn't too hard to learn (it's easier than people think it is), but it is a very slow process to learn it, as it's a lot of training of your brain to think in a way that it's never done so before, so it takes some time, but it's not too difficult to learn if you're interested.