Risen91
2012-05-01 13:05:52
Hey all, just started out yesterday and I'm starting to learn about the scripting by making a simple bot for flash games. The game I'm working on is Demonic Defense 4 here is the script i have so far:
Ok so, what i want to know is how to make the repeat end once LevelEnd; has completed. At the moment it just kills the script outright (using TerminateScript;) once it detects the level has ended. How would i create maybe a Boolean that tells the "Until" part to be false so the script stops.
So far i have tried adding a variable into the KillScript; (under x1, y1:Integer;) so that once the color is detected it changes to true, but i keep getting errors and i still have no idea how to make the Until detect that and stop repeating.
Hope you understand what I'm asking :P thanks for help in advanced!
program SaveTheGoldfish;
procedure StartGame;
begin
MoveMouse(275, 230);
ClickMouse(275, 230, 1);
Wait(10500);
MoveMouse(116, 168);
ClickMouse(116, 168, 1);
Wait(300);
MoveMouse(113, 264);
ClickMouse(113, 264, 1);
Wait(300);
MoveMouse(128, 170);
ClickMouse(128, 170, 1);
Wait(500);
MoveMouse(278, 134);
HoldMouse(278, 134, 1);
MoveMouse(209, 133);
ReleaseMouse(209, 133, 1);
Wait(500);
PressKey(52);
Wait(500);
MoveMouse(314, 160);
ClickMouse(314, 160, 1);
Wait(100);
MoveMouse(314, 160);
ClickMouse(314, 160, 1);
Wait(100);
MoveMouse(314, 160);
ClickMouse(314, 160, 1);
Wait(100);
MoveMouse(314, 160);
ClickMouse(314, 160, 1);
Wait(100);
MoveMouse(314, 160);
ClickMouse(314, 160, 1);
Wait(100);
MoveMouse(314, 216);
ClickMouse(314, 216, 1);
Wait(100);
MoveMouse(314, 216);
ClickMouse(314, 216, 1);
Wait(100);
MoveMouse(314, 216);
ClickMouse(314, 216, 1);
Wait(100);
MoveMouse(248, 269);
ClickMouse(248, 269, 1);
end;
procedure DefendTower;
var
x, y:Integer;
begin
if FindColorSpiralTolerance(x, y, 0 , 142, 187, 547, 397, 5) or
FindColorSpiralTolerance(x, y, 9539985 , 142, 187, 547, 397, 5) or
FindColorSpiralTolerance(x, y, 6684672 , 142, 187, 547, 397, 5) or
FindColorSpiralTolerance(x, y, 6710784 , 142, 187, 547, 397, 5) or
FindColorSpiralTolerance(x, y, 5598082 , 142, 187, 547, 397, 5) then
begin
MoveMouse(x, y);
HoldMouse(x, y, 1);
MoveMouse(60, 77);
ReleaseMouse(60, 77, 1);
end;
end;
procedure KillScript;
begin
while(isKeyDown(27)) do
TerminateScript;
end;
procedure LevelEnd;
var
x1, y1:Integer;
begin
if FindColorSpiralTolerance(x1, y1, 4016735, 253, 211, 326, 234, 5) then
TerminateScript;
end;
begin
StartGame;
Wait(3000);
repeat
LevelEnd;
KillScript;
DefendTower;
until(false);
end. Ok so, what i want to know is how to make the repeat end once LevelEnd; has completed. At the moment it just kills the script outright (using TerminateScript;) once it detects the level has ended. How would i create maybe a Boolean that tells the "Until" part to be false so the script stops.
So far i have tried adding a variable into the KillScript; (under x1, y1:Integer;) so that once the color is detected it changes to true, but i keep getting errors and i still have no idea how to make the Until detect that and stop repeating.
Hope you understand what I'm asking :P thanks for help in advanced!