SRL Archive - OSR Help

Failsafe for FindMage-


syberium

2007-02-02 21:38:59

hey guys im working on of my few failsafes and i want it to if finds the mage then exits the procedure, and if it doesent then it will look for 5 times then when attempts>5 it will do NextPlayer(False)
this is what i have so far and its not working.. it find the mage and it just moves the mouse slowly on it from the feet up to the head.. =[
procedure findmage;
begin
if(FindObject(x,y,'amora',magecolor,5,true)) then Exit;
if(not(FindObject(x,y,'amora',magecolor,5,true))) then
begin
repeat
writeln('Coudent find mage make sure ur on west side of cage!')
MakeCompass('E');
highestangle;
attemptss:=attemptss+1;
until(FindObject(x,y,'amora',magecolor,5,true)) or (attemptss > 5);
end;

if (attemptss > 5) then
begin
nextplayer(False);
end;
end;
:spot:

NinjaTerrorist

2007-02-02 23:32:56

Try this:


procedure FindMage;
begin
if(FindObject(FindObject(x, y, 'Amora', MageColor, 5, True))then
begin
Exit;
end
else
begin
if(not(FindObject(x, y, 'Amora', MageColor, 5, True)))then
begin
repeat
Wait(3000+Random(2000));
RandomMovement;
Attempts := Attempts+1;
until(FindObject(x, y, 'Amora', MageColor, 5, True))or(Attempts > 10)
if(Attempts > 10)then
NextPlayer(False);
end;
end;
end;

Junior

2007-02-02 23:51:47

Dont know if this will help or not, but it will do the same thing. Read the notes I wrote inside the script alos.
procedure FindMage;
begin
if (FindObject(x, y, 'Amora', MageColor, 5, True)) then
Exit // dont use a begin end, just use an else.
else //when you use an else, the procedure above cannot contain
begin //a ';', or you'll get a error.
repeat
Wait(3000 + Random (2000));
RandomMovement;
Attempts:= Attempts + 1;
until (FindObject(x, y, 'Amora', MageColor, 5, True)) or (Attempts > 10)
if (FindObject(x, y, 'Amora', MageColor, 5, True)) then //what do you want
Exit //it to do WHEN it finds the obj in the repeat loop?
else //i just put an 'Exit'.
if (Attempts > 10) then
NextPlayer(False);
end;
end;

pwnaz0r

2007-02-03 00:06:26

This is how i wouldo do it,

SetUp an array of Mage of Zammy Colors Such As

MageZammyColor[1] := 00000;
MageZammyColor[2] := 000;
MageZammyColor[3] := 000000000;

(Also have to declare the array)So it would look like this

Procedure FindMage;
begin

for i := 1 to 3 do

repeat //Notice i put the repeat up here
If(FindObj3(x,y,'amara',ZammyMageColor[I],5))and
(FindColorTol(x,y,ZammyMageColor[I],x-20,y-20,x+20,y+20))and
(IsUpText('ttack'))then
exit
else
begin
wait(1+Random(7000));
RandomMovement;
Attempts := Attempts + 1;
until(FindObj3(x,y,'amara',ZammyMageColor[I],5))or(Attempts=10)
if(FindObj3(x,y,'amara',ZammyMageColor[I],5)then
begin
exit;
end;
if(Attempts=10)then
begin
Logout;
NextPlayer(false);
end;
end;
end;

(Have no idea if that will compile did it from memory but you get the idea

syberium

2007-02-03 00:46:58

wow ty so much guys! this helped me alot i learned alot 2! =] ya basiccly its gunna exit from the procedure if it finds the mage and if it doesent find it logs out. just a fail safe =]

o yea also, why the x-20,y-20,x+20,y+20? isent the same as x,y, since -20 and +20 add out to 0?.. Heres what i did only this is i get unknown identifier FindColorTol, prolly cuz i gotta put the include in but heeres how i set it up now.
 procedure ZammyMageColors;
var
ZMage1 : integer;
begin
if(not(LoggedIn)) then exit;
ZMage1 := Random(3)// used random for antiban purposes. :)
case ZMage1 of
1:ZMage[1] := 4147120;
2:ZMage[2] := 2962044;
3:ZMage[3] := 8365780;
end;
end;


Procedure FindMage;
var
i : integer;

begin

for i := 1 to 3 do

repeat //Notice i put the repeat up here
If(FindObj3(x,y,'amara', ZMage[i],5))and
(FindColorTol(x,y, ZMage[i],x-20,y-20,x+20,y+20))and
(IsUpText('ttack'))then
exit
else
begin
wait(1+Random(7000));
RandomMovement;
Attempts := Attempts + 1;
until(FindObj3(x,y,'amara', ZMage[i],5))or(Attempts=10)
if(FindObj3(x,y,'amara', ZMage[i],5)then
begin
exit;
end;
if(Attempts=10)then
begin
Logout;
NextPlayer(false);
end;
end;
end;



this is what i did now. it compiles. it will work right?
procedure ZammyMageColors;
var
ZMage1 : integer;
begin
if(not(LoggedIn)) then exit;
ZMage1 := Random(3)
case ZMage1 of
1:ZMage[1] := 4147120;
2:ZMage[2] := 2962044;
3:ZMage[3] := 8365780;
end;
end;


Procedure FindMage;
var
i : integer;

begin

for i := 1 to 3 do


If(FindObj3(x,y,'amara', ZMage[i],5))and
(IsUpText('ttack'))then
exit
else
begin
repeat
wait(1+Random(7000));
RandomMovement;
Attemptss := Attemptss + 1;
until(FindObj3(x,y,'amara', ZMage[i],5))or(Attemptss=10)
if(FindObj3(x,y,'amara', ZMage[i],5))then
exit;
end;
if(Attemptss=10)then
begin
Logout;
NextPlayer(false);
end;
end;
:)

pwnaz0r

2007-02-03 01:21:56

yer and if it doesnt then try changing the x-20,y-20,x+20,y+20 to like x-30,y-30,x+30,y+30 etc; that is just broadening the square it will look for another color of the zammy mage to verify that it in infact a zammy mage :p

pwnaz0r

2007-02-03 01:26:06

Actually it will not work i dnt believe instead of ZMage1 : integer; at the top of your script variables put

ZMage1 : array [1..3] of integer;

and take off ZMage1 := random(3)

syberium

2007-02-03 02:24:40

ya i fixed those and made it into this but now i get an out of range error.
 
program SyberiumsZammyMager;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\magic.scar}
{.include SRL\SRL\extended\xMapWalk.scar}



{ # ScriptName: Auto Monk of zamorak confuser/weakener/curser! }
{ # ScriptDefinition: Uses confuse/curse/weaken on monk of zammy. }
{ # Instructions: Start in varrock castle on the west side of mage cage!}
{ # Instructions Cont: Pick Color of zammy mage! IMPORTANT! }
{ # Credits: Me for making this! and Fakawi for his antirandom function!}
{ # Lastly have fun and auto safe and correctly!

{ IF the weaken isent working for you do the below instructions.
go to SRL\SRL\skill\magic.scar and replace there BMP with mine.
MAKE SURE U REMOVE THE {} {AROUND THE BMP!}
{ weaken := BitmapFromString(5, 6, 'z78DA33353171347632000143' +
'474B03335717080911C12F8E298BA912975E5333131713235C6A2' +
'0B2986A206C008F6C2631'); }

const
WichSpell=2; // 0 for confuse, 1 for weaken, 2 for curse!
Howmanyto=223;// how many times to cast the above spells.
MSpeed = 25;
StartPlayer = 0; // What player you start with.
NumberOfUsers = 2; // The Number of users you use.
Version = ('1.2') ;



var
Howmany,i : integer;
attemptss : integer;
ZMage : array[1..3] of integer;
ZMageI : integer;

procedure DeclarePlayers;

begin
HowManyPlayers := NumberOfUsers;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := StartPlayer;


Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='iil';
Players[0].Active:=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='ill';
Players[1].Active:=True;
{
Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Active:=True;

Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Active:=True;

Players[4].Name :='';
Players[4].Pass :='';
Players[4].Nick :='';
Players[4].Active:=True; }
end;

Function FindFastRandoms: Boolean;
var
i: Integer;
begin
for i:=1 to 8 do
begin
case I of
1: If FindDead then
Result := True;
2: If FindMod then
Result := True;
3: If FindMime then
Result := True;
4: If FindMaze then
Result := True;
5: If FindQuiz then
Result := True;
6: If FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
FindTalk;
end;
end;


function ZCastOn(Spell, Monster: string; MonsterColor : Integer; Tolerance:
Integer): Boolean;
var
tx,ty : integer;

begin
for ZMageI := 1 to 3 do
tx := tx + 10;
ty := ty + 10;
if (not Cast(Spell)) then Exit;
if (FindObj3(tx, ty, Monster, ZMage[ZMageI], Tolerance)) then
begin
Mouse(tx,ty, 0, 0, True);
Result := True;
end;
end;



procedure ZammyMageColors;
begin
ZMage[1] := 3949222;
ZMage[2] := 2369896;
ZMage[3] := 8365780;
end;



{Procedure FindMage;


begin

for i := 1 to 3 do


If(FindObject(x,y,'amara', ZMage[i],5,true))and
(IsUpText('ttack'))then
exit
else
begin
repeat
wait(1+Random(7000));
Face('E');
HighestAngle;
Attemptss := Attemptss + 1;
until(FindObject(x,y,'amara', ZMage[i],5,true))or(Attemptss=10)
if(FindObject(x,y,'amara', ZMage[i],5,true))then
exit;
end;
if(Attemptss=10)then
begin
Logout;
NextPlayer(false);
end;
end; }



procedure zammymage;
var
Spell : String;
begin
for ZMageI := 1 to 3 do

case wichspell of
0: Spell:='Confuse';
1: Spell:='Weaken';
2: Spell:='Curse';
end;
Wait(300+random(200));
Wait(200+random(200));
ZCastOn(Spell,'amora',ZMage[ZMageI],5);//Line 187<<------<<
howmany := howmany+1;
if(howmanyto=howmany) then
NextPlayer(False);
end;




Procedure DoChats;

Begin
SetChat('On', 1);
SetChat('Friends', 2)
SetChat('On', 3);
End;

procedure progress;
begin

writeln('[===============================================]')
writeln('[ Syberiums Zammy Mager ')
writeln('[ Completed ' +IntToStr(howmany)+ ' Zammy Mage Casts!')
writeln('[ Worked For ' +TimeRunning)
writeln('[Thank You for using my script! Post Proggies =]')
SRLrandomsreport;
writeln('[==============================================]')
end;

procedure antiban1;
var DBANME : integer;
begin
writeln('Antiban1')
if (not(loggedIn)) then Exit;
DBANME := Random(80);
case DBANME of
1:Hoverskill('magic',False) ;
2:pickupmouse;
3:DoEmote(1 + random(20));
end;
end;

procedure antiban2;
var DBANME1 : integer;
begin
writeln('AntiBan2')
if(not(LoggedIn)) then Exit;
DBANME1 := Random(200);
case DBANME1 of
1:ZCastOn('Weaken','amora',ZMage[i],5);
end;
end;

begin
SetupSRL;
activateclient;
ClearDebug;
DeclarePlayers;
CurrentPlayer := StartPlayer;
if(not(LoggedIn)) then LoginPlayer;
DoChats;
MouseSpeed := MSpeed + Random(3)
MakeCompass('E');
Highestangle;
ZammyMageColors;
//FindMage;
repeat
zammymage;
progress;
Wait(100+random(10));
antiban1;
antiban2;
FindFastRandoms;
until(howmanyto=howmany);

writeln('dbuf 1');
end.

pwnaz0r

2007-02-04 13:10:05

ok do this
at the top of your script in the variables add

i : integer;

then do this

for i := 1 to 3 do
ZCastOn(Spell,'amora',ZMage[ZMageI],5);

syberium

2007-02-04 15:19:58

thats what i have.. look at vars it sais
 var 
howmany,i : integer;
and this is what i used
 var 
ZMageI:integer;

procedure zammymage;
var
Spell : String;
begin
for ZMageI := 1 to 3 do

case wichspell of
0: Spell:='Confuse';
1: Spell:='Weaken';
2: Spell:='Curse';
end;
Wait(300+random(200));
Wait(200+random(200));
ZCastOn(Spell,'amora',ZMage[ZMageI],5);
howmany := howmany+1;
if(howmanyto=howmany) then
NextPlayer(False);
end;


still not working it compiles then i get out of range error..

syberium

2007-02-04 15:53:04

W00t!!!! I fixed it!! thanks for the help guys! ive figured out what was wrong. it was a farely stupid mistake.. but ay live and learn. well heres what was wrong
 

procedure zammymage;
var
Spell : String;
begin
for ZMageI := 1 to 3 do

case wichspell of
0: Spell:='Confuse';
1: Spell:='Weaken';
2: Spell:='Curse';
end;
Wait(300+random(200));
Wait(200+random(200));
ZCastOn(Spell,'amora',ZMage[ZMageI],5);
howmany := howmany+1;
if(howmanyto=howmany) then
NextPlayer(False);
end;

^^ i had the declared the array length then i ended the script. so therefore the out of range error came up. i fixed it with this.
 
procedure zammymage;
var
Spell : String;
begin

case wichspell of
0: Spell:='Confuse';
1: Spell:='Weaken';
2: Spell:='Curse';
end;
begin
for ZMageI := 0 to 2 do
Wait(300+random(200));
Wait(200+random(200));
MouseSpeed := MSpeed + Random(6);
CastOn(Spell,'amora',ZMage[ZMageI],5);
howmany := howmany+1;
if(howmanyto=howmany) then
NextPlayer(False);
end;
end;


how come i get this error now..? not script related doesent seem to affect anything.. this is the error im seeing:
HTTP/1.1 404 Not Found

pwnaz0r

2007-02-04 23:06:22


program SyberiumsZammyMager;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\magic.scar}
{.include SRL\SRL\extended\xMapWalk.scar}



{ # ScriptName: Auto Monk of zamorak confuser/weakener/curser! }
{ # ScriptDefinition: Uses confuse/curse/weaken on monk of zammy. }
{ # Instructions: Start in varrock castle on the west side of mage cage!}
{ # Instructions Cont: Pick Color of zammy mage! IMPORTANT! }
{ # Credits: Me for making this! and Fakawi for his antirandom function!}
{ # Lastly have fun and auto safe and correctly!

{ IF the weaken isent working for you do the below instructions.
go to SRL\SRL\skill\magic.scar and replace there BMP with mine.
MAKE SURE U REMOVE THE {} {AROUND THE BMP!}
{ weaken := BitmapFromString(5, 6, 'z78DA33353171347632000143' +
'474B03335717080911C12F8E298BA912975E5333131713235C6A2' +
'0B2986A206C008F6C2631'); }

const
WichSpell=2; // 0 for confuse, 1 for weaken, 2 for curse!
Howmanyto=223;// how many times to cast the above spells.
MSpeed = 25;
StartPlayer = 0; // What player you start with.
NumberOfUsers = 2; // The Number of users you use.
Version = ('1.2') ;



var
Howmany,i : integer;
attemptss : integer;
ZMage : array[1..3] of integer;
ZMageI : integer;

procedure DeclarePlayers;

begin
HowManyPlayers := NumberOfUsers;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := StartPlayer;


Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='iil';
Players[0].Active:=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='ill';
Players[1].Active:=True;
{
Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Active:=True;

Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Active:=True;

Players[4].Name :='';
Players[4].Pass :='';
Players[4].Nick :='';
Players[4].Active:=True; }
end;

Function FindFastRandoms: Boolean;
var
i: Integer;
begin
for i:=1 to 8 do
begin
case I of
1: If FindDead then
Result := True;
2: If FindMod then
Result := True;
3: If FindMime then
Result := True;
4: If FindMaze then
Result := True;
5: If FindQuiz then
Result := True;
6: If FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
FindTalk;
end;
end;


function ZCastOn(Spell, Monster: string; MonsterColor : Integer; Tolerance:
Integer): Boolean;
var
tx,ty : integer;

begin
for ZMageI := 1 to 3 do
tx := tx + 10;
ty := ty + 10;
if (not Cast(Spell)) then Exit;
if (FindObj3(tx, ty, Monster, ZMage[ZMageI], Tolerance)) then
begin
Mouse(tx,ty, 0, 0, True);
Result := True;
end;
end;



procedure ZammyMageColors;
begin
ZMage[1] := 3949222;
ZMage[2] := 2369896;
ZMage[3] := 8365780;
end;



{Procedure FindMage;


begin

for i := 1 to 3 do


If(FindObject(x,y,'amara', ZMage[i],5,true))and
(IsUpText('ttack'))then
exit
else
begin
repeat
wait(1+Random(7000));
Face('E');
HighestAngle;
Attemptss := Attemptss + 1;
until(FindObject(x,y,'amara', ZMage[i],5,true))or(Attemptss=10)
if(FindObject(x,y,'amara', ZMage[i],5,true))then
exit;
end;
if(Attemptss=10)then
begin
Logout;
NextPlayer(false);
end;
end; }



procedure zammymage;
var
Spell : String;
begin

case wichspell of
0: Spell:='Confuse';
1: Spell:='Weaken';
2: Spell:='Curse';
end;
Wait(300+random(200));
Wait(200+random(200));
for ZMageI := 1 to 3 do
ZCastOn(Spell,'amora',ZMage[ZMageI],5);//Line 187<<------<<
howmany := howmany+1;
if(howmanyto=howmany) then
NextPlayer(False);
end;




Procedure DoChats;

Begin
SetChat('On', 1);
SetChat('Friends', 2)
SetChat('On', 3);
End;

procedure progress;
begin

writeln('[===============================================]')
writeln('[ Syberiums Zammy Mager ')
writeln('[ Completed ' +IntToStr(howmany)+ ' Zammy Mage Casts!')
writeln('[ Worked For ' +TimeRunning)
writeln('[Thank You for using my script! Post Proggies =]')
SRLrandomsreport;
writeln('[==============================================]')
end;

procedure antiban1;
var DBANME : integer;
begin
writeln('Antiban1')
if (not(loggedIn)) then Exit;
DBANME := Random(80);
case DBANME of
1:Hoverskill('magic',False) ;
2:pickupmouse;
3:DoEmote(1 + random(20));
end;
end;

procedure antiban2;
var DBANME1 : integer;
begin
writeln('AntiBan2')
if(not(LoggedIn)) then Exit;
DBANME1 := Random(200);
case DBANME1 of
1:ZCastOn('Weaken','amora',ZMage[i],5);
end;
end;

begin
SetupSRL;
activateclient;
ClearDebug;
DeclarePlayers;
CurrentPlayer := StartPlayer;
if(not(LoggedIn)) then LoginPlayer;
DoChats;
MouseSpeed := MSpeed + Random(3)
MakeCompass('E');
Highestangle;
ZammyMageColors;
//FindMage;
repeat
zammymage;
progress;
Wait(100+random(10));
antiban1;
antiban2;
FindFastRandoms;
until(howmanyto=howmany);

writeln('dbuf 1');
end.