Game Development Community

Datablocks in 1.5 from 1.1.3

by Jon Mitchell · in Torque Game Builder · 07/11/2007 (6:23 pm) · 9 replies

I just downloaded 1.5 then installed it and created a new project to look at the folder and data structure and since everything that resides in the ./game directory is pretty much the same as the 1.1.3 directory I though it was the thing to do. I took a pretty simple project and dropped it into the ./game directory, right away I noticed that my datablock does not seem to load, are they still declared the same way in the main.cs that now resides in the ./game directory? Other than that everything seems ok.

#1
07/11/2007 (9:39 pm)
I had to update the datablocks such that they pointed correctly to their respective image files. My 1.1.3 implementation had relative paths that didn't work in 1.5. I found it easy to fix.
#2
07/13/2007 (7:19 pm)
Ehh, sorry I should have been a little more specific on that this is a custom datablock and not the default one.
\Mygame\game\managed\datablocks.cs That datablock is working fine.

It is my custom one I have \Mygame\game\gamescripts\datablocks.cs that is not loading in the editer.
In the top of the main.cs located in \Mygame\game\ there is this line which in 1.1.3 worked fine:

function initializeProject()
{
//Load datablocks here so they can be used in the editor
exec("~/gameScripts/configDatablocks.cs");


In 1.1.3 when I worked on an object I could choose its properties from the datablock option.
Is there a different way of calling this now while in the editer?
#3
07/18/2007 (10:47 am)
Perhaps maybe I should just rephrase it all so it makes sense eh? :-p
How does one go about loading custom datablock.cs files so you can use them in the editor?
#4
07/18/2007 (12:20 pm)
Quote:
\Mygame\game\gamescripts\datablocks.cs

exec("~/gameScripts/configDatablocks.cs");

The filing you are trying to exec is not the one you said you stored your datablocks in.
#5
07/21/2007 (9:38 am)
Hi Stephen,
It is the correct one, the "\Mygame\game\gamescripts\datablocks.cs" was just what I typed in the forum for a full path reference, in my main.cs I am using "exec("~/gameScripts/configDatablocks.cs");"
I am under the impression I do not need to do the full blown path because of the tilde as a relative path indicator. In the console log it is indicated it is being complied and loaded:

Documents/MyGames/Retrotank/game/gameScripts/configDatablocks.cs...
Loading compiled script C:/Documents and Settings/Jonm/My Documents/MyGames/Retrotank/game/gameScripts/configDatablocks.cs.


But the Config Datablock drop down list under scripting remains empty.
#6
07/21/2007 (10:17 am)
I don't think you caught the point. Your file name is datablocks.cs, you are trying to load a file called configDatablocks.cs. Those are two different files, and you cannot assume datablocks.cs is loaded by the exec statement that configDatablocks.cs as well.

That being said, this is a bug, but only because datablocks.cs is supposed to be auto-loaded by the game executable, and is not. It is fixed for our internal repository.
#7
07/21/2007 (5:05 pm)
Hi Stephen, sorry for being bone head. I did miss that, then confused myself in the process. :-p I did not pick up on what I had typed and what was really happening.
My file is really called configDatablocks and I am really calling it from the main.cs by this bit of code:

function initializeProject()
{
  //Load datablocks here so they can be used in the editor
   exec("~/gameScripts/configDatablocks.cs");


When I typed into the forum "\Mygame\game\gamescripts\datablocks.cs" I should have typed in "\Mygame\game\gamescripts\configDatablocks.cs" So I do have the correct file and location being called, and no it is not loading when I check in the TGB console log. The other log I checked I realized was just the log in the game directory, another error on my part.
#8
07/22/2007 (10:45 am)
In 1.5 the editor looks for a file called game/gameScripts/datablocks.cs to automatically exec.

The separation of the tool and player created this datablock issue. Before the tool was the player so execing y our datablocks in your game scripts in the right way would still let the editor recognize it. Now they are separate apps so the editor looks for a specific file to exec (alternatively you could put a datablocks.cs in gameScripts and have it exec your "configDatablocks.cs").
#9
07/22/2007 (2:37 pm)
Thank you for the info Matthew!
I did not know that 1.5 looked for a datablock.cs there by default, good stuff to know. :-)