SRL Archive - OSR Help

Error


King

2013-02-08 21:38:42

I keep getting this error when trying to make a multiplayer progress report following abu_jwka's tutorial, It runs fine then gets this after the proggy is called, ideas?

Error:



Script:

program KingsWaterfiends; //Made by SRLKing V1.1
{$Define smart8}
{$i srl/srl.simba}
{$I SRL/srl/skill/fighting.Simba}
{$i sps/sps.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
{$i 3DProjection.simba}

type
MSObject = record
Col, Tol, TPADist, MinCount: Integer;
Hue, Sat: Extended;
Uptext: TStringArray;
MMDot: String;
end;

var
LoadsToDo, LastClickMonster, GamesNecklace, ROD, BunyipPouch: Integer;
MonstersKilled, x, y, t, b, InvCounts, CurrentHP: Integer;
ReplaceGamesNecklace, ReplaceRingofDuelling, ReplaceSummoningPouch: Boolean;
colorsign: string;
WaterFiend: MSObject;
CurrentXP, OriginalXP: Integer;
XPGain, LoadsDone, XPPerHour, Crimson, Blue, Green, Gold: Array of Integer;
TimeGone, LoadsPerHour, CharmsPerHour1, CharmsPerHour2, CharmsPerHour3, CharmsPerHour4: Array of Integer;

procedure SetArrayLengths;
begin
SetLength(TimeGone,HowManyPlayers);
SetLength(XPPerHour,HowManyPlayers);
SetLength(LoadsPerHour,HowManyPlayers);
SetLength(XPGain,HowManyPlayers);
SetLength(LoadsDone,HowManyPlayers);
SetLength(Crimson,HowManyPlayers);
SetLength(Blue,HowManyPlayers);
SetLength(Green,HowManyPlayers);
SetLength(Gold,HowManyPlayers);
SetLength(CharmsPerHour1,HowManyPlayers);
SetLength(CharmsPerHour2,HowManyPlayers)
SetLength(CharmsPerHour3,HowManyPlayers)
SetLength(CharmsPerHour4,HowManyPlayers)
end;


procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; //Username to log in
Pass := ''; //Password to log in
Active := True; //Will we be using this player?
Pin := ''; //Pin
Nick := ''; //NickName for progress reports(Will be added)
end;
end;

{ with Players[1] do // Uncomment to add players
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Nick := '';
end;
end;

with Players[2] do
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Nick := '';
end;
end;

with Players[3] do
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Nick := '';
end;
end; }

const
//-------------------Script Settings-------------------//

TripsToDo = 5; //Trips to make to the cave and back

FoodType = 'Shark'; //Exact name of the food being used

Potions = 'True';//True = Will use False = will not use

PotionToUse = 'Ranging potion'; //Name of the potion exactly as seen in game

LevelToPot = 95; //Not used in the version, will update it.

HpToEatAt = 5000; // Hp to eat at

FoodToBring = 20; // Amount of food to bring

FoodBound = '-'; //key that is bound to your food slot.

PotionBoundKey = '0'; //Key that is bound to your ranging potion/overload ect.

Bunyip = 'True';//True = use summoning, False = dont use summoning

RechargeSummoningLevel = 30;// Level to recharge summoning points at

UseUltimateAbilities = 'False';//True, does not use Threshold and uses ultimate abilities,
//False Uses threshold and not ultimate abilities
UseFairyRing = 'True';// Teleport using fairy rings and bank in zanaris? Not implemented yet.


//-------------------Ability Settings-------------------//

// Use 750 if no wait time is listed (Ex Piercing shot), If a wait time is listed (Rapid Fire, multiply the number of
// Seconds by a thousand and add 200, that will be the wait time)

Basic1 = 1; //What slot for basic ability number 1
UseTimeBasic1 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

Basic2 = 2; //What slot for basic ability number 2
UseTimeBasic2 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

Basic3 = 3; //What slot for basic ability number 3
UseTimeBasic3 = 3200;// Time in miliseconds (1000 = 1 Second) to use the ability

Basic4 = 4; //What slot for basic ability number 4
UseTimeBasic4 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

ThreshHold1 = 5; //What slot for ThreshHold ability number 1
UseTimeThreshHold1 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

ThreshHold2 = 7; //What slot for ThreshHold ability number 3
UseTimeThreshHold2 = 6200;// Time in miliseconds (1000 = 1 Second) to use the ability

Ultimate1 = 8; //What slot for Ultimate ability number 1
UseTimeUltimate1 = 6200;// Time in miliseconds (1000 = 1 Second) to use the ability

Ultimate2 = 9; //What slot for Ultimate ability number 2
UseTimeUltimate2 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability





procedure LoadFigures; //Credits to ReadySteadyGo
begin //Loads the colors and variables for finding the waterfiend
with WaterFiend do
begin
Col := 5390364;
Tol := 9;
TPADist := 10;
Hue := 0.31;
Sat := 1.98;
UpText := ['ack Water'];
MMDot := 'yellow';
MinCount := 40;
end;
end;

function MakeBox(x1, y1, x2, y2: Integer): TBox; //Credits to ReadySteadyGo
begin
Result.X1 := x1;
Result.Y1 := y1;
Result.X2 := x2;
Result.Y2 := y2;
end;

function FindMSObjects(var Coords: TPointArray; Obj: MSObject): Boolean; //Credits to ReadySteadyGo
var
cts, Len, i, c: Integer;
TPA: TPointArray;
ATPA: TPointArrayArray;
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Obj.Hue, Obj.Sat);

