Poll

Did this tutorial help?

Yes
28 (56%)
No
7 (14%)
Somewhat
15 (30%)

Total Members Voted: 50

Author Topic: [Tutorial] Creating A GUI [Updated 4/1/2012]  (Read 13217 times)

i made one cant get it to open in game but i can assign a button to it heres client.cs

Code: [Select]
exec("./Test.gui");

    $remapDivision[$remapCount] = "Custom made GUI's";
    $remapName[$remapCount] = "Test GUI";
    $remapCmd[$remapCount] = "Open_Test";
    $remapCount++;

function TestButtonPush()
{
talk(hi);
}
Don't forget to create the function to open it.
Code: [Select]
function Open_Test(%toggle)
{
if(%toggle)
{
if(YOURGUINAMEGui.isAwake())
{
canvas.popDialog(YOURGUINAMEGui);
}

else
{
canvas.pushDialog(YOURGUINAMEGui);
}
}
}

i made one cant get it to open in game but i can assign a button to it heres client.cs

Code: [Select]
exec("./Test.gui");

    $remapDivision[$remapCount] = "Custom made GUI's";
    $remapName[$remapCount] = "Test GUI";
    $remapCmd[$remapCount] = "Open_Test";
    $remapCount++;

function TestButtonPush()
{
talk(hi);
}
Don't forget to create the function to open it.
Code: [Select]
function Open_Test(%toggle)
{
if(%toggle)
{
if(YOURGUINAMEGui.isAwake())
{
canvas.popDialog(YOURGUINAMEGui);
}

else
{
canvas.pushDialog(YOURGUINAMEGui);
}
}
}

ok ill add that

edit i get this from console
Code: [Select]
Client checking Add-On: Client_Test
Loading Add-On: Client_Test (CRC:-1853063057)
Executing Add-Ons/Client_Test/client.cs.
Add-Ons/Client_Test/Test.gui Line: 11 - Syntax error.
>>> Some error context, with ## on sides of error halt:
/--- OBJECT WRITE BEGIN ---

