Thread Tools
Old October 7, 2002, 03:47   #1
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 10:02
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
player[] array
Ok, there's a question for the really experienced modders:

simple:
As far as I know, player[0] and [1] are used by the game - any event or function that uses player[2]?

not so simple:
What is the size of this array/the accessable numbers - unlimited?

hard:
When can I store values into this array by writing e.g. player[4] = 2; ? Anytime? Depending on the event? Depending on having assigned [2] and [3]?
Depending on system time?!!?? (the last one is my guess after the game's constantly been making fun of me!)
mapfi is offline  
Old October 7, 2002, 05:33   #2
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 10:02
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
1. I don't think so. Only the diplomacy functions use player[1], nothing should need 3 players stored...

2. unlimited afaik. Certainly up to MaxPlayers in userprofile.txt

3. Yes, you can. Locutus does it in his capital code slic for the MedPack. Should work any time in the code.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old October 7, 2002, 05:41   #3
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 06:02
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
I think the player[] array is just a regular global array like all the others we create. The only difference is that information is given to them by the game engine.

Quote:
any event or function that uses player[2]?
Only if there is a event hidden somewhere because any event known by the mods has it.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old October 7, 2002, 08:38   #4
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 10:02
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
So is there a restriction on read-access by message-strings then?

Or how can you explain that a player[3]=i in a begin turn handler and in the message sent at the same moment gives the errors:

line: (line number of the messagebox text) array: index out of bounds
(and then same line, value lookup failed)
mapfi is offline  
Old October 7, 2002, 12:52   #5
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 10:02
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
Ok, I found the solution to the problem I had. Now if anyone is going to write 'Duh, we all know that' I'll be really pissed. I was going nuts on this last night.

Reading the error messages carefully I might have guessed that the problem wasn't the assigning bit but the reading from the array.

Here's the thing:
while this won't work
Code:
...
   player[3] = 5;
   Level = 6;
   message(tmpplayer,'Info');
...
messagebox 'Info' {
text(ID_newINFO)  //newINFO: player[3].civ_name_singular...
...
this will do the trick:
Code:
...
   Level = 6;
   player[3] = 5;
   message(tmpplayer,'Info');
...
messagebox 'Info' {
text(ID_newINFO)  //newINFO: player[3].civ_name_singular...
...
Apparently the value gets kicked immeadetly when a next bit of code is executed.
Duh, we all knew that, didn't we!
mapfi is offline  
Old October 7, 2002, 20:29   #6
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 06:02
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
This really is a surprise for me! I would never had imagined.
Great Work and terrific thread about the slic crazy stuff. Deserves to be topped

PS: Shouldnt the comment numbers in that thread start from 0
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; October 7, 2002 at 20:40.
Pedrunn is offline  
Old October 8, 2002, 13:35   #7
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 10:02
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
further testing has revealed more:
while
Code:
player[3] = x;
player[4] = y;
message(...);
won't let you access player[3] in the message - it's lost for the reason above
but this will work in a event that uses player[0]
Code:
player[0] = x;
player[4] = y;
message(...);
everything clear?
mapfi is offline  
Old October 8, 2002, 17:44   #8
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 06:02
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
This is great news for the religion info, isnt it!?!
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:02.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team