Result := False;

c:= 0;
if FindColorsTolerance(TPA, Obj.Col, MSX1, MSY1, MSX2, MSY2, Obj.Tol) then
begin
Result := True;
ATPA := SplitTPA(TPA, Obj.TPADist);
Len := Length(ATPA);
SetLength(Coords, Len);
for i := 0 to Len-1 do
begin
if Length(ATPA[i]) > Obj.MinCount then
begin
Coords[c] := MiddleTPA(ATPA[i]);
Inc(c);
end;
end;
end;
SetLength(Coords, c)
ColorToleranceSpeed(cts);
SetColorSpeed2Modifiers(0.2, 0.2);
end;

function FindRedBar : Boolean; // Credit goes to Shatterhand
var
RedBarDTM1, RedBarDTM2, RedBarDTM3: Integer;
begin
Result := False;
RedBarDTM1 := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w={mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w=}');
RedBarDTM2 := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w={mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w=}'); //Updated his DTM
RedBarDTM3 := DTMFromString('mbQAAAHicY2VgYFAHYicg5oay1YCYEwmzATEPEO9k4GCwZmdCwXJAcS40zIgFgwEAz+gDEA==');

if FindDTM(RedBarDTM1,X,Y,MSX1,MSY1,MSX2,MSY2) or
FindDTM(RedBarDTM2,X,Y,MSX1,MSY1,MSX2,MSY2) or
FindDTM(RedBarDTM3,X,Y,MSX1,MSY1,MSX2,MSY2) then
begin
SMART_DrawBoxEx(false,false,IntToBox(X-30,Y-10,X+30,Y+10),ClYellow);
Wait(50);
SMART_ClearCanvasArea(IntToBox(0,MSY1,520,MSY2+50));
Result := True;
end;
FreeDTM(RedBarDTM1);
FreeDTM(RedBarDTM2);
FreeDTM(RedBarDTM3);
end;

Procedure Looting(); //Function origionaly by SeanStar, modified to work and pick up more than just charms.
begin
if (FindRedBar) then
begin
wait(1200);
if (FindRedBar) then
wait(200);
MMouse(X+random(1),Y+21,0,0);
wait(1000+random(200));
ClickMouse2(False);
WaitOptionMulti(['ake Crims','ake Gold c', 'ake Green', 'ake Blue c','ake Sea','ake Water or','ake Snap','ake Shar','ake Mithril','une elm'], 1000);
wait(500+random(100));
repeat
wait(300+random(100));
until( not IsMoving)
repeat
wait(RandomRange(500, 750));
MMouse(262, 178, 0, 0);
ClickMouse2(False);
until(not(WaitOptionMulti(['ake Crims','ake Gold c', 'ake Green', 'ake Blue c','ake Sea','ake Water or','ake Snap','ake Shar','ake Mithril','une elm'], 1000)));
end
else
begin
exit;
writeln('No Red Bar Detected');
end;
end;

