Troll
07-22-2011, 04:49 PM
Ok so i started i write a zombie fighter for the strong hold (bottom left secound floor) and it was just starting out and its my first script. I was also botting with rsbuddy to get my stats up there and bamm i got banned. So i have come to a stop for 2 weeks. Please can you look at my code/test it to see if it works :p
~Thanks
E: Just posting the code here
program new;
{$i SRL/SRL.scar}
Type
MonsterInfo = Record // so that i can add more later
MonName : String;
SecoundName : String; // so if a monster in the same room has same colour
MonColour : Integer;
MonSat : Extended;
MonHue : Extended;
MonToll : Integer;
End;
Type
FoodInfo = Record
FoodName : String;
DTM : String;
HealPoint : Integer;
End;
Function SetFood(TheName:String):FoodInfo;
Begin
Case TheName Of
'swordfish' : With Result Do
Begin
FoodName := 'Swordfish';
DTM := '';
HealPoint := 54;
End;
End;
End;
Function SetMonster(TheName:String; Which:Integer):MonsterInfo;
Begin
Case TheName Of
'zombie':Begin
Case Which Of
1:
With Result Do
Begin
MonName := 'Zombie';
SecoundName := 'Gaint rat';
MonColour := 2045728;
MonSat := 3.32;
MonHue := 2.35;
MonToll := 8;
End;
2:
With Result Do
Begin
MonName := 'False';
SecoundName := 'GaintRat';
MonColour := 5198163;
MonSat := 0.02;
MonHue := 0.50;
MonToll := 17;
End;
3:
With Result Do
MonName := 'False';
End;
End;
End;
End;
Function FindMonster(TheName:String):Boolean;
Var
x,y,a,i:Integer;
TheTPA:TPointArray;
ATPA: TPointArrayArray;
Click:TPoint;
Monster:MonsterInfo;
Begin
If Not LoggedIn Then Exit;
a := 1;
Repeat
Monster := SetMonster(Thename,a);
If (Monster.MonName = 'False') Then
Begin
writeln('Ran out of usable colours, exiting');
Result := False
Exit;
End;
SetColorspeed2Modifiers(Monster.MonHue,Monster.Mon Sat); //as the colour can change
If FindColorsSpiralTolerance(x,y,TheTPA,Monster.MonCo lour,MSX1,MSY1,MSX2,MSY2,Monster.MonToll) Then
Begin
writeln('Found colour');
SetColorToleranceSpeed(1);
If Length(TheTPA)>0 Then
Begin
writeln('Found it atleast once');
ATPA := TPAtoATPAEx(TheTPA,5,5);
For I:= 0 to High(ATPA) Do
Begin
Click :=MiddleTPA(ATPA[I]);
MMouse(Click.x,click.y,RandomRange(-3,3),RandomRange(-3,3));
writeln('Moved mouse to colour');
If (WaitUptext(Monster.MonName,1000) or WaitUpText(Monster.SecoundName,1000)) Then
Begin
writeln('Found Uptext');
GetMousePos(x,y);
If Random(20) = 5 Then
Begin
Mouse(x,y,0,0,False);
If WaitOption('Attack',1000) Then
Begin
Result := True;
writeln('Found and click monster');
wait(2500);
Exit;
End Else Begin
Mouse(x,y,0,0,True);
writeln('Found and clicked monster');
Result := True;
Wait(2500);
Exit;
End;
End;
End;
End;
End;
Inc(A);
End;
Until(False);
End;
Function Fighting:Boolean;
var timer,totalxp:Integer;
Begin
ToggleXPBar(True);
TotalXP := GetXPBarTotal;
writeln('Entered Fighting loop');
MarkTime(timer);
Repeat
If Not (TotalXP = GetXPBarTotal) Then
Begin
writeln('XP has changed');
Result := True
Exit;
End;
wait(750); //1 mins?
Until(TimeFromMark(timer)>=1000*60)
End;
{
Function Eat:Boolean;
Begin
If FindDTM(DTM,x,y,MIX1,MIY1,MIX2,MIY2) Then
Begin
MMouse(x,y,4,4);
}
begin
SetupSRL;
writeln('Setup SRL');
ActivateClient;
writeln('ActivateClient');
FindMonster('zombie');
writeln('Called FindMonster');
While Fighting Do
Begin
Wait(750);
writeln('in fight');
End;
writeln('not in fight');
end.
~Thanks
E: Just posting the code here
program new;
{$i SRL/SRL.scar}
Type
MonsterInfo = Record // so that i can add more later
MonName : String;
SecoundName : String; // so if a monster in the same room has same colour
MonColour : Integer;
MonSat : Extended;
MonHue : Extended;
MonToll : Integer;
End;
Type
FoodInfo = Record
FoodName : String;
DTM : String;
HealPoint : Integer;
End;
Function SetFood(TheName:String):FoodInfo;
Begin
Case TheName Of
'swordfish' : With Result Do
Begin
FoodName := 'Swordfish';
DTM := '';
HealPoint := 54;
End;
End;
End;
Function SetMonster(TheName:String; Which:Integer):MonsterInfo;
Begin
Case TheName Of
'zombie':Begin
Case Which Of
1:
With Result Do
Begin
MonName := 'Zombie';
SecoundName := 'Gaint rat';
MonColour := 2045728;
MonSat := 3.32;
MonHue := 2.35;
MonToll := 8;
End;
2:
With Result Do
Begin
MonName := 'False';
SecoundName := 'GaintRat';
MonColour := 5198163;
MonSat := 0.02;
MonHue := 0.50;
MonToll := 17;
End;
3:
With Result Do
MonName := 'False';
End;
End;
End;
End;
Function FindMonster(TheName:String):Boolean;
Var
x,y,a,i:Integer;
TheTPA:TPointArray;
ATPA: TPointArrayArray;
Click:TPoint;
Monster:MonsterInfo;
Begin
If Not LoggedIn Then Exit;
a := 1;
Repeat
Monster := SetMonster(Thename,a);
If (Monster.MonName = 'False') Then
Begin
writeln('Ran out of usable colours, exiting');
Result := False
Exit;
End;
SetColorspeed2Modifiers(Monster.MonHue,Monster.Mon Sat); //as the colour can change
If FindColorsSpiralTolerance(x,y,TheTPA,Monster.MonCo lour,MSX1,MSY1,MSX2,MSY2,Monster.MonToll) Then
Begin
writeln('Found colour');
SetColorToleranceSpeed(1);
If Length(TheTPA)>0 Then
Begin
writeln('Found it atleast once');
ATPA := TPAtoATPAEx(TheTPA,5,5);
For I:= 0 to High(ATPA) Do
Begin
Click :=MiddleTPA(ATPA[I]);
MMouse(Click.x,click.y,RandomRange(-3,3),RandomRange(-3,3));
writeln('Moved mouse to colour');
If (WaitUptext(Monster.MonName,1000) or WaitUpText(Monster.SecoundName,1000)) Then
Begin
writeln('Found Uptext');
GetMousePos(x,y);
If Random(20) = 5 Then
Begin
Mouse(x,y,0,0,False);
If WaitOption('Attack',1000) Then
Begin
Result := True;
writeln('Found and click monster');
wait(2500);
Exit;
End Else Begin
Mouse(x,y,0,0,True);
writeln('Found and clicked monster');
Result := True;
Wait(2500);
Exit;
End;
End;
End;
End;
End;
Inc(A);
End;
Until(False);
End;
Function Fighting:Boolean;
var timer,totalxp:Integer;
Begin
ToggleXPBar(True);
TotalXP := GetXPBarTotal;
writeln('Entered Fighting loop');
MarkTime(timer);
Repeat
If Not (TotalXP = GetXPBarTotal) Then
Begin
writeln('XP has changed');
Result := True
Exit;
End;
wait(750); //1 mins?
Until(TimeFromMark(timer)>=1000*60)
End;
{
Function Eat:Boolean;
Begin
If FindDTM(DTM,x,y,MIX1,MIY1,MIX2,MIY2) Then
Begin
MMouse(x,y,4,4);
}
begin
SetupSRL;
writeln('Setup SRL');
ActivateClient;
writeln('ActivateClient');
FindMonster('zombie');
writeln('Called FindMonster');
While Fighting Do
Begin
Wait(750);
writeln('in fight');
End;
writeln('not in fight');
end.