new GuiControl(Test) {

   profile = "GuiDefaultProfile";

   horizSizing = "right";

   vertSizing = "bottom";

   position = "0 0";

   extent = "640 480";

   minExtent = "8 2";

   visible = "1";



   new GuiWindowCtrl(Test GUI)## ##{

      profile = "GuiWindowProfile";

      horizSizing = "right";

      vertSizing = "bottom";

      position = "204 76";

      extent = "199 304";

      minExtent = "8 2";

      visible = "1";

      accelerator = "escape";

      maxLength = "255";
>>> Error report complete.

Executing Add-Ons/Client_Test/Test.gui.
Add-Ons/Client_Test/Test.gui Line: 11 - Syntax error.
>>> Some error context, with ## on sides of error halt:
/--- OBJECT WRITE BEGIN ---

new GuiControl(Test) {

   profile = "GuiDefaultProfile";

   horizSizing = "right";

   vertSizing = "bottom";

   position = "0 0";

   extent = "640 480";

   minExtent = "8 2";

   visible = "1";



   new GuiWindowCtrl(Test GUI)## ##{

      profile = "GuiWindowProfile";

      horizSizing = "right";

      vertSizing = "bottom";

      position = "204 76";

      extent = "199 304";

      minExtent = "8 2";

      visible = "1";

      accelerator = "escape";

      maxLength = "255";
>>> Error report complete.

here client.cs

Code: [Select]
exec("./Test.gui");

    $remapDivision[$remapCount] = "Custom made GUI's";
    $remapName[$remapCount] = "Test GUI";
    $remapCmd[$remapCount] = "Open_Test";
    $remapCount++;
function Open_Test(%toggle)
{
if(%toggle)
{
if(TestGui.isAwake())
{
canvas.popDialog(TestGui);
}

else
{
canvas.pushDialog(TestGui);
}
}
}
function TestButtonPush()
{
talk(hi);
}

also what scripting langauge is client.cs c++?
« Last Edit: April 05, 2012, 06:52:52 AM by deathrider »

-snip-

also what scripting langauge is client.cs c++?

Those errors are in Test.gui - there are missing '}'s. Remember, for every '{' there will be a closing '}'

And blockland runs on Torque Script.

Those errors are in Test.gui - there are missing '}'s. Remember, for every '{' there will be a closing '}'

And blockland runs on Torque Script.
ahh i see ok i can fix that
but client.cs is in the right formatting im starting to get this its all about knowing commands and the formatting anywhere i can find all the commands and how to format it

console replys with this error that i cannot fix something about ##

console error
Code: [Select]
Client checking Add-On: Client_Test
Loading Add-On: Client_Test (CRC:771396467)
Executing Add-Ons/Client_Test/client.cs.
Add-Ons/Client_Test/Test.gui Line: 11 - Syntax error.
>>> Some error context, with ## on sides of error halt:
/--- OBJECT WRITE BEGIN ---

new GuiControl(Test) {

   profile = "GuiDefaultProfile";

   horizSizing = "right";

   vertSizing = "bottom";

   position = "0 0";

   extent = "640 480";

   minExtent = "8 2";

   visible = "1";

}

   new ##G##uiWindowCtrl(TestGUI) {

      profile = "GuiWindowProfile";

      horizSizing = "right";

      vertSizing = "bottom";

      position = "204 76";

      extent = "199 304";

      minExtent = "8 2";

      visible = "1";

      accelerator = "escape";

      maxLength = "255";
>>> Error report complete.

Executing Add-Ons/Client_Test/Test.gui.
Add-Ons/Client_Test/Test.gui Line: 11 - Syntax error.
>>> Some error context, with ## on sides of error halt:
/--- OBJECT WRITE BEGIN ---

new GuiControl(Test) {

   profile = "GuiDefaultProfile";

   horizSizing = "right";

   vertSizing = "bottom";

   position = "0 0";

   extent = "640 480";

   minExtent = "8 2";

   visible = "1";

}

   new ##G##uiWindowCtrl(TestGUI) {

      profile = "GuiWindowProfile";

      horizSizing = "right";

      vertSizing = "bottom";

      position = "204 76";

      extent = "199 304";

      minExtent = "8 2";

      visible = "1";

      accelerator = "escape";

      maxLength = "255";
>>> Error report complete.

i fixed one error and was able to get client.cs to run absolutly rine its just the gui its forgeted its self

edit ok so my problem with everything is wtf is ## mean does it want spaces?
« Last Edit: April 05, 2012, 10:07:24 AM by deathrider »

console replys with this error that i cannot fix something about ##

console error
-snip-

i fixed one error and was able to get client.cs to run absolutly rine its just the gui its forgeted its self

edit ok so my problem with everything is wtf is ## mean does it want spaces?
You need a ; after the closing brackets in a GUI's code.

You need a ; after the closing brackets in a GUI's code.
Thank you

What is the function that is called when the value of a slider control changes? I know that you can set the command on the slider and that will be called when you let the mouse go on the control, but that doesn't account for sliding when the mouse is held down.
« Last Edit: April 06, 2012, 11:58:03 AM by Ipquarx »

What is the function that is called when the value of a slider control changes? I know that you can set the command on the slider and that will be called when you let the mouse go on the control, but that doesn't account for sliding when the mouse is held down.
Tried dump(); and trace(1); but if there is a function for it I cannot find it.

What is the function that is called when the value of a slider control changes? I know that you can set the command on the slider and that will be called when you let the mouse go on the control, but that doesn't account for sliding when the mouse is held down.
Ok Ipquarx, while I was making a GUI I found that for the slider control the function in the alt command box is called whenever the slider is changed; it is not called when you let go, but when you click it or drag it the function is called.