Roflme
2012-04-21 13:25:45
Hope this is the right section…
So I'm still learning the VERY BASICS to scripting. I mean VERY VERY BASIC
I've been trying to improve my scripting knowledge by working with flash games. They seem to be a great way to confirm that I understand how the script works
Currently I've been trying to get a basic script to work for Storm the House 2. If you haven't played the game yet, you simply click the mouse on enemies charging to a house before they reach the house. If they reach the house they will start to damage it until the house reaches 0 health left.
This is what I've got so far:
EDIT: If it helps (I don't think it really makes a difference, expect for some coordinates) I'm playing the game off of addicting games instead of armor games or any other site hosting this one)
So my question is, I want it to repeat the moving and clicking mouse until it's shot 7 times (you start with a gun that has only 7 bullets). Then I want it to press the space bar (which will reload the gun). How would I go about doing this?
As far as I'm aware I'd have to add something after the Wait after ClickMouse to tell the script to repeat that part 7 times and then hit the space bar, then wait, then repeat the entire thing all over again. (PLEASE CORRECT ME IF I'M WRONG).
Just need anyone with any knowledge of scripting to tell me how I can have my script repeat a certain section:
Thanks! Sorry if I've confused anyone!
EDIT 2: So I just added this to the script:
Which ends up doing what I want, somewhat. The only problem is that the entire script will wait those three seconds, then repeat because I have the end of the script like this:
So now I'm just looking for a better way to rewrite what I added so it ONLY presses the space bar after it's clicked 7 times, rather than typing it in intervals.
So I'm still learning the VERY BASICS to scripting. I mean VERY VERY BASIC
I've been trying to improve my scripting knowledge by working with flash games. They seem to be a great way to confirm that I understand how the script works
Currently I've been trying to get a basic script to work for Storm the House 2. If you haven't played the game yet, you simply click the mouse on enemies charging to a house before they reach the house. If they reach the house they will start to damage it until the house reaches 0 health left.
This is what I've got so far:
EDIT: If it helps (I don't think it really makes a difference, expect for some coordinates) I'm playing the game off of addicting games instead of armor games or any other site hosting this one)
program StormTheHouse2;
procedure StartGame;
begin
MoveMouse(89, 201);
ClickMouse(89, 201, 1);
Wait(500)
MoveMouse(431, 290);
ClickMouse(89, 201, 1);
end;
procedure StormHouse;
var
x, y:Integer;
begin
if FindColorSpiralTolerance(x, y, 10066329, 0, 40, 470, 380, 1) or
FindColorSpiralTolerance(x, y, 13421772, 0, 40, 470, 380, 1) Then
begin
MoveMouse(x, y);
ClickMouse(x, y, 1);
Wait(900);
end;
end;
begin
StartGame;
repeat
StormHouse;
until(false);
end.So my question is, I want it to repeat the moving and clicking mouse until it's shot 7 times (you start with a gun that has only 7 bullets). Then I want it to press the space bar (which will reload the gun). How would I go about doing this?
As far as I'm aware I'd have to add something after the Wait after ClickMouse to tell the script to repeat that part 7 times and then hit the space bar, then wait, then repeat the entire thing all over again. (PLEASE CORRECT ME IF I'M WRONG).
Just need anyone with any knowledge of scripting to tell me how I can have my script repeat a certain section:
begin
MoveMouse(x, y);
ClickMouse(x, y, 1);
Wait(900);
end;7 times, and then make it hit the space bar and repeat all of that over again.Thanks! Sorry if I've confused anyone!
EDIT 2: So I just added this to the script:
procedure Reload;
begin
SendKeys(' ',100);
Wait(3000);
end; Which ends up doing what I want, somewhat. The only problem is that the entire script will wait those three seconds, then repeat because I have the end of the script like this:
begin
StartGame;
repeat
StormHouse;
Reload;
until(false);
end. And when I make the end like this:begin
StartGame;
repeat
StormHouse;
until(false);
repeat
Reload;
until(false);
end. It doesn't reload.So now I'm just looking for a better way to rewrite what I added so it ONLY presses the space bar after it's clicked 7 times, rather than typing it in intervals.