Author Topic: GUI Help  (Read 3649 times)

canvas.pushDialog(Home.gui); isn't working for me. I've typed it in 20+ times and it still hasn't worked. Note: Home.gui is the gui I want it to pull up.

Also, how do I make it so when I bind a key, the GUI comes up? So far I have this, but it doesn't work.

Code: [Select]
$remapDivision[$remapCount] = "Log Bot GUI";
$remapName[$remapCount] = "Open Gui";
$remapCmd[$remapCount] = "canvas.pushdialog(LogBotGUI.gui);";
$remapCount++;

Are you using mission editor for your GUI?


the .gui after the LogBotGUI isn't necessary.

canvas.pushDialog(guiname);

your version will only work if you have an object named home that has a variable on it called gui that contains the gui you want to open.

The string you set remapCmd[$remapcount] equal to is supposed to be the name of the function you want to call
For example:

Code: [Select]
$remapDivision[$remapCount] = "Log Bot GUI";
$remapName[$remapCount] = "Open Gui";
$remapCmd[$remapCount] = "openmygui";
$remapCount++;

function openmygui(%pressed)
{
     //will call this function twice, once when the button is pressed, once when released
     //the only difference will be the %pressed argument

     if(!%pressed)
          return; //we don't want anything happening when we release the button

     if(home.isawake()) //assuming that home is the name of your gui
          canvas.popdialog(home);
     else
          canvas.pushdialog(home);
}
« Last Edit: April 21, 2013, 11:28:43 PM by Nexus »

Thanks guys! Ill let you know if I have any more problems!

EDIT: still doesn't work. When I do the key bind, it does nothing and when I do it manually, says

pushDialog(): Invalid control: Home

PROOF BELOW that Home really exists. :panda:
« Last Edit: April 22, 2013, 08:27:03 AM by MrLoganator111 »

EDIT: still doesn't work. When I do the key bind, it does nothing and when I do it manually, says

pushDialog(): Invalid control: Home

PROOF BELOW that Home really exists. :panda:
Did you execute the file? Is the GUIs name Home? Do you have any syntax errors? Post the file here.

The home file isn't home.gui which because it's a Mac, I'm sure it should be.
Make sure it's the FILE NAME ON THE MAC NOT IN THE SCRIPT.

Here's the folder with everything to do with the gui in it.

Mediafire Download

Here's the folder with everything to do with the gui in it.

Mediafire Download

Code: [Select]
//--- OBJECT WRITE BEGIN ---
new GuiControl(LogBotGUI) {
   profile = "GuiDefaultProfile";

If the GUI's control name is LogBotGUI, then you must do canvas.pushDialog(LogBotGUI);

The Home file is not what canvas.pushDialog references. I also noticed that "Home" has no file extension (using Windows 8) and it's not Home.cs or Home.gui.

Also, in your client.cs script, it does not execute the gui. You must add this code to your script :

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

or

Code: [Select]
exec("./Home.cs");

..based on the file extension of the Home gui

Code: [Select]
//--- OBJECT WRITE BEGIN ---
new GuiControl(LogBotGUI) {
   profile = "GuiDefaultProfile";

If the GUI's control name is LogBotGUI, then you must do canvas.pushDialog(LogBotGUI);

The Home file is not what canvas.pushDialog references. I also noticed that "Home" has no file extension (using Windows 8) and it's not Home.cs or Home.gui.
Ok i changed them to both be Home.cs and it works.

Also, in your client.cs script, it does not execute the gui. You must add this code to your script :

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

or

Code: [Select]
exec("./Home.cs");

..based on the file extension of the Home gui
Im not good at coding and not sure where to put that or how to make it activate when i open it or whatever. If you could do that so I could brown townyze it for future reference that would be awesome. I learn by looking at the code, not by going "Here you go, put this in a bunch of random places until you figure it out!" lol.
Thanks! Responses above.

why would it be a .cs instead of a .gui :Y.

why would it be a .cs instead of a .gui :Y.
I prefer .cs cuz i can edit stuff easier that way.

why would it be a .cs instead of a .gui :Y.
Both can contain code, it actually doesn't matter at all from what I've seen.

Code: [Select]
exec("./Home.cs");
Can somebody help me put this into the client.cs? The actual GUI name is Home (its a .cs file, but i have it set so that the extension is hidden)


ALSO, on a less important note, could somebody help me fix this function so that it adds the 2 variables?
[code ]MessageBoxOk(\"Calculations\",\"$add1@\" + \"@$add2@\" = \"@$result);[ /code]


NVM Purple Metro told me In Game, but i still need that 1st part ;c
« Last Edit: April 22, 2013, 09:04:14 PM by MrLoganator111 »