Author Topic: need help with %arg 1  (Read 2254 times)

OKAY! So i was going to make a mod. It works good BUT. The only thing that messes it up is

canvas.pushdialog(%arg1);

Okay so. Would i need to put like %arg1 in "" or somthing? I just dont get it.

the gui name

if %arg is nothing, then you need to state what %arg is,

post the whole script plz

Mind telling us what %arg1's value is?

the gui name

if %arg is nothing, then you need to state what %arg is,

post the whole script plz

registerOutputEvent(gameConnection,OpenGUI,"string 100 100");

function gameConnection::GUIOpener(%this, %arg1, %client)
{
   if(%arg1 $= "")
   {
      return;
   }
   
   canvas.popdialog(%arg1);
}

registerOutputEvent(gameConnection,OpenGUI,"string 100 100");

function gameConnection::GUIOpener(%this, %arg1, %client)
{
        echo(%arg1); <-------
   if(%arg1 $= "")
   {
      return;
   }
   
   canvas.popdialog(%arg1);
}

echo the arg, see what it is, if it is anything at all?

nothing. I click on reexecuted the addon. and clicked on the brick thats supposed to open it. Nothing happened. Checked the console. Nothing changed.

so echo(%arg1); returns nothing right?


registerOutputEvent(gameConnection, OpenGUI, string 100 100);

function gameConnection::GUIOpener(%this, %arg1, %client)
{
   if(%arg1 $= "")
   {
      return;
   }
   
   canvas.popdialog(%arg1);
}

No quotation marks on the string.

Oh! That almost fixed it. Just 1 problem. Syntax errors. or Error.

registerOutputEvent(gameConnection, OpenGUI, string 100 ##1##00);

function gameConnection::GUIOpener(%this, %arg1, %client)
{
   if(%arg1 $= "")
   {
      return;
   }
   
   canvas.popdialog(%arg1);
}

Oh! That almost fixed it. Just 1 problem. Syntax errors. or Error.

registerOutputEvent("gameConnection", "OpenGUI", "string 100 100");

function gameConnection::GUIOpener(%this, %arg1, %client)
{
   if(%arg1 $= "")
   {
      return;
   }
   
   canvas.popdialog(%arg1);
}

Er.. Try this. I had it backwards.

no syntax errors. But no GUI pops up still. I use like honormining. (me and a friend made a gui name honormining) But yea wont pop up.

Your event is named OpenGUI while the method is named GUIOpener

You're also trying to call a clientside function through the server.
Anytime anyone in the server triggers the event, it will open the GUI on the host's screen.

And finally, using both %this and %client in that function is redundant.


yes, u need to commandtoclient to open up the gui as headcrab said

Your event is named OpenGUI while the method is named GUIOpener

You're also trying to call a clientside function through the server.
Anytime anyone in the server triggers the event, it will open the GUI on the host's screen.

And finally, using both %this and %client in that function is redundant.



could you show me a example in scripting?

EDIT: Oh i see. Fixed! TY!
« Last Edit: August 05, 2010, 09:03:23 PM by Honorable »