Hello, I'm trying to get VCE variables to display in a GUI.
%error = forceRequiredAddOn("Event_Variables");
if(%error == $Error::AddOn_NotFound)
{
error("Server_AlxGUITest - required Add-On Event_Variables not found");
return;
}
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("level","AlxGUIPrints","$AlxGuiPrints::level","string 255","Server_AlxTestGui","",0,1);
}
else
{
if(isobject(localclientconnection))
clientCmdMessageBoxOk("Add-ons","Server_AlxGuiTest cannot run because you do not have RTB installed.");
else
error("Server_AlxGuiTest - cannot run because you do not have RTB installed.");
return;
}
package AlxGUIPrints
{
function GameConnection::spawnPlayer(%this)
{
%ret = Parent::spawnPlayer(%this);
%this.schedule(150,AlxGuiPrints);
return %ret;
}
function VariableGroup::setVariable(%group,%type,%name,%value,%obj) //for all non-special changes
{
Parent::setVariable(%group,%type,%name,%value,%obj);
if(%obj.getClassName() $= "Player")
%obj.client.AlxGuiPrints();
if(%obj.getClassName() $= "GameConnection")
%obj.AlxGuiPrints();
if(%obj.getClassName() $= "SetValue")
%obj.AlxGuiPrints();
}
function GameConnection::setScore(%this,%score) //for <var:cl:score> changes
{
%ret = Parent::setScore(%this,%score);
%this.AlxGuiPrints();
return %ret;
}
function Player::changeDatablock(%this,%data,%c) //for <var:pl:datablock> and <var:pl:maxhealth> changes
{
%ret = Parent::changeDatablock(%this,%data,%c);
if(isObject(%this.client))
%this.client.AlxGuiPrints();
return %ret;
}
function serverCmdUseTool(%client,%slot) //for <var:pl:currentitem> changes
{
Parent::serverCmdUseTool(%client,%slot);
%client.AlxGuiPrints();
}
function serverCmdUnUseTool(%client) //for <var:pl:currentitem> changes
{
Parent::serverCmdUnUseTool(%client);
%client.AlxGuiPrints();
}
function serverCmdUseSprayCan(%client,%color) //for <var:pl:currentitem> changes
{
Parent::serverCmdUseSprayCan(%client,%color);
%client.AlxGuiPrints();
}
function serverCmdUseFXCan(%client,%id) //for <var:pl:currentitem> changes
{
Parent::serverCmdUseFXCan(%client,%id);
%client.AlxGuiPrints();
}
function Armor::onDamage(%data,%this,%damage) //for <var:pl:health> and <var:pl:damage> changes
{
%ret = Parent::onDamage(%data,%this,%damage);
if(isObject(%this.client))
%this.client.AlxGuiPrints();
return %ret;
}
};
activatePackage(AlxGuiPrints);
function GameConnection::AlxGuiPrints(%this)
{
leveltext.SetValue("Level " @ $AlxGuiPrints::level);
}
(I took most of this code from Chrono's VCE HUD prints if you are wondering.)
leveltext is the text in the HUD, it successfully changes, but displays <var:cl:level> which I set in the RTB prefs, however I want it to display the variable.
Any help with this would be fantastic :)