View Full Version : Need some help =\
Ipewnjoo
06-29-2007, 06:17 PM
i was tryin to make a very simple auto fighter but it doesnt seem to work can anybody help me fix it? it syas "failed when compiling line 11 error identifier expected
program autofighter;
var
x,y: Integer;
const
MonsterColor1 = 293491;
MonsterColor2 = 293491;
procedure 1;
begin
if(FindColor(x,y,MonsterColor1,577,7,727,163)) then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(20));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
procedure 2;
begin
if(FindColor(x,y,MonsterColor2,577,7,727,163)) then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(21));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end.
Jason2gs
06-29-2007, 06:58 PM
Ok, you made several mistakes. Let's go over them.
Your original problem was because you had the name of your first procedure, an integer. You can't do that. It had to at least start with a letter.
After that, it registered "ChooseOptionEx" as an unknown identifier. That's because you forgot to {.include SRL/SRL.Scar} ;)
When you include SRL, you don't need to declare x and y as integers. SRL already does that for you.
Next up was how you forgot to add the last end; to your first procedure.
The error after that was just the same as the first one. You named a procedure with an integer.
Last but not least, you forgot a main loop!
Here's the fixed version:
program autofighter;
{.include SRL/SRL.Scar}
const
MonsterColor1 = 293491;
MonsterColor2 = 293491;
procedure One;
begin
if(FindColor(x,y,MonsterColor1,577,7,727,163)) then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(20));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end;
procedure Two;
begin
if(FindColor(x,y,MonsterColor2,577,7,727,163)) then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(21));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end;
begin
One;
Two;
end.
Also, ClickMouse and MoveMoveSmoothEx probably aren't the best procedures. SRL has a couple for moving and clicking the mouse. They're called Mouse, and MMouse.
Oh, and your might want to spend a little bit of time learning the scripting standards. It makes things a heck of a lot easier to read and write.
Good luck!
-Mike
Ipewnjoo
06-29-2007, 07:10 PM
thanks i dont think i posted it right either i did space them out and stuff it just didnt post them like that and thanks
if(FindColor(x,y,MonsterColor1,577,7,727,163)) then
also are those the right cordinates 577,7,727,163 it was on the one guid but it ddnt say if those were right or not
Ipewnjoo
06-29-2007, 07:42 PM
also the mouse doesnt move and it executes the script as soon as it start it is there anything else wrong with it ? sorry for double post
shadows-collide
06-29-2007, 07:55 PM
Yeah you forgot the main loop man, put in something like
begin
repeat
one;
two;
until(false)
end.
Youve told it how to do something, just not when to do it :)
shadows-collide
06-29-2007, 07:56 PM
On second thoughts, jason already done that :)
Go through his script its a pretty much perfect version of what your aiming for i think :)
Jason2gs
06-29-2007, 08:00 PM
The four coords are the coords you want to check inside of for the chosen color. If it's on the RS main screen, it would be MSX1, MSY1, MSX2, and MSY2. Those are four constants, already preset in SCAR.
FindColorTolerance is better than FindColor, because you are able to search for a color, with a little bit of a tolerance. Can't really explain it in very well. Look:
FindColorTolerance(x, y, 225, MSX1, MSY1, MSX2, MSY2, 10);
That would search for the color 225 with a tolerance of 10. Understand?
Ipewnjoo
06-29-2007, 08:05 PM
oh so istead of (FindColor(x,y,MonsterColor2,577,7,727,163)) you would put that but with the color you want?
also wouldnt u need a ( on the bigining and two ) on the end?
Jason2gs
06-29-2007, 08:08 PM
Yes.
You should adjust the tolerance level to fit your needs, but usually 5-10 is a good amount.
Ipewnjoo
06-29-2007, 08:11 PM
thanks im gonna try ti again see if it works now
Jason2gs
06-29-2007, 08:13 PM
Good luck!
Ipewnjoo
06-29-2007, 08:15 PM
still no luck it just executes it as soon as it starts it =\ ill be back in like 15 mins if you can think of a fix please post it ill copy the script for you to check.
program Autofight;
begin
end.
{.include SRL/SRL.Scar}
const
MonsterColor1 = 7305336;
MonsterColor2 = 6775658;
procedure One;
begin
if(FindColorTolerance(x, y, 6775658, MSX1, MSY1, MSX2, MSY2, 10));then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(20));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end;
procedure Two;
begin
if(FindColorTolerance(x, y, 7305336, MSX1, MSY1, MSX2, MSY2, 10)); then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(21));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end;
begin
repeat
One;
Two;
until(false);
end.
Jason2gs
06-29-2007, 08:26 PM
You have two main loops. One at the top with nothing in it, and one at the bottom with all your script stuff in it. That ends your script right away. Not good ;)
Ipewnjoo
06-29-2007, 08:37 PM
ahhh i feal like a retard >< looked over it like 10 times lol thanks i would ahve never caught that. gonna try it again lol
Ipewnjoo
06-29-2007, 08:43 PM
runtime error exception acces vi0olation at addres 0064fea2 .... and it goes on and on =\ sumthing broken i assume?
Jason2gs
06-29-2007, 08:48 PM
Works for me. You added a couple extra semicolons, before the "then" but after I fixed those, it worked.
Here's the script I tested it with:
program Autofight;
{.include SRL/SRL.Scar}
const
MonsterColor1 = 7305336;
MonsterColor2 = 6775658;
procedure One;
begin
if(FindColorTolerance(x, y, 6775658, MSX1, MSY1, MSX2, MSY2, 10))then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(20));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end;
procedure Two;
begin
if(FindColorTolerance(x, y, 7305336, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
MoveMouseSmoothEx(x,y+random(4),20,40,45,25,20);
Wait(100+random(21));
ClickMouse(x,y,false);
Chooseoptionex('Attack');
end;
end;
begin
repeat
One;
Two;
until(false);
end.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.