Cant support N-dimension array?[answered
by Chok Wei Tat · in Torque Game Builder · 10/16/2006 (4:46 pm) · 3 replies
Hi, can someone tell me what is wrong?
Worked
function Board::initSpawnState(%this) {
for(%i = 0; %i < %this.getTileCountX(); %i++) {
for(%j = 0; %j < %this.getTileCountY(); %j++) {
%gBoardSlotRespawnState[%i] = 0;
}
}
}
Error
function Board::initSpawnState(%this) {
for(%i = 0; %i < %this.getTileCountX(); %i++) {
for(%j = 0; %j < %this.getTileCountY(); %j++) {
%gBoardSlotRespawnState[%i][%j] = 0;
}
}
}
Thanks
Worked
function Board::initSpawnState(%this) {
for(%i = 0; %i < %this.getTileCountX(); %i++) {
for(%j = 0; %j < %this.getTileCountY(); %j++) {
%gBoardSlotRespawnState[%i] = 0;
}
}
}
Error
function Board::initSpawnState(%this) {
for(%i = 0; %i < %this.getTileCountX(); %i++) {
for(%j = 0; %j < %this.getTileCountY(); %j++) {
%gBoardSlotRespawnState[%i][%j] = 0;
}
}
}
Thanks
#2
and thanks again for reminding me, i m planing to use
%this.gBoardSlotRespawnState instead of %gBoardSlotRespawnState, coz just to debug on the script
10/16/2006 (4:53 pm)
Oh!, thanks! :pand thanks again for reminding me, i m planing to use
%this.gBoardSlotRespawnState instead of %gBoardSlotRespawnState, coz just to debug on the script
Torque Owner Gary Preston
Also be aware that the gBoardSlowRespawnState you've created above is a local variable and will not be accessable outside the initSpawnState function. You can however make it into a global variable by using $ instead of %. Or you could make the variable a member of your board class instance eg
Then where ever you can access your specific instance of the board, you can access the respawn state member.