How to make a rule that when minus from something is equal to or greater than zero?
Hello
Was wondering if there is a special symbol used for this issue;
I have total points attribute,
I have total amount of points that can be earned attribute,
I have total number of moves made attribute.
Once the player finishes a level, The amount of points that is earned is determined by (number of points that can be earned) minus (number of turns).
However sometimes this becomes a negative and then messes up the whole point system. Is there a way I can say that if (number of moves) is equal to or greater than (number of points that can be earned) then change amount of points earned to 0.
Des this Make sense?
Was wondering if there is a special symbol used for this issue;
I have total points attribute,
I have total amount of points that can be earned attribute,
I have total number of moves made attribute.
Once the player finishes a level, The amount of points that is earned is determined by (number of points that can be earned) minus (number of turns).
However sometimes this becomes a negative and then messes up the whole point system. Is there a way I can say that if (number of moves) is equal to or greater than (number of points that can be earned) then change amount of points earned to 0.
Des this Make sense?
Best Answers
-
gyroscope I am here.Posts: 6,598
Hi @MilliionairApps
Something like:
Change Attribute PointsEarned to PointsCan - TurnNum
Rule: When PointsEarned < 0
Change Attribute PointsEarned to 0 -
BoomshackBarry Posts: 712
You could use an index attribute instead of an integer (if you're using an integer that is). An index operates the same as an integer except that it can't go below 0, so will effectively achieve what you want without the use of extra rules.
From the cookbook:
"Index: positive whole numbers, such as 0, 1, 58, 2804. Index attributes can fulfill many of the same roles as Integers, but have the interesting feature of being unable to store a negative number. For instance, an index attribute with a value of 4 that was told to subtract 6 would then have a value of 0, not -2."
Answers
Cheers mate, that was my initial thought and it works, but then I tried @BoomshackBarry method and it works just the same, except it involves one rule not 2.
Very helpful thanks, and I just re-learnt that index attributes can not go below 0.
You're welcome, @MillionairApps – and @BoomshackBarry solution is better than mine, for certain, being less rules. :-) (I'd forgotten about index...)