Currency in Gamebook

Winston
05 May 2018, 05:27

Help. I've pored over the forums for hours and I can't figure out how to implement currency into gamebook. Ive tried a bunch of different ways. What would you guys say the best way is?


hegemonkhan
05 May 2018, 05:56

best method: Integer Attribute(s), which you can manipulate/change/adjust/alter their Values to give the illusion of raising/lowering your 'currency' and/or of transactions (buying/selling/etc)


create/set an Integer Attribute and its initial Value:

'WHATEVER (probably want/need it to be your first page, to/for creating/initially-setting everything that your game will use, such as your Attributes)' Page Object -> 'Page' Tab -> Page Type: [script] or [script+text] -> (see below)

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

set variable player.currency = [EXPRESSION] 0

// or (you only got two Objects, aside from your Page Objects, that you can use for Attribute addage to them: the special 'game' Object and your 'player' Player Object, or whatever you renamed it as):

set variable game.currency = [EXPRESSION] 0


arithmetic usage example:

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

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

set variable player.currency = [EXPRESSION] player.currency + 5

// or (you only got two Objects, aside from your Page Objects, that you can use for Attribute addage to them: the special 'game' Object and your 'player' Player Object, or whatever you renamed it as):

set variable game.currency = [EXPRESSION] game.currency + 5


see this link (while its for the Text Adventure, the scripting itself is the same, aside from the Game Book just being more limited in its functionality, and aside from the the Game Book requiring scripting for Attribute creation/setting and usage, whereas the Text Adventure also has the GUI/Editor Tabs/Controls that you can use instead):

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk (scroll down about half way to the bolded 'the two super scripts' and read/study from there to the bottom, though if you want to read the top half too on generally how quest's coding structure and coding works, you can/should read the top half too)

ask if you got any questions or need help with anything


Winston
05 May 2018, 15:12

Thanks! That worked!