PDA

View Full Version : My first script, whats up with this?



I Karma I
12-06-2006, 06:07 AM
program MonkFighter;
{.include srl/srl.scar}
{.include srl/srl/skill/fighting.scar}
Const
MonkColor = 12172221; //color of the monks robes
Betweentime = 5; //Time between finding monks (in seconds)
MouseSpeed = 8+Random(3); //speed of the mouse (no lower than 5) THIS IS LINE SEVEN<<<<<<<<<
FoodColor = 1598653 //color of the food you are using
Var x1,y1:Integer;

function FindMonk: Boolean;
begin
if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
Result:= True;
else
Result:= False;
Begin
SetupSRL;
ActivateClient;
repeat
Begin FindColor;
wait((Betweentime * 1000) + random(300)) if(FindMonk) then if (IsUpText('Attack Monk') then
Mouse(x, y, 10, 10, True);
until (not(LoggedIn))
end.
Procedure EatFood
if(FindColorSpiral(x,y,FoodColor,652,329,650,326)) then
Result:= True;
else
Result:= False;

I try to compile and it says this:

Line 7: [Error] (15889:1): Duplicate identifier '' in script C:\Documents and Settings\Owner\Desktop\fighter part(1).scar

Also, is there any simpler ways to eat food then my way?

Pentti
12-06-2006, 09:40 AM
You've got mousespeed in const in your script, thats already in SRL, Use this in const:

Const
MonkColor = 12172221; //color of the monks robes
Betweentime = 5; //Time between finding monks (in seconds)
MSpeed =8; //speed of the mouse (no lower than 5) THIS IS LINE SEVEN<<<<<<<<<
FoodColor = 1598653; //color of the food you are using

And after SetUpSRL in your main loop use this:


begin
SetUpSRL;
MouseSpeed(MSpeed)
//And your stuff here....

end.

I Karma I
12-06-2006, 10:03 AM
program MonkFighter;
{.include srl/srl.scar}
{.include srl/srl/skill/fighting.scar}
Const
MonkColor = 12172221; //color of the monks robes
Betweentime = 5; //Time between finding monks (in seconds)
MSpeed =8; //speed of the mouse (no lower than 5)
FoodColor = 1598653; //color of the food you are using
Var x1,y1:Integer;

function FindMonk: Boolean;
begin
if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
Result:= True;
else //LINE 15 <<<<
Result:= False;
Begin
SetUpSRL;
MouseSpeed(MSpeed)
ActivateClient;
repeat
Begin FindColor;
wait((Betweentime * 1000) + random(300)) if(FindMonk) then if (IsUpText('Attack Monk') then
Mouse(x, y, 10, 10, True);
until (not(LoggedIn))
end;
Procedure EatFood
if(FindColorSpiral(x,y,FoodColor,652,329,650,326)) then
Result:= True;
else
Result:= False;

New Error:

Line 15: [Error] (15897:1): Identifier expected in script C:\Documents and Settings\Owner\Desktop\fighter part(1).scar

Is the rest okay?

r4ndom
12-11-2006, 04:22 PM
program MonkFighter;

{.include srl/srl.scar}
{.include srl/srl/skill/fighting.scar}

const MissedColor = 16728128;
const HitColor = 192;

//////SETUP///////////////////////////////////////////////////////////////////////
Const //
MonkColor = 12172221; //color of the monks robes //
Betweentime = 5000; //Time between finding monks (in millisecs) //
FoodColor = 1598653; //color of the food you are using //
tokill = 20; // //
//////////////////////////////////////////////////////////////////////////////////

Var killed:Integer;

function FindMonk: Boolean;
begin
if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
Result:= True;
end;

Function InFightAt(x, y: Integer):Boolean;
var
dx, dy: Integer;
begin
if ( FindColor(dx, dy, GreenStatusColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, RedStatusColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, MissedColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, HitColor, x - 20, y - 10, x + 20, y + 10) ) then
Result:=True;
end;


Begin
SetUpSRL;
ActivateClient;
MouseSpeed := 8;

repeat
if(findmonk) then
begin
if(not infightat(x,y)) then
begin
mouse(x,y,2,2,True);
killed := killed + 1;
end;
end;

flag;

wait(100);

repeat
wait(random(100));
until(not infight)

until (killed >= tokill)

end.

hope this helps ive got to go now but ill explain the changes later.

Pentti
12-11-2006, 05:49 PM
function FindMonk: Boolean;
begin
if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
Result:= True
else //LINE 15 <<<<
Result:= False;

DaWu
12-11-2006, 07:03 PM
Like the simpliest way

RealEatIfNeeded(Foodcolor,EatHp,False) ;

and add foodcolor and eathp in youre const, it checks youre Hp, if its lower than EatHp set in const, it will eat. Easy 'n' effective.

tarajunky
12-11-2006, 07:43 PM
One tip for you...


function FindMonk: Boolean;
begin
if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
Result:= True;
end;


You aren't actually searching from the center of the screen with that procedure. If you want to search from the center, you need to set x and y before the search. Since you didn't set x and y, they are probably just 0,0, which means you are searching from the top-left just like a normal FindColor does. Also, I don't think you want to search your inventory or the minimap for monk colors, so you should restrict your search to the Mainscreen. To do this you can use the constants already set up in SRL.

MSCX and MSCY are the Main-Screen-Center points for x and y respectively. The corner points for the Main-Screen are MSX1,MSY1,MSX2, MSY2, so you can do it like this...


function FindMonk: Boolean;
begin
x:=MSCX;
y:=MSCY;
if(FindColorSpiral(x,y,MonkColor,MSX1,MSY1,MSX2,MS Y2)) then
Result:= True;
end;

tarajunky
12-11-2006, 07:50 PM
One tip for you...


function FindMonk: Boolean;
begin
if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
Result:= True;
end;


You aren't actually searching from the center of the screen with that procedure. If you want to search from the center, you need to set x and y before the search. Also, I don't think you want to search your inventory or the minimap for monk colors, so you should restrict your search to the Mainscreen. To do this you can use the constants already set up in SRL.

MSCX and MSCY are the Main-Screen-Center points for x and y respectively. The corner points for the Main-Screen are MSX1,MSY1,MSX2, MSY2, so you can do it like this...


function FindMonk: Boolean;
begin
x:=MSCX;
y:=MSCY;
if(FindColorSpiral(x,y,MonkColor,MSX1,MSY1,MSX2,MS Y2)) then
Result:= True;
end;


Also here you need to add a flag command in this section..



if(findmonk) then
begin
if(not infightat(x,y)) then
begin
mouse(x,y,2,2,True);
killed := killed + 1;
FFlag(0); //wait until you reach the monk to attack it
end;
end;


After you click the mouse, you need to wait until you get over to where the monk is, so you should use a flag command, like FFlag(0). If you just click and then immediately start checking to see if you are in combat or not, you will exit your combat waiting loop before you ever reach the monk to attack it.

I Karma I
12-11-2006, 11:42 PM
Thanks :-D

I Karma I
12-12-2006, 09:37 PM
Ok, I have this part of the script:
function FindMonk: Boolean;
begin
x:=MSCX;
y:=MSCY;
if (FindObj(x,y,MonkColor,MSX1,MSY1,MSX2,MSY2)) or (FindObj(x,y,MonkColor2,MSX1,MSY1,MSX2,MSY2)) then
Result:= True;
else
Result:= False;
end;

and it has this error:
Failed when compiling
Line 43: [Error] (15925:47): Invalid number of parameters in script C:\Documents and Settings\Owner\Desktop\MonkFighter.scar

But I believe its the correct amount of parameters?

Junior
12-12-2006, 09:44 PM
This is how its supposed to be setup.
function FindMonk: Boolean;
begin
x:=MSCX;
y:=MSCY;
if (FindObj(x,y,'onk',MonkColor,15)) or (FindObj(x,y,'onk',MonkColor2,15)) then
Result:= True;
else
Result:= False;
end;

I Karma I
12-12-2006, 09:47 PM
Failed when compiling
Line 45: [Error] (15927:1): Identifier expected in script C:\Documents and Settings\Owner\Desktop\MonkFighter

and line 45 is the "else"

I Karma I
12-12-2006, 11:14 PM
Junior helped me on msn, but I still have errors, and this is the latest:
Failed when compiling
Line 88: [Error] (15970:1): period ('.') expected in script C:\Documents and Settings\Owner\Desktop\MonkFighter (Latest2).scar

this is the script:
end;
end

Procedure AntiBan1; //THIS IS THE ERROR LINE.
begin
RandomChatEvery(10 + Random(5));
RotateEvery(10 + Random(10));
LeaveScreenEvery(1);
HoverEvery(8 + Random(5), 'random');
PickUpMouseEvery(5 + Random(10))
RandomRClickEvery(15 + random(5))
if (KillScriptTime > 0) then
KillScript(KillScriptTime);

Hey321
12-12-2006, 11:42 PM
I believe thatd because you missing an end :P.

I Karma I
12-12-2006, 11:52 PM
Where should an end go?

Hey321
12-13-2006, 12:14 AM
after killscript thing i believe.

I Karma I
12-13-2006, 12:18 AM
Nope, it has the same error...