I can only push Dialogs that were created in the in-Game editor
by Nmuta Jones · in Torque Game Engine · 03/24/2010 (12:35 am) · 3 replies
Ok this is really weird.
I have a simple inventory system. When I pick up something, I use Canvas.pushDialog( ) to push a bitmap to the screen.
What's happening is that ONLY THE GUI CONTROLS THAT I CREATE IN THE IN GAME EDITOR (after hitting "F10"), only those ones 'register' in the engine as being valid.
when I create identical controls in code, the code created ones don't work.
And yes, I am remember to do "exec" in client/init.cs to "exec" my new code created Gui files.
I have used a file comparing program to compare the ones created in game and the ones created in notepad and the code is identical. Yet ONLY the ones created in game work!
Example code: pebblesGui.gui:
that one works when, in game, I do
Canvas.pushDialog(pebblesGui);
but the EXACT SAME CODE will not work if I create it in notepad and exec the file in client/init.cs
and the pebbles code DOES WORK even after I shut the game down, and exec the pebbles Gui in client/init.cs, then the pebbles code still works. So what is it about gui stuff created in-game? Does it register somewhere else that I am not aware of?
I have a simple inventory system. When I pick up something, I use Canvas.pushDialog( ) to push a bitmap to the screen.
What's happening is that ONLY THE GUI CONTROLS THAT I CREATE IN THE IN GAME EDITOR (after hitting "F10"), only those ones 'register' in the engine as being valid.
when I create identical controls in code, the code created ones don't work.
And yes, I am remember to do "exec" in client/init.cs to "exec" my new code created Gui files.
I have used a file comparing program to compare the ones created in game and the ones created in notepad and the code is identical. Yet ONLY the ones created in game work!
Example code: pebblesGui.gui:
//--- OBJECT WRITE BEGIN ---
new GuiControl(pebblesGui) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "640 480";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiBitmapCtrl() {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "458 304";
Extent = "155 104";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "./icons/inv_pebbles.png";
wrap = "0";
};
};
//--- OBJECT WRITE END ---that one works when, in game, I do
Canvas.pushDialog(pebblesGui);
but the EXACT SAME CODE will not work if I create it in notepad and exec the file in client/init.cs
and the pebbles code DOES WORK even after I shut the game down, and exec the pebbles Gui in client/init.cs, then the pebbles code still works. So what is it about gui stuff created in-game? Does it register somewhere else that I am not aware of?
About the author
Lead Developer for MediaBreeze Multimedia
#2
It's definitely a notepad problem. If you check your console log it will most likely have a parse error at the start of the file. Wordpad and Notepad can save file using the wrong formatting making them unusable by the engine. Wordpad does it all the time and Notepad does it only once in a blue moon. It's best to avoid using both entirely when editing scripts.
In addition to Mike's suggestions, my preferred notepad replacement has always been Notepad++. There's also TorqueDev which was my preferred IDE for editing scripts until I made the jump to Torsion.
03/24/2010 (6:23 am)
Oh wow, Tribal, now that takes me back. I didn't think there were working downloads of it still floating around out there.It's definitely a notepad problem. If you check your console log it will most likely have a parse error at the start of the file. Wordpad and Notepad can save file using the wrong formatting making them unusable by the engine. Wordpad does it all the time and Notepad does it only once in a blue moon. It's best to avoid using both entirely when editing scripts.
In addition to Mike's suggestions, my preferred notepad replacement has always been Notepad++. There's also TorqueDev which was my preferred IDE for editing scripts until I made the jump to Torsion.
#3
You guys were right. Using Torsion trial now for the gui scripts and it works fine.
I'm shocked to find out that notepad is a script killer. I've been using Notepad on and off for a decade for scripting stuff here and there, and I never noticed that it was adding junk, except for when editing .cfg files for character export from Max.
03/24/2010 (8:48 am)
@ Mike and ScottYou guys were right. Using Torsion trial now for the gui scripts and it works fine.
I'm shocked to find out that notepad is a script killer. I've been using Notepad on and off for a decade for scripting stuff here and there, and I never noticed that it was adding junk, except for when editing .cfg files for character export from Max.
Torque Owner Mike Rowley
Mike Rowley
I always use Textpad and choose unix formatting so no extranious info get's secretly added.
Your best thing to use for making scripts tho is to purchase Torsion. It's made specifically for making cs and gui files.
If you want to try a free program made to make cs and gui files, you can try tribal Ide. It's quite old and unsupported, but works just the same. You dont get the features of torsion tho. (torsion is my prefered)
Notepad Could be your problem tho. Look in your console.log to see if you have any errors showing.