Anyone else get buggy "Otherwise" clauses periodically?
rebump
Member Posts: 1,058
This happened before 0.8.6 occaisionally but it seems to be a bit more common in 0.8.6. Basically, I'll have a "Rule" behavior with some behaviors in both the rule's "true" area and in its "false" area (i.e. the "Otherwise" section of the rule). However, if this rule is nested within other "Rules"/"Timers" and/or tests certain things, sometimes the "Otherwise" condition is not evaluated no matter what. I haven't been able to determine a pattern to the occurance.
It is not a human logic issue either. A recent one I came across was layered a few levels deep. It basically tested the "Y" velocity:
`
-RULE-
If self.Motion.Velocity.Y >= 0 Do some other behaviors
Otherwise do some different behaviors
-END-
`
The actor in question goes up and then comes down. A "Display Text" of its "Y" velocity value shows a positive value as it goes up and a negative value as it comes down - as it should. I don't know it this is related to testing that particular attribute or because of the rule's nesting level or some other bug. I'm pretty darned sure I have successfully used this construct before elsewhere in other GS projects.
I did discover a workaround in this instance (recreating the actor did not solve it). I added an actor attribute and just before the rule, I save the actor's "Y" velocity value into the attribute. I then use the attribute in the rule instead of the pre-defined "Y" velocity attribute. It works but is essentially the same dang thing...but then you can run into test frequency issues with these types of workarounds depending on the setup. An alternate workaround is to move the "Othewise" behaviors to another rule with inverse logic in its conditional area. This works too but technically could lead to both being executed if the timing is right from execution of the first rule to the second.
Definately some strange things going on at times within GS.
Anyone else running into non-working "Otherwise" clauses - talking like 1 in 50 or even less being affected!? Not too common but when it does occur, it can leave you dead in your tracks at times.
It is not a human logic issue either. A recent one I came across was layered a few levels deep. It basically tested the "Y" velocity:
`
-RULE-
If self.Motion.Velocity.Y >= 0 Do some other behaviors
Otherwise do some different behaviors
-END-
`
The actor in question goes up and then comes down. A "Display Text" of its "Y" velocity value shows a positive value as it goes up and a negative value as it comes down - as it should. I don't know it this is related to testing that particular attribute or because of the rule's nesting level or some other bug. I'm pretty darned sure I have successfully used this construct before elsewhere in other GS projects.
I did discover a workaround in this instance (recreating the actor did not solve it). I added an actor attribute and just before the rule, I save the actor's "Y" velocity value into the attribute. I then use the attribute in the rule instead of the pre-defined "Y" velocity attribute. It works but is essentially the same dang thing...but then you can run into test frequency issues with these types of workarounds depending on the setup. An alternate workaround is to move the "Othewise" behaviors to another rule with inverse logic in its conditional area. This works too but technically could lead to both being executed if the timing is right from execution of the first rule to the second.
Definately some strange things going on at times within GS.
Anyone else running into non-working "Otherwise" clauses - talking like 1 in 50 or even less being affected!? Not too common but when it does occur, it can leave you dead in your tracks at times.
Comments
Instead of "another rule" maybe I should have said "to its own rule".
Not sure if the bug is a result of bad parsing of the actor's XML file or something else but I sure wish they would fix it.
I hate to avoid the "Otherwise" clause but I find myself doing that more and more when I can.
If A then B; otherwise C
If not A then C; otherwise B
What I meant is two rules like this:
If A then B
If not A then C
(Sometimes it's hard to describe a situation properly. No offense intended.)
Edit: I reread your post. My bad.
I always end up re-wording my posts a few times before I submit them but confusion and/or typos still seem to slip through. :-)
Edit: BTW, I never really had a need to comment in the related threads but your demos are always cool. Keep up the good work for the community!
Most problems I have found are associated with putting Rules or multiple routines inside an otherwise. This I try to avoid and reserve an otherwise for just an attribute assignment or a simple set of behaviors. Keep complex behavior sequences out of the otherwise section....in short...keep the otherwise section simple and you will have fewer problems...but do use them...as they appear to help in overall app optimization.
Its hit or miss with little rhyme or reason to why it works generally but other times it is flaky. I have chalked it up to Beta Bugs.
_______________________
*** visit www.spiritApps.com to check out the Spirit Connoisseur Apps ***
(now available for 17+)
Oh, and speaking of your skills, if you have the time, look at this thread:
http://gamesalad.com/forums/topic.php?id=7001&replies=12#post-46189
Sounds like an area up your alley (i.e. puzzle and board game logic).