SCAR Code:
program CrackCodes;
var
PrimeArray : array [0..1] of longint;
TestNumber : longint;
Z : longint;
procedure Initscript;
begin
PrimeArray[0]:= 2; //Array needs a start value (start prime #);
PrimeArray[1]:=3; //W00t! see above.
TestNumber:= 3; //Ini-value, just for fun :).
Writeln('Starting Script...');
end;
function GetPrimeNumber(testnumber : longint) : longint;
var
i, maxlength : longint;
isPrimeNumber : boolean;
begin
Maxlength:= getarraylength(PrimeArray);
i:= 0; //Give i an initial start value
isPrimeNumber:= true; //Just assume it is one
repeat
if (Testnumber mod PrimeArray[i] = 0) then
begin
isPrimeNumber:= false;
result:= -1;
end else
result:= TestNumber;
i:= i+1;
until((i = maxlength)or(isPrimeNumber = false));
end;
procedure AddPrimeToArray(prime : longint);
begin
setarraylength(PrimeArray, getarraylength(PrimeArray)+1);
PrimeArray[getarraylength(PrimeArray)]:= prime;
end;
begin
InitScript;
repeat
z:= GetPrimeNumber(TestNumber);
If not(z=-1) then
begin
AddPrimeToArray(z);
writeln(inttostr(z));
end;
until(false);
TestNumber:=Testnumber+1
end.
I get this error:
[Runtime Error] : Could not call proc in line 20 in script [removed file path for privacy reasons, no includes so it IS in the file I posted]
Line 20 reads:
Code:
Maxlength:= getarraylength(PrimeArray);
Basically, the script is supposed to generate prime numbers. Eventually it will run a type-error because the datarange of a longint isn't that high, but right now I'm not caring 'bout all the other errors (some are quite obvious). Someone gimme a hand with the runtime error here please? I need help within the next 48 hrs or I'm gonna drop this project *holds abort button in his hand*.