Score Tutorial
by Chaz Hengesbach · in Torque Game Builder · 10/17/2007 (5:28 am) · 10 replies
Hello,
I am currently trying to work on the score tutorial at
http://tdn.garagegames.com/wiki/TGB/ScriptTutorials/ScoreTutorial
after creating the custom profile in the game code and opening up the tutorial again. While trying to create the GuiTextCtrl and changing the profile to GuiText24WhiteProfile. I was unable to find the profile in the drop down list. If i open the mainscreen.gui in torsion and change the profile manually it will work but is there anyway to get the custom profile to be present in that drop down list?
I am currently trying to work on the score tutorial at
http://tdn.garagegames.com/wiki/TGB/ScriptTutorials/ScoreTutorial
after creating the custom profile in the game code and opening up the tutorial again. While trying to create the GuiTextCtrl and changing the profile to GuiText24WhiteProfile. I was unable to find the profile in the drop down list. If i open the mainscreen.gui in torsion and change the profile manually it will work but is there anyway to get the custom profile to be present in that drop down list?
About the author
#2
I have not actually done the score tutorial, but I have worked with creating my own profiles. The code above lists two files. The first one is the common profiles.cs file. It's the default one which gets created for a new project. I think I added some profiles in there. I also created a separate profiles.cs which is the 2nd file in the code.
You may want to check out this thread which is where I discovered this little trick.
If this doesn't work for you, then maybe add it directly to the common profiles.cs or create a new profiles.cs under gui, like I did. In any case, I still had to restart TGB a few times or run a game and then restart for the items to show up.
10/29/2007 (10:16 pm)
Try adding the following to the beginning of game\gamescripts\datablocks.cs:exec("common/gui/profiles.cs");
exec("~/gui/profiles.cs");I have not actually done the score tutorial, but I have worked with creating my own profiles. The code above lists two files. The first one is the common profiles.cs file. It's the default one which gets created for a new project. I think I added some profiles in there. I also created a separate profiles.cs which is the 2nd file in the code.
You may want to check out this thread which is where I discovered this little trick.
If this doesn't work for you, then maybe add it directly to the common profiles.cs or create a new profiles.cs under gui, like I did. In any case, I still had to restart TGB a few times or run a game and then restart for the items to show up.
#3
11/03/2007 (2:59 pm)
Lol.. I love that... the GUI builder does suffer from a poor GUI... good one. Don't fret about the out of date tutorials... almost all the tutorials on TDN are out of date or do not work.. Some see this as a learning opportunity while others think it is a major issue. If we can help.. please do not hesitate to ask.
#4
For me, exec the Profiles.cs from Datablocks wasn't enough.
Profiles won't show up under Profile drop down menu on the right unless the
if(!isObject(GuiProfileName))
is removed from each line in Profiles.cs
For example:
if(!isObject(GuiText24Profile)) new GuiControlProfile (GuiText24Profile : GuiTextProfile)
{
fontSize = 24;
};
should be
new GuiControlProfile (GuiText24Profile : GuiTextProfile)
{
fontSize = 24;
};
I've been stressing over this all day, finding Steven S's reply at the end, so if anyone else is having this same issue and this works for them I'll feel a little better.
**Make sure you do this only to your own Profiles.cs file in your game/gui/ folder. I copied the profiles from Common and added my own in here just in case.
02/12/2009 (4:55 pm)
TGB 1.7.4For me, exec the Profiles.cs from Datablocks wasn't enough.
Profiles won't show up under Profile drop down menu on the right unless the
if(!isObject(GuiProfileName))
is removed from each line in Profiles.cs
For example:
if(!isObject(GuiText24Profile)) new GuiControlProfile (GuiText24Profile : GuiTextProfile)
{
fontSize = 24;
};
should be
new GuiControlProfile (GuiText24Profile : GuiTextProfile)
{
fontSize = 24;
};
I've been stressing over this all day, finding Steven S's reply at the end, so if anyone else is having this same issue and this works for them I'll feel a little better.
**Make sure you do this only to your own Profiles.cs file in your game/gui/ folder. I copied the profiles from Common and added my own in here just in case.
#5
For anyone else who's had this problem: I did the Scoreboard Tutorial while in an Adventure Kit project. I found the solution to be in the PlayScreen.gui file. I changed the useWindowMouseEvents and useObjectMouseEvents values to "1" for the t2dSceneWindow(sceneWindow2D) and the t2dSceneWindow(EffectWindow) and reloaded the project. After that when I clicked the mouse it would increase the score.
02/13/2009 (11:14 am)
I also had trouble with the onMouseDown function. I guess I missed the part where they explained how to set the t2dSceneWindow's to recognize mouse events.For anyone else who's had this problem: I did the Scoreboard Tutorial while in an Adventure Kit project. I found the solution to be in the PlayScreen.gui file. I changed the useWindowMouseEvents and useObjectMouseEvents values to "1" for the t2dSceneWindow(sceneWindow2D) and the t2dSceneWindow(EffectWindow) and reloaded the project. After that when I clicked the mouse it would increase the score.
#6
SceneWindow2D.setUseMouseEvents(true);
02/13/2009 (10:59 pm)
Another way to do this is in script via:SceneWindow2D.setUseMouseEvents(true);
#7
Thank you so much to provide a solution to missing GuiProfile problem! I just started to look into GuiEditor and have spent 2 hours looking for answer like why I can't make GuiProfiles in profiles.cs show up in the drop-down menu.
There are lots of other posts about this but none of them can solve my problem, I guess that's because I use TGB 1.7.4?
Parker's solution does work well, I really appreciate it. But I'm still wondering if this is the official supported solution? I mean it doesn't feel right to delete a lot of codes in the script comes right from package. If not, why I can't follow any tutorial about Gui system by letting everything set to default? Also none of the tutorials about GUI mentioned what should I do if I want to use some preset GuiProfile.
I guess there must be some misunderstanding from my side, or we do lack an updated interface to introduce beginners into the GUI system.
If developers can confirm a most recommended solution to current version of TGB, it will be great for all beginners to learn GUI.
05/30/2009 (9:30 am)
@Parker,Thank you so much to provide a solution to missing GuiProfile problem! I just started to look into GuiEditor and have spent 2 hours looking for answer like why I can't make GuiProfiles in profiles.cs show up in the drop-down menu.
There are lots of other posts about this but none of them can solve my problem, I guess that's because I use TGB 1.7.4?
Parker's solution does work well, I really appreciate it. But I'm still wondering if this is the official supported solution? I mean it doesn't feel right to delete a lot of codes in the script comes right from package. If not, why I can't follow any tutorial about Gui system by letting everything set to default? Also none of the tutorials about GUI mentioned what should I do if I want to use some preset GuiProfile.
I guess there must be some misunderstanding from my side, or we do lack an updated interface to introduce beginners into the GUI system.
If developers can confirm a most recommended solution to current version of TGB, it will be great for all beginners to learn GUI.
#8
Your tip above solved a lot of hair pulling.
Here's what i did to fix it all based on what you wrote.
1. Open the file "DirectoryWhereTGBIsInstalled\tgb\gameData\T2DProject\common\gui\profiles.cs
2. Remove "if(!isObject(GuiProfileName))" from every entry as instructed by you and save the file.
3. Open "DirectoryWhereTGBIsInstalled\tgb\gameData\T2DProject\templates\base\gameScripts\datablocks.cs"
4. Add this line as suggested above:
// this shows all profiles thanks to Parker & Steven
exec("common/gui/profiles.cs");
5. Save the file.
Now when I create a new project, I get all the correct profiles showing up in the GUI Editor.
Thanks once again Parker and Steven for this Fix. I wish the GG people would fix their code base so others who try out their software do not lose hair as I have.
06/27/2009 (10:25 pm)
Parker you are great.Your tip above solved a lot of hair pulling.
Here's what i did to fix it all based on what you wrote.
1. Open the file "DirectoryWhereTGBIsInstalled\tgb\gameData\T2DProject\common\gui\profiles.cs
2. Remove "if(!isObject(GuiProfileName))" from every entry as instructed by you and save the file.
3. Open "DirectoryWhereTGBIsInstalled\tgb\gameData\T2DProject\templates\base\gameScripts\datablocks.cs"
4. Add this line as suggested above:
// this shows all profiles thanks to Parker & Steven
exec("common/gui/profiles.cs");
5. Save the file.
Now when I create a new project, I get all the correct profiles showing up in the GUI Editor.
Thanks once again Parker and Steven for this Fix. I wish the GG people would fix their code base so others who try out their software do not lose hair as I have.
#9
11/09/2009 (9:53 am)
Bless you all Parker, Steven and Justin!
#10
I see the items in the drop down list, once applied, adding a new object ontop the newly created GUI crashes TGB.
The cool and not so cool... RE: JJ's fix
Cool you can modify the TGB items, like \tgb\gameData\T2DProject\common\gui\profiles.cs
and
\tgb\gameData\T2DProject\templates\base\gameScripts\datablocks.cs
then when you create a new game the code is added to the new game files of the same name and directory of your game.
Not so cool thing if the code is broken, you just end up adding the broken code to each new game.
I fixed the tutorial by creating a blank newGui, save it. Then go manually change it to "GuiModelessDialogProfile" in TorqueDev or NotePad. Reload the project and continue adding the rest of the buttons.
Still looking for GUI, GUI fix.
I maybe wrong, but I know for sure, I am crashing TGB with either of these fixes.
Cheers
12/22/2009 (1:36 pm)
Well PJ and JJ's fixes didn't work for me.I see the items in the drop down list, once applied, adding a new object ontop the newly created GUI crashes TGB.
The cool and not so cool... RE: JJ's fix
Cool you can modify the TGB items, like \tgb\gameData\T2DProject\common\gui\profiles.cs
and
\tgb\gameData\T2DProject\templates\base\gameScripts\datablocks.cs
then when you create a new game the code is added to the new game files of the same name and directory of your game.
Not so cool thing if the code is broken, you just end up adding the broken code to each new game.
I fixed the tutorial by creating a blank newGui, save it. Then go manually change it to "GuiModelessDialogProfile" in TorqueDev or NotePad. Reload the project and continue adding the rest of the buttons.
Still looking for GUI, GUI fix.
I maybe wrong, but I know for sure, I am crashing TGB with either of these fixes.
Cheers
Torque Owner Aaron K Murray