Wizkid
2011-07-21 22:05:56
Trying to learn your include, coming from a somewhat similliar language :redface:
Been looking a lot into other scripts and used what I can. Also managed to read some tutorials on arrays(TStringArray := ['', ''] ect)
All feedback is gladly received! :D
Been looking a lot into other scripts and used what I can. Also managed to read some tutorials on arrays(TStringArray := ['', ''] ect)
All feedback is gladly received! :D
program VerySimpleCowKiller;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
procedure SetupScript;
begin
MouseSpeed := 20;
LampSkill := 'mining';
HowManyPlayers:= 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
With Players[0] do
begin
Name := '';
Pass := '';
Active := True;
BoxRewards := ['lamp']
end;
end;
Function FindClosestCow: Boolean;
var
NPCs: TNPCArray;
P: TPoint;
I, T: Integer;
begin
NPCs := R_SortNPCs(R_GetNPCsMulti([12365, 12363, 12362], False));
For I:=0 to High(NPCs)do
begin
If NPCs[I].InCombat then
Continue;
If Not R_TileOnMS(NPCs[I].Tile, Round(NPCs[I].Height div 2))then
begin
R_WalkToTile(NPCs[I].Tile, 2, 2);
Flag;
Result := FindClosestCow;
Exit;
end;
Repeat
P := R_TileToMSEx(NPCs[I].Tile, 0, 0, Round(NPCs[I].Height div 2));
MMouse(P.X, P.Y, 4, 4);
Inc(T);
Until(R_WaitUpText('Attack Cow', 90+Random(60)))or(T = 3);
If Not (T = 3)then
begin
GetMousePos(P.X, P.Y);
Mouse(P.X, P.Y, 0, 0, True);
Result := R_WaitCrossHairColor(CROSSHAIR_RED, 800+Random(200));
end;
If Not Result then
begin
R_FindRandoms;
Result := FindClosestCow;
end;
Exit
end;
end;
Procedure PickupItems;
var
Ground: TGroundItemArray;
P: TPoint;
I: Integer;
begin
If InvFull then
Exit;
If R_FindGroundItemsEx([526, 1739], 6, Ground)then
begin
For I:=0 to High(Ground)do
begin
P := R_TileToMS(Ground[I].Tile, 0);
Mouse(P.X, P.Y, 2, 2, False);
R_WaitOptionMulti(['Take Bones', 'Take Cowhide'], 200+Random(100));
Wait(900+Random(600));
Flag;
end;
end;
end;
Procedure BuryBones;
var
Inv: TInvItemArray;
I: Integer;
begin
If R_ItemExistsEx([526], Inv)then
For I:=0 to High(Inv)do
begin
R_ClickItem(Inv[I].Slot, 'Bury');
Wait(1400+Random(400));
end;
end;
function Fight: boolean;
var
T: Integer;
begin
T := GetSystemTime + 2567;
repeat
wait(66)
if (R_GetAnimation > -1) then
Result := true;
until Result or (GetSystemTime > T);
end;
Procedure WaitFight;
var
T: integer;
Begin
If(Not LoggedIn)Then
Exit;
While IsMoving do
Wait(100+Random(100));
T := GetSystemTime + 3500;
Repeat
Wait(100);
if (GetSystemTime > T) then
Exit;
R_FindRandoms;
until Fight;
repeat
wait(50+random(100));
R_FindRandoms;
until(not Fight);
End;
Procedure Report;
begin
end;
begin
SMART_Members := False;
SMART_Server := 32;
SMART_Signed := True;
{Setup}
SetupSRL;
SetupScript;
If Not LoggedIn then
LoginPlayer;
SetAngle(True);
Repeat
If Not LoggedIn then
begin
NextPlayer(False);
SetAngle(True);
end;
If Not R_InCombat then
begin
If FindClosestCow then
begin
Wait(1500+Random(1000));
Flag;
WaitFight;
Wait(700+Random(600));
PickupItems;
If Random(3) = 0 then
BuryBones;
end;
end;
Until(AllPlayersInactive);
end.