Friday, January 15, 2016

new event step: IfElese

Warning: Somewhat technical post
During the writing of various event I always found myself writing if but till now I never had a if else.
I simulated the ifelse using the Switch event step like this:

  <Switch Expression="[Trainee.Mind.Purity.Slut]">
    <Case Value="true">
       <SomeEventStep/>
    </Case>
    <Case Value="false">
       <SomeEventStep/>    
    </Case>
  </Switch>

It does work but it feels strange to me using a switch for doing so.
So I finally decided to add a IfElse.
The previous example became:

  <IfElse Expression="[Trainee.Mind.Purity.Slut]">
    <Composite>
       <SomeEventStep/>
    </Composite>
    <Composite>
       <SomeEventStep/>    
    </Composite>
  </Switch>


Unfortunately xml doesn't make it much better then the previous version but at least now you don't have to specify the Value="true".

IfElse must have two child, the use of a <Composite> is only if you have to specify more than one event step.

Using a IfElse kinda feels better than the switch but I'm still evaluating other solution, since this doesn't feel too natural...

No comments:

Post a Comment