Problem with rules & real attributes
opa
Member Posts: 35
Hi!
I have a problem with rules and real attributes.
I have two real attributes:
real1 = 0.1
real2 = 0.2
And rule:
IF real1 = real2
THEN
display text: Hello World!
Any suggestion why my actor shows that Hello World! -text?
Doesn't rules work with decimals?
Comments
I just tried this and the display text doesn't show up. Can you show us a screen shot of the rules, and of the attributes?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Try using 1.1 instead of 1,1.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Hi, thanks for your help!
I tried that, but It's not possible?
@Armelline
I have result table, which shows times for player1, player2, player3 and player4.
And also actors, which shows players position after each level.
For example, if players' times are like this, Creator seems to think that player1 and player4 has same time (which is not true):
Player1 = 12.13 =position 1
Player2 = 14.12 =position 3
Player3 = 19.22 =position 4
Player4 = 12.11 =position 1
Perhaps it's a regional thing then. Perhaps @BlackCloakGS or someone from GameSalad can shed some light.
It seems the most likely culprit. Not sure why you'd be prevented from putting a period in that attribute though.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Using equals with real numbers is always problematic. If i remember correctly if two real attributes are with in .01 of each other they are consider equal. You should use greater than or less than operators.
OK, I didn't know that.
I've spent too many hours with this, because I thought that there was something wrong with my attributes or something.. I'll try to make changes, thanks for your answer!
I made changes and now it works!
I did it like this:
IF
level_best_time < player1_time+0.01
level_best_time > player1_time-0.01
THEN
Player1_position = 1
etc.
Thanks again!
Edit: Never mind, I completely missed one of your posts. Confusion avoided
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support