Blockland Forums > Modification Help
/command
Obibital:
Using a /command echos something
Im just now sure how the server would detect a /command at all.
I saw this and wondered how this worked
--- Quote from: Red_Guy on June 21, 2010, 04:01:28 PM ---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.
--- End quote ---
Im guessing that you would replace guiname with a message statement or an echo?
SpreadsPlague:
it works like this:
%guiName is whatever you put after /opengui
so if I said "/opengui ABCGui" it would then call OpenGUI(%guiName) [in this case %guiName is ABCGui so it would be OpenGUI(ABCGui)]
which would then perform Canvas.pushDialog(ABCGui); because ABCGui is what %guiName has been defined as
also, for clientCmd's to work you'll need a support add-on made by truce which I have no idea where to find
Obibital:
--- Quote from: SpreadsPlague on July 20, 2010, 10:34:18 AM ---servercmdYourCommand(%arguments)
{
whatever you want it to do
}
/yourcommand
--- End quote ---
Ahh, so instead of something like an if statement you use servercmd
like
--- Code: ---servercmdtest(%arguments)
{
echo ("worked")
}
and i would type /test?
**In another issue, what is a argument? ive looked in the appendix and many threads but failed to find the true answer. Before i learn to script, i want to be able to read it in plain english.
--- End code ---
SpreadsPlague:
don't actually put %arguments in the brackets, that was just to show you that's where you put arguments
arguments are like %client , %victim , %a, %b, etc etc
anyways make sure to add semicolons to ensure proper syntax
-tiredsnip-
Obibital:
--- Quote from: SpreadsPlague on July 20, 2010, 10:43:42 AM ---don't actually put %arguments in the brackets, that was just to show you that's where you put arguments
arguments are like %client , %victim , %a, %b, etc etc
anyways make sure to add semicolons to ensure proper syntax
your command should look like this
--- Code: ---servercmdtest()
{
echo("worked");
}
--- End code ---
--- End quote ---
servercmd's dont need to be in a function do they?
Well, i knew they were items that had %'s in front of them, like %client, or %obj, and whatnot
But what are they for? what do they do?
why do we need them? thats what i wanted to know