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

garulf0

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

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

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

perfect! Your're great! :)

Thanks both of you!!!


Log in to post a reply.

Support

Forums