Game Development Community

What is wrong in that script, plz ?

by Frank Bignone · in Torque Game Engine · 05/25/2002 (7:01 am) · 1 replies

Hy,
Can someone tell me what is wrong ? I declare the following structure in script, and when I want to access $GameInfo.team[0].xxx, all fields are blank (not set); but team[1] is correct. I'm certainly doing something false, but my knowledge of tribes scripts is limited.

$GameInfo = new ScriptObject() {
     status = "Init";
     maxPlayers = $pref::Server::MaxPlayers;
     nbPlayers = 0;
     evenTeam = false;
     timeOut = 15 * 60;                     // 15 mn

     team[0] = new ScriptObject() {
       nbPlayers = 0;
       nextSpawn = 1;
       name = "";
       score = 0;
       maxPlayers = 8;
     };

     team[1] = new ScriptObject() {
       nbPlayers = 0;
       nextSpawn = 1;
       name = "";
       score = 0;
       maxPlayers = 8;
     };
   };

About the author

Real programmers don't waste time recompiling; they patch the binary files... ... Real programmers don't waste time patching binary files; they patch memory.


#1
05/25/2002 (2:35 pm)
Hmmm
I have never tried to do that before but when you think of a .mis file or a gui it is a similiar structure so it should be possible.

I do remember having some difficulty using arrays as object names in Tribes 2 some time ago but I thought that problem was corrected.

It might be worth trying without using arrays just to see if it works. Short of that maybe do something like this

%temp1 = new ScriptObject() {
       nbPlayers = 0;
       nextSpawn = 1;
       name = "";
       score = 0;
       maxPlayers = 8;
     };

     %temp2 = new ScriptObject() {
       nbPlayers = 0;
       nextSpawn = 1;
       name = "";
       score = 0;
       maxPlayers = 8;
     };

   $GameInfo = new ScriptObject() {
     status = "Init";
     maxPlayers = $pref::Server::MaxPlayers;
     nbPlayers = 0;
     evenTeam = false;
     timeOut = 15 * 60;                     // 15 mn
     %team[0] = %temp1;
     %team[1] = %team2;
   };