Khaikaa Posted December 25, 2018 Share Posted December 25, 2018 Hi everybody, I have a technical question right now about event flow.  Imagine the next scenary:  - There is a player variable called value which can value 0, 1, 2, 3 or 4. - We want to make an event that checks that variable's value and acts in consequence.  We can do in 2 diferents ways:   1st option: Simple conditional branches  We can make a structure like this: Conditional branch: [Player Variable value is equal to 0]  @> do stuff  @> : Else  @> : End branch Conditional branch: [Player Variable value is equal to 1]  @> do stuff  @> : Else  @> : End branch etc   2nd option: Inner conditional branches  Conditional branch: [Player Variable value is equal to 0]  @> do stuff  @> : Else  @> Conditional branch: [Player Variable value is equal to 1]     @> do stuff     @>        : Else     @>        : End branch : End branch etc   Both options will do the very same thing, but which one is cheaper for the server/client?   Also, there is the possibility to add label and go to laber commands to the first option so it only runs a portion of the event, for example:  Conditional branch: [Player Variable value is equal to 0]  @> do stuff  @> go to label endEvent  @> : Else  @> : End branch Conditional branch: [Player Variable value is equal to 1]  @> do stuff  @> go to label endEvent  @> : Else  @> : End branch etc label endEvent  is it cheaper for the server/client doing the label/go to label thing or running the whole event?  Thank you! Link to comment Share on other sites More sharing options...
1 jcsnider Posted December 25, 2018 Share Posted December 25, 2018 1 hour ago, Khaikaa said: 2nd option: Inner conditional branches  Slightly better, because it will not run excess conditional checks after one is met. The first option will be just as good if you put an "Exit Event Processing" between each conditional though.  You can use go-to labels but I would avoid them at all costs.. it is kinda heavy on the cpu to remap the events call stack to that label. See my suggestion above to use exit event processing.    Khaikaa 1 Link to comment Share on other sites More sharing options...
0 Khaikaa Posted December 25, 2018 Author Share Posted December 25, 2018 7 hours ago, jcsnider said:  Slightly better, because it will not run excess conditional checks after one is met. The first option will be just as good if you put an "Exit Event Processing" between each conditional though.  You can use go-to labels but I would avoid them at all costs.. it is kinda heavy on the cpu to remap the events call stack to that label. See my suggestion above to use exit event processing.    This may be a stupid question but does adding labels as comments (I mean, without adding any go to label command) costs to the cpu? Link to comment Share on other sites More sharing options...
0 jcsnider Posted December 25, 2018 Share Posted December 25, 2018 Labels add zero cost, and are just fine for comments. It’s only the go to label commands that are intensive. Khaikaa 1 Link to comment Share on other sites More sharing options...
Question
Khaikaa
Hi everybody, I have a technical question right now about event flow.
Â
Imagine the next scenary:
Â
- There is a player variable called value which can value 0, 1, 2, 3 or 4.
- We want to make an event that checks that variable's value and acts in consequence.
Â
We can do in 2 diferents ways:
Â
Â
1st option: Simple conditional branches
Â
We can make a structure like this:
Conditional branch: [Player Variable value is equal to 0]
 @> do stuff
 @>
: Else
 @>
: End branch
Conditional branch: [Player Variable value is equal to 1]
 @> do stuff
 @>
: Else
 @>
: End branch
etc
Â
Â
2nd option: Inner conditional branches
Â
Conditional branch: [Player Variable value is equal to 0]
 @> do stuff
 @>
: Else
 @> Conditional branch: [Player Variable value is equal to 1]
    @> do stuff
    @>
       : Else
    @>
       : End branch
: End branch
etc
Â
Â
Both options will do the very same thing, but which one is cheaper for the server/client?
Â
Â
Also, there is the possibility to add label and go to laber commands to the first option so it only runs a portion of the event, for example:
Â
Conditional branch: [Player Variable value is equal to 0]
 @> do stuff
 @> go to label endEvent
 @>
: Else
 @>
: End branch
Conditional branch: [Player Variable value is equal to 1]
 @> do stuff
 @> go to label endEvent
 @>
: Else
 @>
: End branch
etc
label endEvent
Â
is it cheaper for the server/client doing the label/go to label thing or running the whole event?
Â
Thank you!
Link to comment
Share on other sites
3 answers to this question
Recommended Posts