function FindMSObjectsByDot(var Coords: TPointArray; Obj: MSObject): Boolean; //Credits to ReadySteadyGo
var
BoxArr: TBoxArray;
Len, Len2, i, j, c: Integer;
TPA, TPA2: TPointArray;
begin
TPA := GetMMDotsOnMS2(Obj.MMDot, False);
Len := Length(TPA);
SetLength(BoxArr, Len);

for i := 0 to Len-1 do
BoxArr[i] := MakeBox(TPA[i].x-70, TPA[i].y-70, TPA[i].x+70, TPA[i].y+70);

if FindMSObjects(TPA2, Obj) then
begin

Len2 := Length(TPA2);
SetLength(Coords, Len2);

c := 0;
for i := 0 to Len2-1 do
for j := 0 to Len-1 do
if PointInBox(TPA2[i], BoxArr[j]) then
begin
Coords[c] := TPA2[i];
Inc(c);

Break;
end;
SetLength(Coords, c);
Result := (c > 0);
end;

end;



function FindArrow: Boolean; //Finds the arrow DTM to determine if in a fight
var
tmpCTS: integer;
ArrowTPA: TPointArray;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(1.88, 1.16);
if FindColorsTolerance(ArrowTPA, 13032391, 706, 230, 730, 247, 16) then
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
Result := True;
end
else
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
Result := False;
end;
end;


function Fighting: Boolean; //Determines if we are fighting
begin
if not (GetCurrentTab = tab_Combat) then
begin
GameTab(tab_Combat);
wait(RandomRange(1000, 1200));
end
else
wait(RandomRange(750, 1000 ));
if FindArrow then
begin
writeln('We still have a target');
Result := True;
exit;
end
else
begin
Result := False;
writeln('No longer fighting');
exit;
end;
end;

function FindCaveFloor: Boolean; //Finds the cave floor, to decide if we are in the ancient cavern
var
tmpCTS: integer;
FloorTPA: TPointArray;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.11, 0.61);
if FindColorsTolerance(FloorTPA, 4736522, MSX1, MSY1, MSX2, MSY2, 3) then
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
Result := True;
end
else
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
Result := False;
end;
end;


function OpenBankCW: Boolean;
var
b, t, FailCount: Integer;
begin
if not LoggedIn then
Exit;
MarkTime(b);
repeat
MarkTime(t);
writeln('Trying to open the bank');
OpenBankChestEdge(SRL_BANK_CW);
repeat
wait(100);
until (BankScreen or (TimeFromMark(t) > 5000) or PinScreen);
if BankScreen or PinScreen then
begin
writeln('Opened the Bank');
if PinScreen then
begin
InPin(Players[0].Pin);
writeln('Inputting players pin');
end;
Result := True;
exit;
end;
if not (PinScreen or BankScreen) then
begin
writeln('Failed to find and open the bank');
Inc(FailCount);
if FailCount = 10 then
begin
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
writeln('Could not open the bank');
exit;
end;
end;
until ((TimeFromMark(b) > 70000) or BankScreen);
exit;
ClearDebug;
end;

function TeleportToCW: Boolean;
begin
if (not GameTab(tab_Equip)) then
begin
GameTab(tab_Equip);
end;
MouseBox(682, 369, 714, 401, 2);
WaitUptext('ing of duell', 1000);
ClickMouse2(mouse_right);
WaitOption('Castle Wars', 500);
MarkTime(t);
repeat
wait(50)
until ((FindSymbol(x, y, Symbol_Bank)) or (TimeFromMark(t) >= 25000));
if FindSymbol(x, y, Symbol_Bank) then
begin
result := true;
writeln('We are at the bank');
if FindBlackChatMessage('Your ring of duelling crumbles to dust.') then
begin
ReplaceRingofDuelling:= True;
end else
begin
ReplaceRingofDuelling:= False;
end;
if FindSymbol(x, y, Symbol_Bank) then
begin
Mouse(x, y, 2, 2, True);
end;
exit;
end
else
result := false;
writeln('Did not teleport to the bank');
exit;
end;


