GameBaseData not showing up in mission editor
by Danner Jones · in Torque Game Engine · 07/16/2004 (11:14 pm) · 8 replies
I am reading through the following help topic:
When I try this, I don't see the new item under the shapes node in the treeview.
I've tried putting the code ("new GameBaseData(myGBD)...") in 3 places, but none have an effect.
1. In a new script in "/starter.fps/server/scripts/test.cs" which I exec in .../server/init.cs
2. In a new script in "/starter.fps/client/scripts/test.cs" which I exec in .../client/init.cs
3. Right in the top of main.cs in the root. The echo's show up as expected but I see nothing in the tree.
As this is just a test for me, there are no "real" issues. Just wondering if the docs are wrong or I'm missing something.
-ner
Quote:
As stated above, specifying a category for a GameBase datablock defines a new category of shapes in the MissionEditor. To check this, open the Mission Editor by pressing F11, then go to the Window menu, and click World Editor Creator. In the GUI that comes up, click the Shapes node, and you will see a new category called Brand New Category. Click this category to expand it, and you will see myGBD.
When I try this, I don't see the new item under the shapes node in the treeview.
I've tried putting the code ("new GameBaseData(myGBD)...") in 3 places, but none have an effect.
1. In a new script in "/starter.fps/server/scripts/test.cs" which I exec in .../server/init.cs
2. In a new script in "/starter.fps/client/scripts/test.cs" which I exec in .../client/init.cs
3. Right in the top of main.cs in the root. The echo's show up as expected but I see nothing in the tree.
As this is just a test for me, there are no "real" issues. Just wondering if the docs are wrong or I'm missing something.
-ner
#2
I used the GameBaseData code as given in the docs:
I have since tried adding a GameBase object just after the GameBaseData but it still doesn't show up in the MissionEditor. Below is the full code I'm testing with. I've tried putting it right at the top of main.cs in the root and in "test.cs" in /starter.fps/server/scripts/test.cs which I exec in the server's init.cs. I see the echo's, so I know I'm getting there.
-ner
07/17/2004 (12:55 pm)
I was actually only putting in a GameBaseData object, not a GameBase. The docs are for datablocks, the topic was for GameBaseData - when I read "specifying a category for a GameBase datablock" I read it as a typo (maybe it should have been GameBaseData).I used the GameBaseData code as given in the docs:
datablock GameBaseData(myGBD)
{
category = "Brand New Category";
newItem = "Brand new field";
};
echo(myGBD.category); echo(myGBD.newItem); echo(myGBD.className);I have since tried adding a GameBase object just after the GameBaseData but it still doesn't show up in the MissionEditor. Below is the full code I'm testing with. I've tried putting it right at the top of main.cs in the root and in "test.cs" in /starter.fps/server/scripts/test.cs which I exec in the server's init.cs. I see the echo's, so I know I'm getting there.
datablock GameBaseData(myGBD)
{
category = "Brand New Category";
newItem = "Brand new field";
};
echo(myGBD.category); echo(myGBD.newItem); echo(myGBD.className);
new GameBase(myGB)
{
dataBlock = myGBD;
};
echo("nameTag = " @ myGB.nameTag);-ner
#3
This should work just fine as is-- no need to declare a GameBase object or anything. You do have to declare myGBD in a place in script where it is ok to declare a new datablock, and where it will show up in the Mission Editor. For example, starter.fps/server/scripts/game.cs should be fine, or you could exec your test.cs file from game.cs. Really, anywhere other datablocks are declared.
I realize that the Datablock reference does not point out this note on where to create the datablock. This is on purpose though, the reference chapter painfully points out in a large breakout box at the very beginning that a Datablock tutorial is not offered. The chapter would simply be too huge if it were both a complete reference and an in-depth tutorial. It is strictly a reference on all the datablock fields, so it assumes you already know what a datablock is, how to make them, etc.
I would never just leave the docs like that, assuming you know stuff that you might not necessarily, except that we have forthcoming documentation (which is 95% done now and will get out on the site soon) which goes into detail explaining what datablocks are and how to create them. My plan has been to link to the new tutorial, once it's released, in the datablock reference and say "Read the tutorial first!" :) Though, I may just move this entire "category" example over to the general datablock tutorial, and link to it in the reference itself.
Sorry that the docs are incomplete at the moment. Believe me, I wish they were done already too. ;) The choice has been whether to sit on all the docs until they are 100% complete, or release preview versions along the way. We figure that releasing the docs as we go along is better, since it gets people help quicker, but the trade-off is that confusion like this can occur while the docs are still incomplete.
Thank you much for pointing this out anyway. It is confusing as is, but it won't be once the entire book is complete. Once again, a complete datablock tutorial (part of a new scripting chapter) is on the way and will be released shortly. That tutorial, combined with this reference should give people just about all they need to know about scripting datablocks.
Btw, I may change the "gamebase datablock" phrase you pointed out to "gamebasedata datablock", just so it's clear. Thanks.
Edit: To note, I did do my due diligence here and double-checked this. It does work. Though again, you have to declare myGBD in a valid place that will let it show up in the editor. Also, I write the docs for the latest stable release, Release_1_2_2. I did not take the time to triple-check and try this in HEAD as well, but it certainly should work. Let me know if you get problems doing this in HEAD as opposed to Release_1_2_2.
Edit again: a quick note for any nit-pickers out there... :) You probably noticed that the three echos in the code Dan pasted above are all on one line. This is obviously bad style, and it showed up that way in the docs as a copy-paste artifact in DocBook. I caught and corrected this poor style a couple weeks ago though, and the nicely formatted echos in this example will get out on the site the next time we push an update.
07/17/2004 (5:04 pm)
Dan,This should work just fine as is-- no need to declare a GameBase object or anything. You do have to declare myGBD in a place in script where it is ok to declare a new datablock, and where it will show up in the Mission Editor. For example, starter.fps/server/scripts/game.cs should be fine, or you could exec your test.cs file from game.cs. Really, anywhere other datablocks are declared.
I realize that the Datablock reference does not point out this note on where to create the datablock. This is on purpose though, the reference chapter painfully points out in a large breakout box at the very beginning that a Datablock tutorial is not offered. The chapter would simply be too huge if it were both a complete reference and an in-depth tutorial. It is strictly a reference on all the datablock fields, so it assumes you already know what a datablock is, how to make them, etc.
I would never just leave the docs like that, assuming you know stuff that you might not necessarily, except that we have forthcoming documentation (which is 95% done now and will get out on the site soon) which goes into detail explaining what datablocks are and how to create them. My plan has been to link to the new tutorial, once it's released, in the datablock reference and say "Read the tutorial first!" :) Though, I may just move this entire "category" example over to the general datablock tutorial, and link to it in the reference itself.
Sorry that the docs are incomplete at the moment. Believe me, I wish they were done already too. ;) The choice has been whether to sit on all the docs until they are 100% complete, or release preview versions along the way. We figure that releasing the docs as we go along is better, since it gets people help quicker, but the trade-off is that confusion like this can occur while the docs are still incomplete.
Thank you much for pointing this out anyway. It is confusing as is, but it won't be once the entire book is complete. Once again, a complete datablock tutorial (part of a new scripting chapter) is on the way and will be released shortly. That tutorial, combined with this reference should give people just about all they need to know about scripting datablocks.
Btw, I may change the "gamebase datablock" phrase you pointed out to "gamebasedata datablock", just so it's clear. Thanks.
Edit: To note, I did do my due diligence here and double-checked this. It does work. Though again, you have to declare myGBD in a valid place that will let it show up in the editor. Also, I write the docs for the latest stable release, Release_1_2_2. I did not take the time to triple-check and try this in HEAD as well, but it certainly should work. Let me know if you get problems doing this in HEAD as opposed to Release_1_2_2.
Edit again: a quick note for any nit-pickers out there... :) You probably noticed that the three echos in the code Dan pasted above are all on one line. This is obviously bad style, and it showed up that way in the docs as a copy-paste artifact in DocBook. I caught and corrected this poor style a couple weeks ago though, and the nicely formatted echos in this example will get out on the site the next time we push an update.
#4
While I still haven't gotten it figured out, I can easily await the full docs. I was just reading through the DataBlock docs and thought I'd try out what it said. I'm not sure why my code doesn't work (when I exec my script from the server's init.cs right after game.cs is exec'd), but no big deal in my book.
Thanks,
Ner
PS I realized this morning that this should have been in the "documenation" forum. Ah well :)
07/17/2004 (8:01 pm)
Thanks for the info (and lots of it), Josh :)While I still haven't gotten it figured out, I can easily await the full docs. I was just reading through the DataBlock docs and thought I'd try out what it said. I'm not sure why my code doesn't work (when I exec my script from the server's init.cs right after game.cs is exec'd), but no big deal in my book.
Thanks,
Ner
PS I realized this morning that this should have been in the "documenation" forum. Ah well :)
#5
Hmm.. did you try exec'ing your test.cs from within game.cs, as above? It should work. You will see a whole block of exec'd scripts that set-up other datablocks. Exec your script there and it'll work just fine. Like I say, anywhere other datablocks are declared should be fine.
Again, talking about starter.fps/server/scripts/game.cs
Let me know if this doesn't work for you for some reason.
07/17/2004 (8:20 pm)
NP about the forum placement, Dan.Hmm.. did you try exec'ing your test.cs from within game.cs, as above? It should work. You will see a whole block of exec'd scripts that set-up other datablocks. Exec your script there and it'll work just fine. Like I say, anywhere other datablocks are declared should be fine.
Again, talking about starter.fps/server/scripts/game.cs
Let me know if this doesn't work for you for some reason.
#6
-ner
07/18/2004 (6:28 am)
Ah, adding my exec to game.cs initServer did it. When I was exec'ing the script after game.cs, the server hadn't yet been created (no datablock transmit support I guess). Thanks Josh!-ner
#7
Thanks for the patience Dan. :)
07/18/2004 (11:11 am)
NP. Yeah, depending on where you were creating the datablock, that may have been the issue. Looking forward to getting all this stuff out on the site soon.Thanks for the patience Dan. :)
#8
thanks
12/26/2006 (10:34 am)
I just wanted to say thank you for clarifying this. i coulnd't find the answer anywhere else and this is really a must know for every basic scripter.thanks
Associate Kyle Carter
It might filter GameBaseData blocks out, since a GameBase on its own won't do anything.