Additional attributes

Fathomax
03 Sept 2016, 13:51

Does anyone know how to add in additional attributes in a gamebook? By attributes, I mean numerical values of "mana", "life/HP", etc. If you have played Delight Games or any Quest gamebook which has this feature, you know what I mean. I have only the faintest knowledge of scripting unfortunately so if your solution is presented in script form, mind explaining it too. Thanks.


hegemonkhan
03 Sept 2016, 18:43
with the Game Book, you got to do scripting to add-in/create Attributes, as it doesn't have the full GUI/Editor capabilities that a Text Adventure has.

to do scripting, for 'whatever' Page, you change its 'Page Type' to '[SCRIPT] or [SCRIPT+TEXT]'

if you'setting up your character's stats/attributes, then it's good to use your use your first Page, for this.
(though you don't have to... such as if you want to go through some intro stuff first, before your character-creation / setting up your character stats/attributes)

once you changed your 'whatever' Page's 'Page Type' to '[SCRIPT] or [SCRIPT+TEXT]', you then can click on the 'add new script' button, and then choose what scripts you want to add. This is the exact same as the Text Adventure, though the Game Book has some different scripts and missing Scripts, as the Game Book was made mainly for being a CYOA. If you're going to go heavy into RPG (stat/attribute and etc advanced features: combat/magic/equipment/etc) stuff, you may want to look into using a Text Adventure, or maybe you can use Pixie's hybrid: a Text Adventure that looks like a Game Book, thus you keep/have the full capabilities of quest/Text-Adventure, but it's set up (to look like) as a Game Book.

to create/add/change/alter/manipulate Attributes, you do it like this:

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below for examples)

general syntax format:
set variable OBJECT_NAME.ATTRIBUTE_NAME = [EXPRESSION] VALUE_OR_EXPRESSION

you don't have to choose the '[EXPRESSION]' script option, I do it as it let's me code/type in what I want, and as I don't know the GUI's/Editor's script options, lol

in the Game Book, you ONLY have two Objects to work with: 'player' Player Object and 'game' Game Object
(technically the 'whatever' Pages are Objects too, but I don't think you can add Attributes to them)

just replace my 'OBJECT_NAME' with the name of the Object (player or game)
just replace my 'ATTRIBUTE_NAME' with the name of your (Object's) Attribute
just replace my 'VALUE_OR_EXPRESSION' with what you want

Integer Attributes (life, mana, cash, experience, level, damage/offense/power, defense/resistance/armor_class, strength/endurance/agility/dexterity/etc, etc etc etc):

// OBJECT_NAME: player
// ATTRIBUTE_NAME: current_life
// VALUE_OR_EXPRESSION: 999

set variable player.current_life = [EXPRESSION] 999

-----

// OBJECT_NAME: player
// ATTRIBUTE_NAME: maximum_life
// VALUE_OR_EXPRESSION: 999

set variable player.maximum_life = [EXPRESSION] 999

---

// OBJECT_NAME: player
// ATTRIBUTE_NAME: current_mana
// VALUE_OR_EXPRESSION: 99

set variable player.current_mana = [EXPRESSION] 99

---

// OBJECT_NAME: player
// ATTRIBUTE_NAME: current_mana
// VALUE_OR_EXPRESSION: 99

set variable player.current_mana = [EXPRESSION] 99

---

// OBJECT_NAME: player
// ATTRIBUTE_NAME: cash
// VALUE_OR_EXPRESSION: 0

set variable player.cash = [EXPRESSION] 0

---

// OBJECT_NAME: player
// ATTRIBUTE_NAME: experience
// VALUE_OR_EXPRESSION: 0

set variable player.experience = [EXPRESSION] 0

---

// OBJECT_NAME: player
// ATTRIBUTE_NAME: strength
// VALUE_OR_EXPRESSION: 0

set variable player.strength = [EXPRESSION] 0

---

// OBJECT_NAME: game
// ATTRIBUTE_NAME: state
// VALUE_OR_EXPRESSION: 0

set variable game.state = [EXPRESSION] 0

--

// OBJECT_NAME: game
// ATTRIBUTE_NAME: completed_objectives
// VALUE_OR_EXPRESSION: 0

set variable game.completed_objectives = [EXPRESSION] 0

--

// OBJECT_NAME: game
// ATTRIBUTE_NAME: total_objectives
// VALUE_OR_EXPRESSION: 10

set variable game.total_objectives = [EXPRESSION] 10

------

// OBJECT_NAME: game
// ATTRIBUTE_NAME: orc_current_life
// VALUE_OR_EXPRESSION: 10

set variable game.orc_current_life = [EXPRESSION] 10

------

// OBJECT_NAME: player
// ATTRIBUTE_NAME: weapon_damage
// VALUE_OR_EXPRESSION: 50

set variable player.weapon_damage = [EXPRESSION] 50

------

// OBJECT_NAME: player
// ATTRIBUTE_NAME: damage
// VALUE_OR_EXPRESSION: player.weapon_damage + player.weapon_damage * player.strength / 100

set variable player.damage = [EXPRESSION] player.weapon_damage + player.weapon_damage * player.strength / 100
// player.strength = 100
// player.damage = (50) + (50) * (100) / 100 = (50) + (50) * 1 = (50) + 50 = 100
// player.strength = 50
// player.damage = (50) + (50) * (50) / 100 = (50) + (50) * 0.5 = (50) + 25 = 75 // actually, after all this time, I realize we got an issue: the 50/100 would be 0 (as Integer Attributes truncate: 0.5 -> 0), whoopsy! I'd have to do it differently and/or use Double Attributes (decimal numbers)

-------

String Attributes:

// OBJECT_NAME: player
// ATTRIBUTE_NAME: alias
// VALUE_OR_EXPRESSION: "HK"

set variable player.alias = [EXPRESSION] "HK"

----

// OBJECT_NAME: player
// ATTRIBUTE_NAME: alias
// VALUE_OR_EXPRESSION: "Fathomax"

set variable player.alias = [EXPRESSION] "Fathomax"

----

// OBJECT_NAME: player
// ATTRIBUTE_NAME: condition // status_effects: normal, poisoned, petrified, dead, unconscious, asleep, stunned, silenced, etc
// VALUE_OR_EXPRESSION: "normal"

set variable player.condiction = [EXPRESSION] "normal"

----

// OBJECT_NAME: player
// ATTRIBUTE_NAME: life_display
// VALUE_OR_EXPRESSION: 999/999

set variable player.life_display = [EXPRESSION] "999/999"

--

// OBJECT_NAME: player
// ATTRIBUTE_NAME: mana_display
// VALUE_OR_EXPRESSION: 99/99

set variable player.mana_display = [EXPRESSION] "99/99"

----

Boolean Attributes:

// OBJECT_NAME: player
// ATTRIBUTE_NAME: flying
// VALUE_OR_EXPRESSION: false

set variable player.flying = [EXPRESSION] false

---

// OBJECT_NAME: player
// ATTRIBUTE_NAME: flying
// VALUE_OR_EXPRESSION: true

set variable player.flying = [EXPRESSION] true

for more detailed reading:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk (scroll down a bit to get to the Attributes and the 'if' Script sections, the 'TWO SUPER SCRIPTS' sections)