function Eating: Boolean;
begin
CurrentHP := GetMMLevels('hp', colorsign);
wait(RandomRange(50, 150));
if CurrentHP < HpToEatAt then
begin
SendKeys(FoodBound, 50, 5);
begin
MarkTime(t);
repeat
wait(50);
until ((CurrentHP < GetMMLevels('hp', colorsign)) or (TimeFromMark(t) >= 6000));
if GetMMLevels('hp', colorsign) > HpToEatAt then
begin
Result := True;
exit;
end
else
begin
if (GetMMLevels('hp', colorsign) < 2000) then
begin
TeleportToCW;
writeln('Banking because we are out of food and low on health');
exit;
end;
Result := False;
exit;
end;
end;
end
else
begin
exit;
end;
end;

function CheckPotLevel:Boolean;
begin
if (Potions = 'True') then
begin
if (GetSkillLevel('range') <= LevelToPot) then
begin
SendKeys(PotionBoundKey, 50, 20);
wait(RandomRange(750, 1000));
if (GetSkillLevel('range') > LevelToPot) then
begin
result := true;
exit;
end
else
begin
result := false;
exit;
end;
end
else
begin
exit;
end;
end
else
begin
exit;
end;
end;



Function FindWaterFiend:boolean;
var
TPA: TPointArray;
i, TPAlen, x, y: Integer;
begin
if Fighting then
begin
writeln('Already in a fight');
Result:=True;
exit;
end
else
if FindMSObjectsByDot(TPA, WaterFiend) then
begin
TPAlen := Length(TPA);
SortTPAFrom(TPA, Point(MMCX, MMCY));
for i := 0 to TPAlen-1 do
begin
MMouse(TPA[i].x, TPA[i].y, 5, 5);
if WaitUpTextMulti(WaterFiend.UpText, 150) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
if DidYellowClick then
begin
WriteLn('Missed the waterfiend');
Result:=False;
Exit;
end;
if GetColor(x, y) = 65278 then
begin
FFlag(2);
Wait(500);
end
else
if Fighting then
begin
Result := True;
exit;
end;
end;
end;
end;
end;

function Stuck: Boolean;//Have we been fighting to long?
begin
if (TimeFromMark(LastClickMonster) >300000 ) then
begin
Result := True;
writeln('We have have been killing this fiend for 50 seconds..Whats wrong?');
TerminateScript;
end
else
begin
Result := False;
exit;
end;
end;

function TeleportToBarb: Boolean;
var
x, y, t, b, Failcount: Integer;
begin
if not (GetCurrentTab = tab_Inv) then
begin
GameTab(tab_Inv);
wait(RandomRange(1000, 1500));
end
else
MarkTime(t);
Failcount := 0;
GamesNecklace := DTMFromString('mbQAAAHicY2VgYBAGYgUgVgRiASiWB2JuIJYGYkkgVgViQZE6IMmEguUYMAEjFgwGAIVvAcs=');
if FindDTM(GamesNecklace, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Found Necklace');
MMouse(x, y, 2, 2);
wait(150);
if IsUpText('ecklace') then
begin
MarkTime(b);
ClickMouse2(mouse_Right);
WaitOption('Rub', 500);
wait(RandomRange(1500, 2500));
SendKeys('2', 50, 25);
if FindBlackChatMessage('Your games necklace crumbles to dust.') then
begin
ReplaceGamesNecklace := True;
end;
wait(RandomRange(5000, 5500));
repeat
wait(50)
until (FindSymbol(x, y, Symbol_Fish) or (TimeFromMark(b) >= 50000));
result := true;
writeln('We are at the Barbarian outpost');
FreeDTM(GamesNecklace);
exit;
end
else
begin
result := false;
writeln('We are not at the Barbarian outpost');
FreeDTM(GamesNecklace);
TerminateScript;
end;
end
else
begin
writeln('Cannot find games necklace');
FreeDTM(GamesNecklace);
TerminateScript;
end;
end;

Procedure WalkToObelisk;
begin
ObjDTM_WalkPath(['78:134:3:1:7:79:60:1:7:94:110:1:7:75:115:4:44:64:130:67:119:112:53:105',
'74:131:4:1:7:75:83:1:7:99:64:3:7:50:99:1:7:83:103',
'67:125:5:3:7:31:84:3:7:73:134:1:7:79:87:1:7:67:64:1:7:80:64',
'70:140:3:3:7:84:91:3:7:73:119:3:7:66:92'], 0, 100, 5, False, True);
end;

Procedure FindObelisk; //Followed Footy's Tutorial for ATPA's
var
ObeliskTPA, GreenTPA:TPointArray;
ObeliskATPA:T2DPointArray;
ObeliskBox:TBox; //Box around Obelisk
i, h, SearchForGreen:integer;
begin
if not(loggedin) then
LogInPlayer;
MakeCompass('E');
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.33, 0.42);
if findcolorstolerance(ObeliskTPA, 4874597, MSX1, MSY1, MSX2, MSY2, 8) then
begin
ObeliskATPA := SplitTPAEx(ObeliskTPA, 20, 20);
SortATPASize(ObeliskATPA, True);
for i := 0 to high(ObeliskATPA) do
begin
ObeliskBox := GetTPABounds(ObeliskATPA[i]);
SetColorSpeed2Modifiers(0.07, 0.08);
if findcolorstolerance(GreenTPA, 5537652, ObeliskBox.x1, Obeliskbox.Y1, Obeliskbox.X2, Obeliskbox.Y2, 5) then
Break;
if i = high(ObeliskATPA) then
begin
writeln('Could not verify Obelisk');
Terminatescript;
end;
end;
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.02, 0.02);
MarkTime(SearchForGreen);
while (not isuptext('obelisk')) do
begin // Waiting for the uptext, changes through all points, high ---> low
h := random(length(GreenTPA)); //Choose a random point of green
MMouse(GreenTPA[h].x, GreenTPA[h].y, 2, 2);
wait(randomrange(250, 450));
if TimeFromMark(SearchForGreen) > 2500 then
begin
writeln('Could not find the uptext');
Logout;
Terminatescript;
end;
end;
ClickMouse2(2);
end;
end;

