View Full Version : + IntToStr(Players[i].integers[0])+ in progress report!
HyperSecret
08-25-2007, 02:33 AM
so I've looked around the forums A LOT for this and i can't seem to find an explanation/tutorial on it so ill ask.
fawaki has this in his gobbiez script:
'K : '+ IntToStr(Players[i].integers[0])+' Goblins. '
and the only other place he has it is here in his attacking procedure:
Procedure WaitGoblin;
var Mark5:Integer;
begin
FFlag(0);
MarkTime(Mark5);
repeat
fighting
until not InFight;
Goblins := Goblins + 1;
ReportVars[0] := ReportVars[0] + 1;
Players[CurrentPlayer].integers[0] := Players[CurrentPlayer].integers[0]+1;
end;
and he uses it to keep track of the kills each player gets, I have tried to add this to my progress report and every time i put the Players[CurrentPlayer].integers[0] := Players[CurrentPlayer].integers[0]+1;
part in my script i get a [Runtime Error] : Out Of Range so it would be great if someone could explain to me on how to get this to work it would be VERY VERY appreciated
P.S. : i like the spell check on the replying/posting its very creative
pwnaz0r
08-25-2007, 02:41 AM
Did you declare the players ;)
Derek-
08-25-2007, 02:58 AM
EDIT : Yeah nvm.
It's because you haven't set up your players
but fyi you don't have to do it this way you can use any variable you want
Example:
var
Killed : Integer
begin
repeat
KillIt; //Not real function just made it up
until ISaySo
Killed := Killed + 1; //you can make this whatever you want just do +1 after each kill
WriteLn('You''ve killed ' +IntToStr(Killed)+ ' Goblins!'); //put this in your progress report
end.
HyperSecret
08-25-2007, 05:34 AM
yes ive declared them...you guys obviously dont understand...sry to say but he doesnt have it declared in his array at all...like i said those are the only places it comes up in his script take a look and i dont want it to be killed like that cuz then it doesnt do each player seperately like i want
pwnaz0r
08-25-2007, 05:41 AM
Pm me that section of the script (or msn found in sig). I will figure it out ;)
Santa_Clause
08-25-2007, 05:59 AM
Using SRL 4?
dvdcrayola
08-25-2007, 06:18 AM
Using SRL 4?
if he wasnt wouldnt he get an unknown identifier?
Derek-
08-25-2007, 06:40 AM
I still don't see why you can't just use a different variable?
dvdcrayola
08-25-2007, 06:41 AM
you could.. but this keeps it seperate for each player
Derek-
08-25-2007, 06:42 AM
You could still make an array..
var
Killed : array of Integer;
begin
Killed[CurrentPlayer]:= Killed[CurrentPlayer]+1
WriteLn('Killed ' +IntToStr(Killed[CurrentPlayer])+ ' Goblins')
end.
? Save you a lot of time rater than figuring this out
MasterKill
08-25-2007, 06:48 AM
// here gos: number of players
// and: start player:
for index := 0 to getarraylength(players)-1 do
begin
SetArrayLength(Players[Index].Strings, 1); // how many string i use is 1
SetArrayLength(Players[Index].integers, 3); // how many integers i use is 3
end;
// here gos your player setup:
// Players[0].active := True;
EDIT: INDEX is a variable! so put this in:
Index : integer;
EDIT: it gos the same with boolean duh.
SetArrayLength(Players[Index].booleans, {number of booleans useing});
EDIT: remember:
Players[?].strings[1] = Players[?].strings[0]
Players[?].strings[2] = Players[?].strings[1]
Players[?].strings[3] = Players[?].strings[2]
Start your strings/booleans/integers with 0
<--------------------------------->
i had the same problem to, did this, and it was working again. gl
HyperSecret
08-25-2007, 04:48 PM
thx master exactly what i was talking about, i totally forgot about even setting it as an array
Starblaster100
08-25-2007, 07:15 PM
check my sig on how to write your DeclarePlayers Procedure properly, you are missing a few procedures which define the length of the arrays.
rotflmfwao
08-25-2007, 09:18 PM
Oh, starblaster, btw, in the srl player form, does it declare the size of the arrays inside it?
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.