Flags on the Gamebook mode.

Hello everyone.

I always use the gamebook mode, and I want to have the story text change when certain pages are used by the player. I know this is done by the flag system, but I have absolutely no idea how it works. It would only need to be as simple as: If the player has visited this page, this text will show.

Any simple explanation and example would be highly appreciated.

Thanks!
Connor


this takes a bit of scripting knowledge, so you may need to learn/find resources on it (or let me know and I'll provide them), but it'd be like this:

(I think Game Book also uses the 'visited' Boolean/'flag' Attribute, but maybe it doesn't have it, like the Text Adventure does)

if (NAME_OF_PAGE.visited) {
  // scripting to goto whatever new page
}

// the 'if' Script is done in GUI/Editor via its scripting:

'WHATEVER' Page -> 'Page' Tab -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'scripts' section/category -> 'if' Script -> (see below)

if [EXPRESSION] VALUE_OR_EXPRESSION
-> then, -> add new script(s) -> (select your script/s and set them up)
(optionally, and as many 'else ifs' as you want) else if [EXPRESSION] VALUE_OR_EXPRESSION
-> then, -> add new script(s) -> (select your script/s and set them up)
(optionally) else -> (see below)
-> add new script(s) -> (select your script/s and set them up)

'flags' are just Boolean (true/false) Attributes:

player.flying = true
player.flying = false
game.orc_dead = true
game.orc_dead = false
player.poisoned = true
player.poisoned = false
game.handled = true
game.handled = false
etc etc etc

you set/alter Attributes via scripting only within Game Book, and to do so in the GUI/Editor, via:

'WHATEVER' Page -> 'Page' Tab -> Page Type: [script] or [script + text] -> (see below)

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

set variable NAME_OF_OBJECT_WHICH_YOU_ONLY_GOT_player_OR_game_TO_CHOOSE_FROM_FOR_GAME_BOOK.NAME_OF_ATTRIBUTE = [EXPRESSION] VALUE_OR_EXPRESSION

for examples:

set variable player.poisoned = [EXPRESSION] false
set variable player.poisoned = [EXPRESSION] true // this would alter/re-set its value to now being 'true', if following the script above, lol
set variable game.orc_dead = [EXPRESSION] false // this is a way/cheat to effectively have more Objects in your game
set variable game.orc_dead = [EXPRESSION] true

other Data/Attributes Types, examples:

String Attributes:

set variable player.alias = [EXPRESSION] "HK"
set variable game.intro = [EXPRESSION] "Welcome to my game, I hope you enjoy it, muwhahaha!"

Integer Attributes, examples:

set variable player.strength = [EXPRESSION] 100
set variable player.intelligence = [EXPRESSION] 0


Hi!
I'll try to explain (english is not my language and I'm new here).

You can use flags, but also you have an option that works exactly the way you want. First of all, you'll need to change the page type to "text+script". Then add a new script: "IF". Select "player has seen page", then select the name of the page.
Second step: now add new script below: "Output/print a message" and write it.
If you did it like I said, you can see the code clicking on "Code view":

if (HasSeenPage(Page001)) {
  msg ("hello world!")
}

You can change the behavieur selecting diferent scripts here.
Of course you can set a flag the same way in the first step:
On "Page001" you can add the script: "Variables/Set flag on" --> input a name ("visited" or whatever). And then, when you visit another page like "Page025", do the same: Page type: "text+script" --> IF/Flag is set/Flag name ("visited" or whatever) and do the second step as before. So:

if (GetBoolean(game, "visited")) {
  msg ("hello world!")
}

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

Support

Forums