gd-YAFSM
gd-YAFSM copied to clipboard
Add ability to have multiple conditions for same variable.
Hi, I'm currently making a train simulator. I'm making a StateMachine for my coach for the speed.
The problem is that, I don't have the ability to restrict speed like, if speed > 10.0 and speed < 0.5
.
I'd like to know if this is possible in the current version of YAFSM, if it's not possible, is there any way to work around this? or could this feature be implemented soon? Thank you very much for your response.
Multiple same name condition in one transition is impossible due to how the data structured, where primitive condition(like FloatCondition) is keyed by the variable name.
The workaround would be turning expression into a boolean(for example, speed_range
) and set the boolean from code smp.set_param("speed_range", speed > 10.0 and speed < 0.5)
.
Yes, this feature should be implemented in the future but as form of "ExpressionCondition" that based of Expression class so you can just write any complex expression in the editor.
Sorry my bad.
The workaround would be turning expression into a boolean(for example, speed_range) and set the boolean from code smp.set_param("speed_range", speed > 10.0 and speed < 0.5).
Thanks for that!
Well, I had to write a lot of code to workaround this issue, like yea, I got a lot of states that is based on speed, and this is a big issue indeed for me, I hope you add the ExpressionCondition as soon as possible.
Edit: Maybe I can look into it, if you want.
I planned to add this feature on next update, though, I can't guarantee when it will be done since I am working on another project now.
Feel free to open a pull request, if you have implemented the feature on your own.
Oh, ok, I'll try to implement.