Log in

View Full Version : Script Help



BringCashBuyChronic
04-08-2012, 07:55 PM
So Iv gone through YoHoJo's tutorials (amazingly put together, The best tuts iv found on this site) and with his help i have succesfully spanked the monkey at 456 mph and saved over 1000 goldfish.

Instead of diving head first into a RS script i decided to test what i learned on a couple simple games similar to Spank The Monkey and Save The Goldfish. A couple of them worked but im having difficulties with this one..

The game is called Boat Hunt and can be found at the link below

http://www.box10.com/boat-hunt.html


This is the code


program BoatHunt;


procedure StartGameFirstScreen;
begin
Wait(1000)
MoveMouse (522, 332);
ClickMouse(522, 332, 1);
end;


procedure StartGameSecondScreen;
begin
MoveMouse (532, 458);
ClickMouse(532, 458, 1);
end;



procedure ShootEm;
var
x, y:integer;
begin;
if //Error: Exception: You passed wrong values to a finder function: xs > xe (664,29). at line 22
FindColor(x, y, 16254 , 664, 469, 29, 14)or
FindColor(x, y, 3499724 , 664, 469, 29, 14)or
FindColor(x, y, 16765255 , 664, 469, 29, 14)then
begin
MoveMouse(x, y);
ClickMouse(x, y, 1);
end;
end;





begin;
StartGameFirstScreen;
ShootEm;
end.


When I press compile it does so succesfully, And when i target the client and start it goes through StartGameOne but when it moves to ShootEm I get this error,

Error: Exception: You passed wrong values to a finder function: xs > xe (664,29). at line 22

Iv tried but i really dont know what to do now, if anyone can help me on this it would be greatly apprececiated.

Also, if you fail the game a second 'playgame' screen will pop up (which is why I added 'StartGameSecondScreen') is there a way to check which screen Im at and to choose the right procedure?


(All of this I credit to YoHoJo lol I never would have gotten this far if it wasnt for his vids!)

Gucci
04-08-2012, 10:38 PM
Use a function for the second screen and a DTM, so make a DTM and set up results like this:

function CheckScreen: Boolean;

begin

SecondScreen := DTMfromString('DTMHERE');

if FindDTM(SecondScreen, x, y, MSX1, MSY1, MSX2, MSY2) then
Result:= True

else
Result := False
FreeDTM(SecondScreen);
end;

Implement it like this:

procedure StartGameSecondScreen;
begin

if (CheckScreen = True) then

begin
MoveMouse (532, 458);
ClickMouse(532, 458, 1);
end;
end;

BringCashBuyChronic
04-09-2012, 02:51 AM
I tried this out on I different script because I havnt gotten this one to work yet but it worked well thank you very much.

Gucci
04-09-2012, 07:11 AM
I tried this out on I different script because I havnt gotten this one to work yet but it worked well thank you very much.

No problem glad I could help