Author Topic: Objects not loading.  (Read 659 times)

Code: [Select]
function loadFRZ(%name, %client){
%file=new fileObject();
%file.openForRead("Add-Ons/FRZ/" @ %Name @ ".FRZ");
%aiCount = 0;
%objCount = 0;
while(!%file.isEOF()){
%line=%file.readLine();
switch$(firstWord(%line)){
case "OBJ":
%objCount++;
%obj[%objCount].obj = restWords(%line);
case "POS":
%obj[%objCount].pos = restWords(%line);
case "AI":
%obj[%objCount].ai = restWords(%line);
}
echo(%obj[%objCount].obj);
}
}

It's trying to load this:

Code: [Select]
OBJ Add-Ons/shapes/SniperRifle.dts
POS 21.3679 -124.867 288.332 1 0 0 0
OBJ base/data/shapes/Hammer.dts
POS 16.5396 -127.129 288.333 1 0 0 0
OBJ PlayerNoJet
POS 12.7424 -101.98 286.332 1 0 0 0
AI 1
« Last Edit: November 03, 2007, 07:49:13 AM by MrPickle »

I've been trying to get this to work and echo's are saying that the var's aren't being set to anything.

Code: [Select]
function loadFRZ(%name, %client){
%file=new fileObject();
%file.openForRead("Add-Ons/FRZ/" @ %Name @ ".FRZ");
%aiCount = 0;
%objCount = 0;
while(!%file.isEOF()){
%line=%file.readLine();
switch$(firstWord(%line)){
case "OBJ":
%objCount++;
%obj[%objCount] = restWords(%line);
case "POS":
%pos[%objCount] = restWords(%line);
case "AI":
%ai[%objCount] = restWords(%line);
}
echo(%obj[%objCount]);
}
}