Hi, so trying to create more advanced scripts and first thing that I need is to switch to more task based system instead of just using if statements as I did before. What first came to my mind is to use cases as I saw in couple other scripts. So to learn I made up this quick pseudoscript
If prayer left is not 0 -> prayer is off -> turn on the prayer, else pray at altar.
And it does it's job. Then I checked Explvs 101 scripting tutorial and saw that it takes complete different approach, so wrote my script like he does:
So they both do what they suppose to do, that's good. What I am curious about why some people use cases and some the other system. What are the pros and cons of each?
The cases approach is very unfamiliar to me. How do you make more advanced tasks from it? In this case I just checked whether the prayer level is 0 or 1 (since its fresh acc it has only two options), guess this would be non sense if account had higher prayer level, but maybe then cases approach would be not the smart choice?
In general what I currently like to learn is to make more extended script with task system in it. Lets say, go chop trees until level 20 woodcutting, then do quest, then go train combat and cases approach seem like a way to go for this kind of script