King
12-08-2012, 04:01 AM
Wanted to add a progress report and multiplayer to my script, multiplayer went great, switches just fine and I understand it. I had a progress report for a single player as well. I want o add the progress report for multiple players.
The script will run fine until I call the progress report the I get this error
http://i.imgur.com/ZxhJ4.png
I have followed all the tuts I can find and moved where the report was called, even pasted the exact progress report tutorial (abu's) into my script and it still stopped in the same spot, if I comment that out, it goes to the next line. Nothing is displayed. This si the only thing that stopping me from releasing the updated version of my enchanter >.<
Program KingsEnchantressPUBLIC; //Made by SRLKing V1.1
{$Define Smart}
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
var
T, B, i, FailCount, CurrentXp, OriginalXp, TotalProfit, RingsDone, TotalRingsDone: Integer;
TotalMagicXpGained, RingsMade, MagicXpPerHour: Array of Integer;
TimeGone, RingsPerHour, ProfitPerHour: Array of Integer;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Number of players you are using
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Player to star with
with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
Nick := ''; // Nick name for your player in the progress report
end;
// Uncomment to add players.
{ with Players[1] do
begin
Name := 'dog'; // Player username
Pass := 'cat'; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;
with Players[2] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;
with Players[3] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;}
end;
const
RingsToEnchant = 9999999999; //Number of loads of beer to buy
PriceSold = 2094; //Price you sold 1 ring for
PriceOfRing = 1300; //Price you paid per Emerald Ring
PriceOfCosmic = 206; //Price you paid per cosmic rune
// Do not touch below unless you know what you are doing! //
//--------------------------------------------------------------------------------//
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('W');
SetAngle(SRL_ANGLE_HIGH);
end;
Function OpenBankSW:Boolean;
begin
OriginalXp :=GetXPBar(1);
if not LoggedIn then Exit;
MarkTime(b);
repeat
MarkTime(t);
writeln('Trying to open the bank chest');
OpenBankChest(20);
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;
end;
if not( PinScreen or BankScreen) then
begin
writeln('Failed to find and open the bank chest');
Inc(FailCount);
if FailCount=10 then
begin
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
writeln('Could not open the bank');
end;
end;
until((TimeFromMark(b)>70000) or BankScreen);
ClearDebug;
end;
Procedure BankRemaining;
begin
if not LoggedIn then Exit;
OpenBankSW;
repeat
wait(50);
until(BankScreen or (TimeFromMark(t)>10000));
if BankScreen then
begin
DepositAll;
MarkTime(b);
repeat
wait(50)
until((TimeFromMark(b)>10000) or (InvCount=0));
writeln('Ending the script, thankyou for using');
end;
end;
function DepositEnchnatedItems:Boolean;
begin
if not LoggedIn then Exit;
MarkTime(t);
repeat
wait(50);
until(BankScreen or (TimeFromMark(t)>10000));
if BankScreen then
begin
Deposit(2, 28, True);
MarkTime(b);
repeat
wait(50)
until((TimeFromMark(b)>10000) or (InvCount=1));
if InvCount = 1 then
begin
wait(RandomRange(250,500));
Withdraw(0, 0, 27);
writeln('Withdrawing the item to enchant');
wait(RandomRange(250,500));
CloseBank;
result :=True;
end else
Begin
writeln('Failed to withdraw');
result :=False;
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
end;
ClearDebug;
end;
Function Enchant:Boolean;
begin
if not LoggedIn then Exit;
writeln('Beginning enchanting');
begin
for i:= 2 to 28 do
begin
MarkTime(t);
CurrentXp:= GetXPBar(1);
if not ExistsItem(i) then break;
if ExistsItem(i) then
SendKeys('1', 5, 5);
MouseItem(i, 1);
if FindBlackChatMessage('You do not have enough cosmic runes to cast this spell.') then
begin
writeln('Banking inventory then exiting due to cosmic runes being gone');
BankRemaining;
result :=False;
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
repeat
wait(100);
until((GetXPBar(1)>CurrentXP) or (TimeFromMark(t)>5000));
Inc(RingsDone);
Inc(TotalRingsDone);
result :=True;
end;
end;
end;
procedure ProgressReport;
begin
ClearDebug;
TimeGone[CurrentPlayer] := (GetTimeRunning/1000);
CurrentXp := GetXPBar(1);
TotalMagicXpGained[CurrentPlayer] := (CurrentXp - OriginalXp);
MagicXpPerHour[CurrentPlayer] := (3600*(TotalMagicXpGained[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
RingsPerHour[CurrentPlayer] := (3600*(RingsDone))/((TimeGone[CurrentPlayer]));
ProfitPerHour[CurrentPlayer] := (3600*(PriceSold-PriceOfRing-PriceOfCosmic))/((TimeGone[CurrentPlayer]));
TotalProfit := (RingsPerHour[CurrentPlayer]*(PriceSold-PriceOfRing-PriceOfCosmic));
RingsMade[CurrentPlayer] := (RingsDone);
begin
Writeln('***************************************** *************************');
Writeln('*/////////---------- Kings Enchantress V1.1 ----------\\\\\\\*');
Writeln('*/////////----------____________________________----------\\\\\\\*');
Writeln('***************************************** *************************');
Writeln('');
for i := 0 to HowManyPlayers - 1 do
begin
Writeln('*/////////--------- Proggy for the player: ' + Players[i].Nick + ' --------\\\\\\\\\*');
Writeln('*/////////We have been crafting rings for: ' + IntToStr(TimeGone[i]) + ' hours');
Writeln('*/////////We have made: ' + IntToStr(RingsMade[i]) + ' rings / Thats ' + IntToStr(RingsPerHour[i]) + ' rings per hour');
Writeln('*/////////We have gained: ' + IntToStr(TotalMagicXpGained[i]) + ' xp / Thats ' + IntToStr(MagicXpPerHour[i]) + ' xp per hour');
Writeln('*/////////We have gained: ' + IntToStr(TotalProfit) + ' GP / Thats ' + IntToStr(TotalProfit) + ' GP Per Hour');
Writeln('');
end;
end;
end;
procedure SetArrayLengths;
begin
SetLength(TimeGone,HowManyPlayers);
SetLength(TotalMagicXpGained,HowManyPlayers);
SetLength(MagicXpPerHour,HowManyPlayers);
SetLength(RingsPerHour,HowManyPlayers);
SetLength(ProfitPerHour,HowManyPlayers);
end;
begin
SRL_SixHourFix := True;
SetupSRL;
SetArrayLengths;
DeclarePlayers;
Login;
repeat
RingsDone := 0;
Repeat
if not LoggedIn then LoginPlayer;
if OpenBankSW then
begin
if DepositEnchnatedItems then
begin
ProgressReport;
wait(RandomRange(1000,1100));
Enchant;
end;
end;
Until((RingsDone>=RingsToEnchant) or not( LoggedIn));
NextPlayer(True);
until(false);
end.
The script will run fine until I call the progress report the I get this error
http://i.imgur.com/ZxhJ4.png
I have followed all the tuts I can find and moved where the report was called, even pasted the exact progress report tutorial (abu's) into my script and it still stopped in the same spot, if I comment that out, it goes to the next line. Nothing is displayed. This si the only thing that stopping me from releasing the updated version of my enchanter >.<
Program KingsEnchantressPUBLIC; //Made by SRLKing V1.1
{$Define Smart}
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
var
T, B, i, FailCount, CurrentXp, OriginalXp, TotalProfit, RingsDone, TotalRingsDone: Integer;
TotalMagicXpGained, RingsMade, MagicXpPerHour: Array of Integer;
TimeGone, RingsPerHour, ProfitPerHour: Array of Integer;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Number of players you are using
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Player to star with
with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
Nick := ''; // Nick name for your player in the progress report
end;
// Uncomment to add players.
{ with Players[1] do
begin
Name := 'dog'; // Player username
Pass := 'cat'; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;
with Players[2] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;
with Players[3] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;}
end;
const
RingsToEnchant = 9999999999; //Number of loads of beer to buy
PriceSold = 2094; //Price you sold 1 ring for
PriceOfRing = 1300; //Price you paid per Emerald Ring
PriceOfCosmic = 206; //Price you paid per cosmic rune
// Do not touch below unless you know what you are doing! //
//--------------------------------------------------------------------------------//
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('W');
SetAngle(SRL_ANGLE_HIGH);
end;
Function OpenBankSW:Boolean;
begin
OriginalXp :=GetXPBar(1);
if not LoggedIn then Exit;
MarkTime(b);
repeat
MarkTime(t);
writeln('Trying to open the bank chest');
OpenBankChest(20);
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;
end;
if not( PinScreen or BankScreen) then
begin
writeln('Failed to find and open the bank chest');
Inc(FailCount);
if FailCount=10 then
begin
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
writeln('Could not open the bank');
end;
end;
until((TimeFromMark(b)>70000) or BankScreen);
ClearDebug;
end;
Procedure BankRemaining;
begin
if not LoggedIn then Exit;
OpenBankSW;
repeat
wait(50);
until(BankScreen or (TimeFromMark(t)>10000));
if BankScreen then
begin
DepositAll;
MarkTime(b);
repeat
wait(50)
until((TimeFromMark(b)>10000) or (InvCount=0));
writeln('Ending the script, thankyou for using');
end;
end;
function DepositEnchnatedItems:Boolean;
begin
if not LoggedIn then Exit;
MarkTime(t);
repeat
wait(50);
until(BankScreen or (TimeFromMark(t)>10000));
if BankScreen then
begin
Deposit(2, 28, True);
MarkTime(b);
repeat
wait(50)
until((TimeFromMark(b)>10000) or (InvCount=1));
if InvCount = 1 then
begin
wait(RandomRange(250,500));
Withdraw(0, 0, 27);
writeln('Withdrawing the item to enchant');
wait(RandomRange(250,500));
CloseBank;
result :=True;
end else
Begin
writeln('Failed to withdraw');
result :=False;
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
end;
ClearDebug;
end;
Function Enchant:Boolean;
begin
if not LoggedIn then Exit;
writeln('Beginning enchanting');
begin
for i:= 2 to 28 do
begin
MarkTime(t);
CurrentXp:= GetXPBar(1);
if not ExistsItem(i) then break;
if ExistsItem(i) then
SendKeys('1', 5, 5);
MouseItem(i, 1);
if FindBlackChatMessage('You do not have enough cosmic runes to cast this spell.') then
begin
writeln('Banking inventory then exiting due to cosmic runes being gone');
BankRemaining;
result :=False;
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
repeat
wait(100);
until((GetXPBar(1)>CurrentXP) or (TimeFromMark(t)>5000));
Inc(RingsDone);
Inc(TotalRingsDone);
result :=True;
end;
end;
end;
procedure ProgressReport;
begin
ClearDebug;
TimeGone[CurrentPlayer] := (GetTimeRunning/1000);
CurrentXp := GetXPBar(1);
TotalMagicXpGained[CurrentPlayer] := (CurrentXp - OriginalXp);
MagicXpPerHour[CurrentPlayer] := (3600*(TotalMagicXpGained[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
RingsPerHour[CurrentPlayer] := (3600*(RingsDone))/((TimeGone[CurrentPlayer]));
ProfitPerHour[CurrentPlayer] := (3600*(PriceSold-PriceOfRing-PriceOfCosmic))/((TimeGone[CurrentPlayer]));
TotalProfit := (RingsPerHour[CurrentPlayer]*(PriceSold-PriceOfRing-PriceOfCosmic));
RingsMade[CurrentPlayer] := (RingsDone);
begin
Writeln('***************************************** *************************');
Writeln('*/////////---------- Kings Enchantress V1.1 ----------\\\\\\\*');
Writeln('*/////////----------____________________________----------\\\\\\\*');
Writeln('***************************************** *************************');
Writeln('');
for i := 0 to HowManyPlayers - 1 do
begin
Writeln('*/////////--------- Proggy for the player: ' + Players[i].Nick + ' --------\\\\\\\\\*');
Writeln('*/////////We have been crafting rings for: ' + IntToStr(TimeGone[i]) + ' hours');
Writeln('*/////////We have made: ' + IntToStr(RingsMade[i]) + ' rings / Thats ' + IntToStr(RingsPerHour[i]) + ' rings per hour');
Writeln('*/////////We have gained: ' + IntToStr(TotalMagicXpGained[i]) + ' xp / Thats ' + IntToStr(MagicXpPerHour[i]) + ' xp per hour');
Writeln('*/////////We have gained: ' + IntToStr(TotalProfit) + ' GP / Thats ' + IntToStr(TotalProfit) + ' GP Per Hour');
Writeln('');
end;
end;
end;
procedure SetArrayLengths;
begin
SetLength(TimeGone,HowManyPlayers);
SetLength(TotalMagicXpGained,HowManyPlayers);
SetLength(MagicXpPerHour,HowManyPlayers);
SetLength(RingsPerHour,HowManyPlayers);
SetLength(ProfitPerHour,HowManyPlayers);
end;
begin
SRL_SixHourFix := True;
SetupSRL;
SetArrayLengths;
DeclarePlayers;
Login;
repeat
RingsDone := 0;
Repeat
if not LoggedIn then LoginPlayer;
if OpenBankSW then
begin
if DepositEnchnatedItems then
begin
ProgressReport;
wait(RandomRange(1000,1100));
Enchant;
end;
end;
Until((RingsDone>=RingsToEnchant) or not( LoggedIn));
NextPlayer(True);
until(false);
end.