Author Topic: slash command to open GUI?  (Read 1304 times)

Hi!

How can I make a slash command to open a GUI

e.g. /example to open example.gui

First open you example.gui
And add this to the bottom:
Code: [Select]
function Showexample(%Gui)
{
   %Gui = canvas.pushDialog(example);
}
Then add to your client.cs:
Code: [Select]
function clientcmdShowExample(%client)
{
Showexample();
}

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: [Select]
function clientcmdOpenGUI()
{
canvas.pushDialog(GUIname);
}

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.

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

in server.cs
Code: [Select]
function serverCmdOpenGui(%client, %guiName)
  {
   commandToClient(%client, 'OpenGui', %guiName);
  }

in client.cs
Code: [Select]
function clientCmdOpenGui(%guiName)
  {
   Canvas.pushDialog(%guiName);
  }

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