Procedure CheckSummoningPoints;
begin
if (GetMMLevels('summon', colorsign) <= RechargeSummoningLevel) then
begin
WalkToObelisk;
FindObelisk;
end
else
begin
exit;
end;
end;

function AtDock: Boolean; //At the dock to the ancient cavern?
begin
Result := ObjDTM_InArea('82:76:5:3:7:86:23:3:7:69:31:5:7:106:104:5:7:98:104:5:7:106:96:4:61:39:63:95:109:98:102:40', True);
end;

function WalkToAncientCavern: Boolean;
begin
ObjDTM_WalkPath(['78:134:3:1:7:79:60:1:7:94:110:1:7:75:115:4:44:64:130:67:119:112:53:105', '74:131:4:1:7:75:83:1:7:99:64:3:7:50:99:1:7:83:103', '67:125:5:3:7:31:84:3:7:73:134:1:7:79:87:1:7:67:64:1:7:80:64', '70:140:3:3:7:84:91:3:7:73:119:3:7:66:92'], 0, 100, 5, False, True);
if FindSymbol(x, y, Symbol_Dungeon) then
begin
Mouse(x, y, 2, 2, True);
wait(RandomRange(3000, 4000));
end;
if AtDock then
begin
result := True;
writeln('We are at the dock to the ancient caverns');
exit;
end
else
begin
result := False;
writeln('We did not arrive at the cavern, exiting');
TerminateScript;
exit;
end;
end;

function DiveIntoPool: Boolean; //Dives into the pool
begin
if AtDock then
begin
MarkTime(t);
MakeCompass('S');
SetAngle(SRL_ANGLE_HIGH);
wait(RandomRange(500, 1000));
Mouse(241, 135, 5, 5, True);
repeat
wait(100);
until (FindCaveFloor or (TimeFromMark(t) > 25000));
result := true;
writeln('Found the cave floor');
exit;
end
else
begin
writeln('Not at the dock');
result := false;
TerminateScript;
end;
end;

procedure UseBasicAbility;
begin
if ( not Fighting ) then
begin
exit;
end
else
begin
case Random(4) of
0: if UseAbility(Basic1) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeBasic1) or not Fighting);
exit;
end;

1: if UseAbility(Basic2) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeBasic2) or not Fighting);
exit;
end;

2: if UseAbility(Basic3) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeBasic3) or not Fighting);
exit;
end;

3: if UseAbility(Basic4) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeBasic4) or not Fighting);
exit;
end;

end;
end;
exit;
end;

procedure UseThreshHoldAbilities;
begin
if ( not Fighting ) then
begin
exit;
end
else
begin
case Random(2) of
1: if UseAbility(ThreshHold1) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeThreshHold1) or not Fighting);
exit;
end;

