Game Development Community

Ch. 17 - levelloader.cs addEntry/getEntry errors.

by Steve Pierce · in Torque Game Engine · 06/28/2007 (4:01 pm) · 3 replies

Hello all,

I am on Lesson #17. First, I do know that this lesson wants you to actually copy the levelloader.cs, not the teleporters.cs that it says in the book. I'm good in that regard.

The problem I am having is that when I enter Torque and buildLevel(0); from the console, nothing happens. The console log spits out a ton of errors regarding the levelloader.cs file and its use of the addEntry and getEntry commands, saying that they are unknown commands.

Here is a sample of that error:

prototype/server/scripts/Mazerunner/levelloader.cs (327): Unknown command getEntry.
Object arrayObject(1441) arrayObject -> ScriptObject -> SimObject

Has something changed with TGE 1.5 that now invalidates these commands (the book was written for 1.4- I believe)? Or possible I missed a step somewhere. Anything anyone could think of would be greatly appreciated.

Thanks for your time,

Steve

#1
07/06/2007 (11:03 am)
I don't know about 1.5 but it means that getEntry is not a recognised command
#2
07/06/2007 (11:11 am)
Thank you. Ed actually replied to an email of mine and pointed out that I was missing an exec for the array creator in my game.cs, which sets up these commands. I am still having a few issues, but have since moved past this problem. Thanks.

Steve
#3
10/02/2007 (10:11 pm)
Steve,

I believe had the same issue. Since we don't have the benefit of Ed's email to you, I had to figure it out myself. I've posted my mistake (and fix) for the next person to make this mistake.

I had the same symptoms Steve described above:
- After completing Lesson#17, executing buildLevel(0) in the console failed with several hundred errors with addEntry and getEntry

Problem:
It turns out that I had the following code in the wrong main.cs file. I had it "[root]/main.cs", where is should be in "[root]/prototype/main.cs"

// Maze Runner Changes Begin -->
   exec("./EGSystems/SimpleInventory/egs_SimpleInventory.cs");
   exec("./EGSystems/SimpleTaskManager/egs_SimpleTaskManager.cs");
   exec("./EGSystems/Utilities/egs_ArrayObject.cs");
   exec("./EGSystems/Utilities/egs_Misc.cs");
   exec("./EGSystems/Utilities/egs_Networking.cs");
   exec("./EGSystems/Utilities/egs_SimSet.cs");
   exec("./EGSystems/Utilities/egs_String.cs");
   // <-- Maze Runner Changes End

As a new developer, I'm finding that learning how to troubleshoot is as much a skill as programming in the first place. As a breadcrumb to help others diagnose problems in the future, below is how I found the root issue.

Troubleshooting:
1. I searched on the fourms for errors with AddEntry. Steve's comment about exec for the array not loading was a hint.
2. Using Torsion, I did a text search within the project to find where AddEntry was defined. I found it in "egs_ArrayObject.cs"
3. My next step was to find out where "egs_ArrayObject.cs" was executed. main.cs.
4. It was then that I looked in the log to find out that egs_ArrayObject.cs was not loading. In fact, none of the egs scripts were.
5. I did a diff between the (2) main.cs in my prototype and the (2) main.cs in the MazeRunnerAdvanced completed example. That is where I discovered I had put these execs in the wrong place.

Hope this helps the next person.