Blockland Forums > Modification Help

Making a clientsided GUI show serversided variables.

Pages: << < (2/2)

Headcrab Zombie:

Using a message callback would basically do the same thing as using clientCmds, except you call it with messageClient instead of commandToClient, and if you want to update a variable on all clients you can do messageAll instead of looping through ClientGroup and sending a clientCmd to each object, which can make things easier and faster.

Anyways, here's an example I found:

--- Code: ---addMessageCallback('MsgEquipInv', handleEquipInv);

function handleEquipInv(%msgType, %msgString, %slot)
{
%slot++;
switch (%slot)
{
case (1):
Slot1BG.setBitmap("fps/client/ui/GUIBrickSideEquip.png");
case (2):
Slot2BG.setBitmap("fps/client/ui/GUIBrickSideEquip.png");
case (3):
Slot3BG.setBitmap("fps/client/ui/GUIBrickSideEquip.png");
case (4):
Slot4BG.setBitmap("fps/client/ui/GUIBrickSideEquip.png");
case (5):
Slot5BG.setBitmap("fps/client/ui/GUIBrickSideEquip.png");
}
}
--- End code ---

To call it on the client you would use messageClient(%client,'MsgEquipInv','',%slot);


otto-san:

Cool.

That makes things a lot easier! Thanks.  :cookieMonster:

That would be a serversided script, right?

Headcrab Zombie:

The message callback would be client side

Truce:


--- Quote from: Headcrab Zombie on September 22, 2010, 05:48:48 PM ---Using a message callback would basically do the same thing as using clientCmds, except you call it with messageClient instead of commandToClient, and if you want to update a variable on all clients you can do messageAll instead of looping through ClientGroup and sending a clientCmd to each object, which can make things easier and faster.

--- End quote ---

There's a commandToAll function; you don't have to do any looping.

Headcrab Zombie:

Yeah I kind figured that, but by the time I thought of it I was in class and couldn't access BL to check and didn't want to go on forums.

Pages: << < (2/2)

Go to full version