Author Topic: Output event trouble[UnSolved]  (Read 926 times)

I am having problems with my event. You see I am trying to make a store event that uses a GUI. Maybe this has been done before but I cannot find one, if it works fine I will post it into add-ons. As of right now, I need to be able to complete the tasks.
  • Name the window with the output parameters(like the messageBoxDlg)
  • Add multiple parameters(sort of like a list)
I know that this code is rather simple, and I look like a noob, but I don't think the clients other that the host can see it.
Code: [Select]
registerOutputEvent(fxDTSBrick,setStore,"string 100 100");

function StoreGui()
{
    canvas.pushDialog(store);
}
function fxDTSBrick::setStore(%this, %arg1, %client)
{
if(%arg1 $= "")
{
return;
}

commandToClient(%client,'StoreGui',%arg1);

}
Please list what the changes do.
« Last Edit: March 18, 2014, 09:07:45 PM by KingDavid »

function StoreGui()
{
    canvas.pushDialog(store);
}


I'm guessing this is supposed to be the client-sided aspect that responds to the commandToClient call.
There's two things wrong with it.

  • It's in the server-sided part of the code. Move it to client.cs.
  • You need to prefix the name with clientCmd.

Thanks that fixed the problem where it wouldn't send to me, but clients other than the host can't see it. I moved the opening function to the gui. Though I would still like to make the first parameter name the window, sort of like the messageBoxDlg gui.
Code: [Select]
exec("./store.gui");

registerOutputEvent(fxDTSBrick,setStore,"string 100 100");

function fxDTSBrick::setStore(%this, %arg1, %client)
{
if(%arg1 $= "")
{
return;
}

commandToClient(%client,'StoreGui',%arg1);

}
function Store_Content::setTab(%this,%tab)
{
%c = %this.getCount();
for(%i=0;%i<%c;%i++)
{
%obj = %this.getObject(%i);
if(strPos(%obj.getName(),"Store_") > -1)
%obj.setVisible(0);
}
%tab.setVisible(1);
%tab.onTabWake();
}
I'm sure the last part has nothing to do with it.

Thanks that fixed the problem where it wouldn't send to me, but clients other than the host can't see it. I moved the opening function to the gui. Though I would still like to make the first parameter name the window, sort of like the messageBoxDlg gui.
Code: [Select]
exec("./store.gui");

registerOutputEvent(fxDTSBrick,setStore,"string 100 100");

function fxDTSBrick::setStore(%this, %arg1, %client)
{
if(%arg1 $= "")
{
return;
}

commandToClient(%client,'StoreGui',%arg1);

}
function Store_Content::setTab(%this,%tab)
{
%c = %this.getCount();
for(%i=0;%i<%c;%i++)
{
%obj = %this.getObject(%i);
if(strPos(%obj.getName(),"Store_") > -1)
%obj.setVisible(0);
}
%tab.setVisible(1);
%tab.onTabWake();
}
I'm sure the last part has nothing to do with it.
GUIs are client sided. You must give people your client sided add-on in order for them to see it.

Doesn't Blockland download the add-on for them, when they join? Anyways, I have been to servers where the host has had custom guis, and I could use them.

No. Guis are client sided and people will have to download your add-on to use them.

Anyways, I have been to servers where the host has had custom guis, and I could use them.
That's impossible. Either you forgot you downloaded them, or they used RTB's crappy gui downloading thing (which is crap and gone with RTB), or they re-used those default guis that you can open with a clientcmd

Hmm, I guess it could be the RTB thing. Could anyone tell me how to set the text name?

Hmm, I guess it could be the RTB thing. Could anyone tell me how to set the text name?
...set the text name?

Doesn't Blockland download the add-on for them, when they join? Anyways, I have been to servers where the host has had custom guis, and I could use them.
The only files the client downloads are shapes, textures, and sounds. Maybe some others I'm not thinking of
Script files (.cs and .gui) are never downloaded

Imagine if it did
the horror

...set the text name?
If you've ever used the MessageBoxOK output event, you'd understand, I think it's RTB.
Code: [Select]
registerOutputEvent(gameConnection,MessageBoxOK,"string 100 100\tstring 200 200");

function gameConnection::messageBoxOK(%this, %arg1, %arg2, %client)
{
if(%arg1 $= "" || %arg2 $= "")
{
return;
}

commandToClient(%client,'messageBoxOK',%arg1,%arg2);
}
I know this uses a default gui. The point is, the first string controls the gui's window name(text), and the second one sets the text in the window.
« Last Edit: February 25, 2014, 12:56:24 PM by KingDavid »


I know this uses a default gui. The point is, the first string controls the gui's window name(text), and the second one sets the text in the window.
That's because there is a clientcmd to do exactly that. You can't just set the name of a gui server sided.

That's because there is a clientcmd to do exactly that. You can't just set the name of a gui server sided.
Yeah I realized how silly the questioned seemed. What I was asking for is if someone could give me a start of code.
I think I might have an idea of what to do, from "A great torque functions guide". The thing I was having problems with is making the function.
Client
Code: [Select]
function clientCmdStoreGui(%arg1)
{
GuiWindowCtrl.setText(%arg1 text);

canvas.pushDialog(store);
}
Server
Code: [Select]
function fxDTSBrick::setStore(%this, %arg1, %client)
{
if(%arg1 $= "")
{
return;
}

commandToClient(%client,'StoreGui',getText(%arg1));

}
« Last Edit: March 09, 2014, 01:42:43 PM by KingDavid »

Well I have the Naming part done. I realized how dumb I look considering I just need the basic understanding of textctrls, I'll post the code in case anyone looks for a similar problem.
client.cs
Code: [Select]
function clientCmdStoreGui(%arg1)
{
winName.setText(%arg1);

canvas.pushDialog(store);
}
server.cs
Code: [Select]
registerOutputEvent(fxDTSBrick,setStore,"string 50 50");

function fxDTSBrick::setStore(%this, %arg1, %client)
{
if(%arg1 $= "")
{
return;
}

commandToClient(%client,'StoreGui',%arg1);

}
Now I just need to know how to make the parameters perform like a wrap. Sort of when you add a new event to the list another option to add an event will appear under. I just want this to give it a possible choice of continuing the output parameters.
« Last Edit: March 13, 2014, 07:23:07 PM by KingDavid »