Log in

View Full Version : Out of range error



Footy
08-11-2012, 07:56 PM
Im getting this error during runtime while trying to run my script. It compiles fine, but when I start up the script, it gives me an out of range error. Heres the first part of my script.


program AlKharid_Tanner;
{$i srl/srl.simba}

type TLeatherRecord = record
LeatherDTM, WaitTimeMin, WaitTimeMax:integer;
end;

var
LDTM:TLeatherRecord;
Hides_Tanned:Integer;
LeatherDTM, HardLeatherDTM, GreenLeatherDTM, RedLeatherDTM:Integer;
BlackLeatherDTM, RoyalLeatherDTM, BlueLeatherDTM:Integer;

const
Row = 2; //Row of item to tan in bank.
Column = 2; //Column of item to tan in bank.
Hides_To_Tan = 56; //How many hides are you tanning?
Profit_per_hide = 20; //How much profit do you make per hide tanned? Used in progress report.

procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username Here!
Players[0].Pass := ''; //Password Here!
Players[0].Pin := ''; //Pin here!
Players[0].Active := True;
Players[0].Strings[0] := 'GreenLeather'; //What Are we Tanning? Options(GreenLeather, RedLeather, BlackLeather, BlueLeather, RoyalLeather, HardLeather, SoftLeather) Dont Missspell them!
End;

Procedure LoadTLeatherRecord;
begin
case lowercase(Players[CurrentPlayer].Strings[0]) of
'GreenLeather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYEhkZGBIAeJQIA4A4hwgvg TED4D4JBBfAOKLQMxpywVUzYSCQSLogBELBgMADIgGaQ==');
LDTM.WaitTimeMin := 1000;
LDTM.WaitTimeMax := 1400;
end;
'BlueLeather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYChkZGBIB+JUIK4A4mogvg LEJ4D4FhDfg7K5eTyBqplQMBcDJmDEgsEAADGZBtM=');
LDTM.WaitTimeMin := 1200;
LDTM.WaitTimeMax := 1800;
end;
'RedLeather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYNjAyMCwGIiXA/EeIF4HxJeA+CwQ3wXiy0B8BIhteTmBqplQMBcDJmDEgsEAAKFa B/E=');
LDTM.WaitTimeMin := 2000;
LDTM.WaitTimeMax := 3000;
end;
'BlackLeather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYNBiZGBQAmJTIJYHYjMgvg jE94D4FBCfAOLLIDlZWaBqJhTMxYAJGLFgMAAAqwgFag==');
LDTM.WaitTimeMin := 2500;
LDTM.WaitTimeMax := 3500;
end;
'SoftLeather': begin
LDTM.LeatherDTM := DTMFromString('mggAAAHicY2NgYIgH4mwgTgXiICAOBeIMIL 7IyMBwDYiPAfE5IL4DxbYWnEBZJgzMyoAdMOLAEAAA+wgH0Q== ');
LDTM.WaitTimeMin := 0;
LDTM.WaitTimeMax := 0;
end;
'HardLeather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYLgDxE+B+DkQXwbiSyDMyM BwHIhvAfEdID4NxDoaskAZJhTMxYAJGLFgMAAAAcAI+g==');
LDTM.WaitTimeMin := 0;
LDTM.WaitTimeMax := 0;
end;
'RoyalLeather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYFjOyMAwA4jXAfEWIJ4DxJ eA+BoQ3wPiU1DsIB0OVM2EgrkYMAEjFgwGAKx3CDA=');
LDTM.WaitTimeMin := 3000;
LDTM.WaitTimeMax := 4000;
end;
end;

end;
The error is on this line
case lowercase(Players[CurrentPlayer].Strings[0]) of

P1ng
08-11-2012, 08:34 PM
Are you perhaps trying to call LoadTLeatherRecord before you call DeclarePlayers?

Footy
08-11-2012, 08:35 PM
Solved, I loaded my record before Declareplayers instead of after, thanks P1ng!