2: if UseAbility(ThreshHold2) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeThreshHold2) or not Fighting);
exit;
end;
end;
end;
exit;
end;

procedure UseUltimateAbility;
begin
if ( not Fighting ) then
begin
exit;
end
else
begin
case Random(10) of
0..4: if UseAbility(Ultimate1) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeUltimate1) or not Fighting);
exit;
end;

5..10: if UseAbility(Ultimate2) then
begin
MarkTime(t)
repeat
wait(10);
until((TimeFromMark(t)>=UseTimeUltimate2) or not Fighting);
exit;
end;
end;
end;
exit;
end;

Procedure UseAbilities;
begin
if (not Fighting) then
begin
exit;
end
else
begin
if (GetAdrenalinePercent < 50 ) then
begin
writeln('Using Basic Ability');
UseBasicAbility;
exit;
end
else
if (GetAdrenalinePercent = 100 ) then
begin
writeln('Using Ultimate Ability');
UseUltimateAbility;
exit;
end
else
begin
if ( UseUltimateAbilities = 'True' ) then
begin
exit;
end
else
if (GetAdrenalinePercent >= 50) then
begin
writeln('Using ThresholdAbility');
UseThreshHoldAbilities;
exit;
end
else
exit;
end;
end;
exit;
end;




procedure FightFiends;
begin
CurrentHP := GetMMLevels('hp', colorsign);
begin
if (not Fighting) then
begin
FindWaterFiend;
writeln('looking for a waterfiend');
exit;
end
else
if Fighting then
begin
writeln('In a fight');
MarkTime(x);
repeat
Eating;
UseAbilities;
Looting;
until(not Fighting or (TimeFromMark(x)>25000000));
Looting;
Inc(MonstersKilled);
CheckPotLevel;
end;
end;

end;

procedure ClimbDownStepsCave;
begin
MMouse(69, 194, 5, 5);
wait(RandomRange(1000, 2000));
if IsUpText('limb') then
begin
ClickMouse2(True);
MarkTime(b);
repeat
wait(50);
until (IsMoving or (TimeFromMark(b) >= 25000));
MarkTime(t);
repeat
wait(50);
until (not IsMoving or (TimeFromMark(t) >= 25000));
end ;
end;

Function CheckFamiliarActive:Boolean;
begin
if FindColorSpiralTolerance(x, y, 9485404, 691, 153, 720, 180, 19) then
begin
writeln('We have a bunyip still');
result := true;
exit;
end
else
begin
writeln('We do not have a bunyip');
result := false;
exit;
end;
end;

procedure Banking;
begin
BunyipPouch := DTMFromString('mbQAAAHicY2VgYBAAYnkgZgJiQSCWhoqJAbEIVI4LiP18TaCqEFiOARMwYsFgAAB+mwHA');
GamesNecklace := DTMFromString('mbQAAAHicY2VgYBAGYgUgVgRiASiWB2JuIJYGYkkgVgViQZE6IMmEguUYMAEjFgwGAIVvAcs=');
if BankScreen then
begin
Deposit(2, 24, true);
repeat
wait(50)
until ((InvCount <= 5) or (TimeFromMark(t) > 50000));
begin
if ((ReplaceGamesNecklace = true)or (not FindDTM(GamesNecklace, x, y, MIX1, MIY1, MIX2, MIY2))) then
begin
InvCounts := InvCount;
SearchBank('Games necklace');
wait(randomrange(1000, 2000));
Withdraw(0, 0, 1);
MarkTime(t);
repeat
wait(randomrange(50, 200));
until ((InvCounts < InvCount) or (TimeFromMark(t) >= 25000));
if InvCounts < InvCount then
end;
FreeDTM(GamesNecklace);
end;

