SRL Archive - Help and Support

[Runtime Error] : Out of Global Vars range


Cazax

2009-01-13 09:20:46

I'm getting that annoying problem every time this line is called:
Players[CurrentPlayer].Integers[1] := Players[CurrentPlayer].Integers[1] + 1;

look at my DeclarePlayers:

Procedure DeclarePlayers;
Begin
LampSkill := '';
SRLID := '';
SRLPassword := '';
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].Booleans[0] := True;
Players[0].Integers[0] := 0;

End;

EvilChicken!

2009-01-13 11:17:20

Cazax, first of all, a nice thing to know; if numeral variables need to be 0 at start, they do not need to be declared. Smae thing goes for false booleans.

I don't see your problem looking at the procedure you posted – but are you sure that you call SetUpSRL before that DeclarePlayers procedure?
I really cannot think of anything else that might be the cause.


Edit: Also, it would be neat if you used the Inc(X); or IncEx(X, N); commands instead of doing var := var +1;. In my opinion, Inc looks way neater and cleaner.

Naum

2009-01-13 11:18:12

Try changing it to Players[0]. so on.

If that doesn't work then post the script or pm me (if you dont wana show).

Cazax

2009-01-13 11:33:48

I managed to find out what was wrong, it was strange, because every function I called inside that function, would give that error. I called Player[CurrentPlayer].Integers[0]… in other function, and nothing went wrong. EvilChicken, if you look at my declarepalyers, I'm not declare that var to 0, that was supposed to be changed by the user to determinate the number of loads to do. Sorry if I didn't explain that.

Pyro

2009-01-13 18:28:29

From: EvilChicken!
Cazax, first of all, a nice thing to know; if numeral variables need to be 0 at start, they do not need to be declared. Smae thing goes for false booleans.


Well… Dont always take it like this. Really they should be set to null. But im pretty sure that scar does set them how you say.

As for the issue, im not 100% sure. But scar does have its quirks. One times i could not for the life of me get scar to update a variable. Till i reset it to zero.

Sometimes these things just happen :(

Daniel

2009-01-14 04:30:51

Set HowManyPlayers to 2 ;)

Gu3st...

2009-01-15 12:30:11

[quote=Dan's The Man;528408]Set HowManyPlayers to 2 ;)[/quote]
Why would that help at all? He only uses 1 player… :p