Explaination
=============================
Some might not believe that rewriting scripts can cause it to drain less cpu power, some scripting experience is required to understand it, heres an example:
Before:
if timer <= 0 && getstage MQ15 == 58 && OrtheRef.getdead == 0
set timer to 5
sayTo player MQ15EldamilWarning
endif
if timer <= 0 && getstage MQ15 == 66 && getdistance player < 1000
if suicide == 0
set timer to sayTo player MQ15EldamilWarning
set suicide to 1
endif
endif
if suicide == 1 && getstage MQ15 == 66 && timer <= 0
setstage MQ15 67
endif
Before the optimalization, this script would check 9 things, no matter what. These are:
timer <= 0
getstage MQ15 == 58
OrtheRef.getdead == 0
timer <= 0
getstage MQ15 == 66
getdistance player < 1000
suicide == 1
getstage MQ15 == 66
timer <= 0
After:
if timer <= 0
if getstage MQ15 == 58
if OrtheRef.getdead == 0
set timer to 5
sayTo player MQ15EldamilWarning
endif
elseif getstage MQ15 == 66
if getdistance player < 1000
if suicide == 0
set timer to sayTo player MQ15EldamilWarning
set suicide to 1
elseif suicide == 1
setstage MQ15 67
endif
endif
endif
endif
After the optimalization, it will check for only one thing, no matter what. Lets take a look at the posibilitys:
option 1: timer > 0
only 1 question is needed here 8 questions less
option 2: timer <= 0 getstage mq15 == 58 ortheref.getdead == 1
3 questions needed 6 questions less
option 3: timer <= 0 getstage mq15 == 58 ortheref.getdead == 0
3 questions needed 6 questions less
option 4: timer <= 0 getstage mq15 != 58 getstage mq15 == 66 getdistance player >= 1000
4 questions needed 5 questions less
option 5: timer <= 0 getstage mq15 != 58 getstage mq15 == 66 getdistance player < 1000 suicide == 0
5 questions needed 5 questions less (original needs 10 here)
option 6: timer <= 0 getstage mq15 != 58 getstage mq15 == 66 getdistance player < 1000 suicide == 1
5 questions needed 5 questions less (original needs 10 here)
option 7: timer <= 0 getstage mq15 != 58 getstage mq15 != 66
3 questions needed 6 questions less
You can see that it doesnt which option it is it takes less questions/checks to find out if the conditions are met for specific things. Scripters will notice that the script will do exactly the same, no matter what the variables are, but with less checks. A check just takes more cpu power then nothing does.