if (ReplaceRingofDuelling = true) then
begin
InvCounts := InvCount;
SearchBank('Ring of duelling');
wait(randomrange(1000, 2000));
Withdraw(0, 0, 1);
MarkTime(t);
repeat
wait(randomrange(50, 200));
until ((InvCounts < InvCount) or (TimeFromMark(t) >= 25000));
if InvCounts < InvCount then
end;
if (CheckFamiliarActive = false) then
begin
ReplaceSummoningPouch := true;
end
else
begin
ReplaceSummoningPouch :=False;
end;
if (Bunyip = 'True') and (ReplaceSummoningPouch = true) then
begin
InvCounts := InvCount;
SearchBank('Bunyip pouch');
wait(randomrange(1000, 2000));
Withdraw(0, 0, 1);
MarkTime(t);
repeat
wait(randomrange(50, 200));
until ((InvCounts < InvCount) or (TimeFromMark(t) >= 25000));
if InvCounts < InvCount then
end;
FreeDTM(BunyipPouch);
if (Potions = 'True') then
begin
InvCounts := InvCount;
SearchBank(PotionToUse);
wait(randomrange(1000, 2000));
Withdraw(0, 0, 1);
MarkTime(t);
repeat
wait(randomrange(50, 200));
until ((InvCounts < InvCount) or (TimeFromMark(t) >= 25000));
if InvCounts < InvCount then
end;
begin
InvCounts := InvCount;
SearchBank(FoodType);
wait(randomrange(1000, 2000));
Withdraw(0, 0, FoodToBring);
MarkTime(t);
repeat
wait(randomrange(50, 200));
until ((InvCounts < InvCount) or (TimeFromMark(t) >= 25000));
if InvCounts < InvCount then
end;
CloseBank;
MarkTime(t);
repeat
wait(50)
until ((not BankScreen) or (TimeFromMark(t) >= 25000));
wait(randomrange(500, 1000));
exit;
end;
end;

function AtBank: Boolean;
begin
if FindSymbol(x, y, 'bank') then
begin
Result := True;
writeln('We are at the bank');
exit;
end
else
begin
writeln('We are not at the bank');
Result := False;
exit;
end;
end;

procedure WalkToFiends;
begin
Mouse(667, 50, 5, 5, True);
MarkTime(b);
repeat
wait(50);
until (IsMoving or (TimeFromMark(b) >= 25000));
MarkTime(t);
repeat
wait(50);
until (not IsMoving or (TimeFromMark(t) >= 25000));
end;


