Hi All,
I just tried one of my old AI Scenes (that used to work OK) and it failed to run properly.
I tracked the problem down to the "sky.setTable" function, which appears to be broken now.
Regards
Shando
			




myArray = {name="bob",age=83,location="UK"}
obj = 0;
function onInit(objID)
   obj = objID;
   sky.printTable(myArray);
   sky.setTable("tempTable", myArray)
end
obj = 0;
function onInit(objID)
   obj = objID;
end
function onKeyDown( key )
   if(key=="1")then
      myTable = sky.getTable("tempTable");
      
      sky.printTable(myTable);
      
      sky.lprint("name"..myTable.name);
      sky.lprint("age"..myTable.age);
      sky.lprint("location"..myTable.location);
   end
end



sky.include "blackboard.lua";
obj = 0;
simulationTime = 0;
function onInit(objID)
   -- Set up the Blackboard
sky.lprint ( "SS - 8" );
   bb_Initialise ( );
sky.lprint ( "SS - 9" );
   obj = objID;
   sky.print("Scene Script Active");
   -- Set up Simulation Time Counter
   sky.setVar ( "simtime", simulationTime );
sky.lprint ( "SS - 17" );
end
local bb = { };
function bb_Initialise ( )
   bb_Clear ( );
end
function bb_Clear ( )
   local tmpBB = { }
   local tblTmp = { id = 0, values = { typ = "Dummy", val = 0 } };
   table.insert ( tmpBB, tblTmp );
sky.printTable ( tmpBB );
   sky.setTable ( "gbb", tmpBB );
sky.lprint ( "116" );
end
sky.include "blackboard.lua";
rayID = 0;
function postInit ( objID )
   local tblTmp = { };
   bb_Set ( objID, "target", tblTmp );
sky.lprint ( "15" );
   bb_Set ( objID, "targetid", -1 );
   bb_Set ( objID, "team", 1 );
   myActions = act_actions ( objID );
   myLogic = decisionTree ( objID );
   aiInit ( objID );
   aiWander ( );
   aiObstacleAvoid ( );
   rayID = physics.createRay ( );
end
INFO: UI Document - Loaded
SS - 8
--------------------TABLE CONTENTS-------------------
Table (Top.1) Pairs - Key: id    Value: 0
Table (Top.1.values) Pairs - Key: val    Value: 0
Table (Top.1.values) Pairs - Key: typ    Value: Dummy
15


table: 3CCC0500 {
  [id] => 0
  [values] => table: 3CCC0500 {
                [val] => 0
                [typ] => "Dummy"
              }
}
local bb = { };
function bb_Initialise ( )
   bb_Clear ( );
end
function bb_Clear ( )
sky.lprint ( "#&127,127,255:BlackBoard Clearing ... storing array..." );
   local tmpBB = { }
   local tblTmp = { id = 0, values = { typ = "Dummy", val = 0 } };
   --local tblTmp = { id = "hello" };
sky.lprint ( "#&255,127,127:table inserting..." );
   table.insert ( tmpBB, tblTmp );
sky.lprint ( "#&255,127,127:printing table" );
   
   print_r(tblTmp);
   
   sky.printTable ( tblTmp );
sky.lprint ( "#&255,127,127:setting table on global" );
   sky.setTable ( "gbb", tblTmp );
sky.lprint ( "#&127,255,127:everything good to go!" );
   
end
function print_r ( t )  
    local print_r_cache={}
    local function sub_print_r(t,indent)
        if (print_r_cache[tostring(t)]) then
            sky.lprint(indent.."*"..tostring(t))
        else
            print_r_cache[tostring(t)]=true
            if (type(t)=="table") then
                for pos,val in pairs(t) do
                    if (type(val)=="table") then
                        sky.lprint(indent.."["..pos.."] => "..tostring(t).." {")
                        sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
                        sky.lprint(indent..string.rep(" ",string.len(pos)+6).."}")
                    elseif (type(val)=="string") then
                        sky.lprint(indent.."["..pos..'] => "'..val..'"')
                    else
                        sky.lprint(indent.."["..pos.."] => "..tostring(val))
                    end
                end
            else
                sky.lprint(indent..tostring(t))
            end
        end
    end
    if (type(t)=="table") then
        sky.lprint(tostring(t).." {")
        sub_print_r(t,"  ")
        sky.lprint("}")
    else
        sub_print_r(t,"  ")
    end
    sky.lprint()
end





Users browsing this forum: No registered users and 13 guests