Loops are defined like thisQuote:
Hi para,
I am trying to create myself a script for luna that just spam skill 1 and 2 forever, meanwhile checks if MAD miniboss comes and use the 5th skill. When last boss spowns, it uses skill 3 4 and 5 until it's dead.
But i think i got something wrong.
I was wondering how can i make the script to do something forever, like a while statement. And in this while statement, with an if, enter in another while statement. The script snippet that i made should work but i gotta write it in a better way.
Basicly i want to farm luna manually but i want the script to spam skill 1 and 2, while spamming i want it to check if mad miniboss spown and kill him and, when the last boss spowns, make the script spam skill 3 4 and 5 on the last boss target.
Thx for your help when u have time to fix this snippet, cheers
Code:#DO=600000; #EXECUTE=FarmLuna; _UNTILMemRead=0xF557C4,BYTE,=1; ( while i have target? i dont know how to do something else, would be cool to say while im in the luna istance world ( I recall there should be a pointer with the map id in some memory register)) start_FarmLuna; Delay=10; Command=/skill Soul Skewer; Delay=10; Command=/skill Crushing Darkness; Delay=10; Command=/select MAD-74C; _IFMemPtrRead=%TargetBase,%OffsetName,WCHAR[32],=MAD-74C; _IFMemPtrRead=%TargetBase,%OffsetHP,DWORD,>0; #IF=%TargetDistance,<15; #IF=%Timer=415,60500; Command=/skill Hellish Wave; Delay=20; Command=/skill Hellish Wave; _IFMemPtrRead=%TargetBase,%OffsetName,WCHAR[32],=MAD-S; #EXECUTE=FarmLastBoss; end_FarmLuna; start_FarmLastBoss; #DO=600000; Delay=10; Command=/skill Terrifing Rupture; Delay=10; Command=/skill Hellish Stike; Delay=10; Command=/skill Hellish Wave; _IFMemPtrRead=%TargetBase,%OffsetHP,DWORD,=0; (exit the script) _UNTILMemRead=0xF557C4,BYTE,=1; ( while i have target? i dont know how to do something else, would be cool to say while im in the luna istance world ( I recall there should be a pointer with the map id in some memory register)) end_FarmLastBoss;
Code:
#DO=300000; some code _UNTILMemPtrRead=%TargetBase,%OffsetHP,DWORD,=0;
Now if you want 2 loops inside each other you have 2 methods you whether use #2DO and _2UNTIL like this
Code:
#DO=300000; code of first loop #2DO=20000; code of second loop _2UNTILMemPtrRead=%TargetBase,%OffsetName,WCHAR[32],=Kerubim; code of first loop _UNTILMemPtrRead=%TargetBase,%OffsetHP,DWORD,=0;
Code:
#DO=300000; code of first loop #EXECUTE=SecondLoop; code of first loop _UNTILMemPtrRead=%TargetBase,%OffsetHP,DWORD,=0; start_SecondLoop; #DO=20000; code of second loop _UNTILMemPtrRead=%TargetBase,%OffsetName,WCHAR[32],=Kerubim; end_SecondLoop;
Since we can declare a timeout at the "#DO" command we can make an infinite loop like this
Code:
#DO=99999999999999; some code #UNTIL=1,=2;
You can check the current map ID with this code
Code:
_MemReadVar=%AddrMap,DWORD,Map; WaitForResponse=Current MapID: %Var[Map];
Code:
_IFMemRead=%AddrMap,DWORD,=110010000; WaitForResponse=Player is in Sanctum; #ELSE WaitForResponse=Player is not in Sanctum; #ENDIF
so you learned that every "#DO" needs an "_UNTIL" to complete the loop, just like that it works with "IF" commands, every "IF" command needs an "#ENDIF" so vanillatool knows where to jump in case the "IF" was false
With this you should be able to fix/improve your script, but I can tell you the official luna script does exactly what you want, it spams key 1 and 2 for the normal mobs and waits till the mad mob appears to burst him away with the 5th skill, he does this until the final boss appears he then switches to skill 3, 4 and 5.
Anyways sure rewriting it by yourself will teach a lot of things.