
Originally Posted by
kodeejs
yeah looks like i need to use procedure. Because with function i can`t assign false values. And when i use my function i got errors... i think i do something wrong. Can anyone edit and help me with this?
SCAR Code:
function MakeMonsterNames(name:string):array of string;
var
l:integer;
begin
setArrayLength(Result, 2);
l:=Length(name);
if l<=6 then
begin
Writeln('Need longer Text!');
Result[0]:=False;
Result[0]:=False;
Result[0]:=False;
Exit;
end;
if l>=6 then
begin
Result[0]:=copy(name, 1, 3);
Result[0]:=copy(name, 4, 3);
Result[0]:=copy(name, 7, 3);
end;
end;
I think i here make something diferent with that names. First i will count them all and then divide... But first i need understand how to return mucher string values.
fist of all i think you want result[0] result1] and result[2] not all 0s...
and if the length is 6 then you have it doing both copying and false.
and im not sure about the false part. unless you do a mix of the ideas... for example:
SCAR Code:
function MakeMonsterNames(var var1, var2, var3: String; name:string): Booleen;
var
l:integer;
begin
setArrayLength(Result, 2);
l:=Length(name);
if l<=6 then
begin
Writeln('Need longer Text!');
Result:=False;
Exit;
end;
if l>=6 then
begin
Result:=True
var1:=copy(name, 1, 3);
var2:=copy(name, 4, 3);
var3:=copy(name, 7, 3);
end;
end;
modify it so it compiles.. not sure if it will and so it works for your needs