Procedure EquipROD;
begin
ROD := DTMFromString('mlwAAAHicY2dgYBAFYh4gFgNibigtAMRcUCwFxBJAzAvEbEAsDsTCIDUVIJIRK5ZjwA2w64BgKAAAtAEBuQ==');
if FindDTM(ROD, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
wait(RandomRange(1000,2000));
Mouse(x, y, 5, 5, True);
end else
begin
FreeDTM(ROD);
writeln('We could not find a ROD to equip');
TerminateScript;
end;
FreeDTM(ROD);
end;

Procedure Setup;
begin
if ( not IsActionBarOpen ) then
begin
writeln('Opening the action bar');
ToggleActionBar(True);
end;
if ( not IsActionBarLocked ) then
begin
writeln('Locking the action bar');
ToggleActionBarLock(True);
end;
writeln('Done with setup, action bar is showing and locked');
end;

Procedure SummonBunyip;
begin
BunyipPouch := DTMFromString('mbQAAAHicY2VgYJACYmkglgBidSDmAmJRIGYDYiWouBgQV9SkAkkmFCzHgAkYsWAwAACwEQJz');
begin
if not (GetCurrentTab = tab_Inv) then
begin
GameTab(tab_inv);
wait(randomrange(250, 500));
end;
if (Bunyip = 'True') then
begin
if FindDTM(BunyipPouch, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 0, 0, false);
WaitOption('Summon', 500);
wait(randomrange(1000, 1500));
if (CheckFamiliarActive = True) then
begin
writeln('Summoned Bunyip');
FreeDTM(BunyipPouch);
exit;
end
else
begin
writeln('Did not summon bunyip');
FreeDTM(BunyipPouch);
exit;
end;
end
else
begin
writeln('Could not find the Bunyip pouch, exiting summoning');
FreeDTM(BunyipPouch);
exit;
end;
end
else
begin
FreeDTM(BunyipPouch);
exit;
end;
end;
end;

procedure Proggy; //Credit to Abu_jwka for his tutorial on multi-player proggies
var
i: Integer;
begin
if LoadsDone[CurrentPlayer] mod 5=0 then
ClearDebug;
Crimson[CurrentPlayer] := GetAmountBox(InvBox(25));
Blue[CurrentPlayer] := GetAmountBox(InvBox(26));
Green[CurrentPlayer] := GetAmountBox(InvBox(27));
Gold[CurrentPlayer] := GetAmountBox(InvBox(28));
CurrentXP := GetXPBar(1);
TimeGone[CurrentPlayer] := (GetTimeRunning/1000);
XPGain[CurrentPlayer] := (CurrentXP - OriginalXP);
XPPerhour[CurrentPlayer] :=(3600*(XPGain[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
LoadsPerhour[CurrentPlayer] :=(3600*(LoadsDone[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
CharmsPerHour1[CurrentPlayer] := (3600*(Crimson[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
CharmsPerHour2[CurrentPlayer] := (3600*(Blue[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
CharmsPerHour3[CurrentPlayer] := (3600*(Green[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
CharmsPerHour4[CurrentPlayer] := (3600*(Gold[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
begin
Writeln('******************************************************************');
Writeln('*/////////-------------- Kings Waterfiends ---------------\\\\\\\*');
Writeln('*/////////----------____________________________----------\\\\\\\*');
Writeln('******************************************************************');
Writeln('');
for i := 0 to HowManyPlayers - 1 do
begin
Writeln('*/////////--------- Progress Report for: ' + Players[i].Nick + ' --------\\\\\\\\\*');
Writeln('*///////// Loads done: ' + IntToStr(LoadsDone[i]) + ' //// ' + IntToStr(LoadsPerHour[i]) + ' Loads/Hour');
Writeln('*///////// XP gained: ' + IntToStr(XPGain[i]) + ' //// ' + IntToStr(XPPerHour[i]) + ' XP/Hour');
Writeln('*///////// Crimson charms: ' + IntToStr(Crimson[i]) + '//// ' + IntToStr(CharmsPerHour1[i]) + ' Crimson Charms/Hour');
Writeln('*///////// Blue charms: ' + IntToStr(Blue[i]) + '//// ' + IntToStr(CharmsPerHour2[i]) + ' Blue Charms/Hour');
Writeln('*///////// Green charms: ' + IntToStr(Green[i]) + '//// ' + IntToStr(CharmsPerHour3[i]) + ' Green Charms/Hour');
Writeln('*///////// Gold charms: ' + IntToStr(Gold[i]) + '//// ' + IntToStr(CharmsPerHour4[i]) + ' Gold Charms/Hour');
Writeln('');
end;
end;
end;

Procedure ReturnToMainPoint;
begin
SPS_Setup(RUNESCAPE_OTHER,['ancient_cavern']);
SPS_GetMyPos;
end;

procedure Login;
begin
ClearDebug;
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 6;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
{$ELSE}
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
{$ENDIF}
DeclarePlayers;
LoginPlayer;
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
end;
begin
SRL_SixHourFix := True;
SetupSRL;
SetArrayLengths;
ObjDTM_Setup;
DeclarePlayers;
Login;
LoadFigures;
Setup;
repeat
repeat
{ OpenBankCW;
Banking;
if (ReplaceRingofDuelling = True) then
begin
EquipROD;
end
else
CheckSummoningPoints;
TeleportToBarb;
WalkToAncientCavern;
DiveIntoPool;
ClimbDownStepsCave;
WalkToFiends;
SummonBunyip;
MakeCompass('N');}
// ReturnToMainPoint;
FindObelisk;
repeat
FightFiends;
Proggy;
until (AtBank or (CurrentHP<2000));
Inc(LoadsToDo);
Inc(LoadsDone[CurrentPlayer]);
if not LoggedIn then
LoginPlayer;
until ((LoadsToDo = TripsToDo) or not (LoggedIn));
NextPlayer(True);
until (false);
end.

riwu

2013-02-08 22:20:38

You called
DeclarePlayers();
AFTER
SetArrayLengths();

Hence HowManyPlayers is still 0 when SetArrayLengths() is called, resulting in the length of LoadsDone being set to 0, hence an out of range error as you are trying to access the first index of an array of length 0 which does not exist.

So simply call DeclarePlayers() before SetArrayLengths().

King

2013-02-08 22:26:28

From: riwu
You called
DeclarePlayers();
AFTER
SetArrayLengths();

Hence HowManyPlayers is still 0 when SetArrayLengths() is called, resulting in the length of LoadsDone being set to 0, hence an out of range error as you are trying to access the first index of an array of length 0 which does not exist.

So simply call DeclarePlayers() before SetArrayLengths().


Thankyou very much(: