How to compare 2 counters ? [gamebook] [solved]

garulf0
27 Mar 2017, 07:51

Hello,

I would like to compare 2 counters.

I've tried:
=> If [COUNTER --> COUNTERNAME] ChoixFigurine = [EXPRESSION] counter:NbFigurineMS
=>Then...

But it didn't work...

Thanks for helping me,

garulf0


hegemonkhan
27 Mar 2017, 08:13

examples:

(replace my 'NAME_OF_OBJECT_X' and 'NAME_OF_ATTRIBUTE_X' with what you/you're have/using/wanting-to-use)

(a 'counter' is merely an Integer Attribute, which often you want to increase it, either by just +1 or +more than 1, but you can of course decrease it too, and you can use multiplication or division too, not just addition or subtraction)

(the Game Book only has two Objects for you to use: the 'game' Game Settings Object and/or the 'player' Player Object)
(game.NAME_OF_ATTRIBUTE and/or player.NAME_OF_ATTRIBUTE)

if [EXPRESSION] NAME_OF_OBJECT_1.NAME_OF_INTEGER_ATTRIBUTE_1 = NAME_OF_OBJECT_2.NAME_OF_INTEGER_ATTRIBUTE_2

else if [EXPRESSION] NAME_OF_OBJECT_1.NAME_OF_INTEGER_ATTRIBUTE_1 > NAME_OF_OBJECT_2.NAME_OF_INTEGER_ATTRIBUTE_2

else if [EXPRESSION] NAME_OF_OBJECT_1.NAME_OF_INTEGER_ATTRIBUTE_1 < NAME_OF_OBJECT_2.NAME_OF_INTEGER_ATTRIBUTE_2
// (you could, actually should, have this last 'else if' merely as an 'else' instead (no condition, just add your nesting scripting for it)


Pertex
27 Mar 2017, 09:22

Just to add a point to hegemonkhan post: When you are asked for a counter name in the gui, just type the name. If you want to use this counter in an expression, add "game." in front of the name (without ")

Here is an example how to do it:
https://ibb.co/fhZvLa


garulf0
27 Mar 2017, 19:36

perfect! Your're great! :)

Thanks both of you!!!