Blockland Forums > Modification Help

slash command to open GUI?

Pages: (1/1)

jamesking56:

Hi!

How can I make a slash command to open a GUI

e.g. /example to open example.gui

goz3rr:

First open you example.gui
And add this to the bottom:

--- Code: ---function Showexample(%Gui)
{
   %Gui = canvas.pushDialog(example);
}
--- End code ---
Then add to your client.cs:

--- Code: ---function clientcmdShowExample(%client)
{
Showexample();
}

--- End code ---


SpreadsPlague:

I'm almost 100% certain clientcmd won't work, and is also generally a bad idea. You should just bind opening the GUI to a key.

Secondly, the way goz3rr made it open is sloppy and inefficient. Assuming clientcmd would infact work your code only needs to look like this (in client.cs)


--- Code: ---function clientcmdOpenGUI()
{
canvas.pushDialog(GUIname);
}

--- End code ---


Amade:

It's clCmd and you'll need a support script that Truce made for it if you want to use a /command from the client's end.

Red_Guy:

to set it up so /opengui GuiName  will work you ned the following:

in server.cs

--- Code: ---function serverCmdOpenGui(%client, %guiName)
  {
   commandToClient(%client, 'OpenGui', %guiName);
  }

--- End code ---

in client.cs

--- Code: ---function clientCmdOpenGui(%guiName)
  {
   Canvas.pushDialog(%guiName);
  }

--- End code ---

definately complicated - but due to the way blockland and torque is setup, this is what you need.


Pages: (1/1)

Go to full version