Trying to make a script to auto load the compass, I cannot figure out why it does not work, to errors.
//=========================================================================
// GUI Stuff
//=========================================================================
CompassWaypointGUI_File_Filename.delete();
CompassWaypointGUI_File.getObject(0).getObject(1).command = "CompassWaypointGUI.saveWaypointDelay();";
//Save button^^
CompassWaypointGUI_File.getObject(0).getObject(2).command = "CompassWaypointGUI.loadWaypointDelay();";
//Load button^^
//=========================================================================
// Functions
//=========================================================================
function CompassWaypointGUI::saveWaypointDelay()
{
%hostName = getSubStr($ServerInfo::Name, 0, strStr($ServerInfo::Name, "\'"));
%host = %host @ "'s server";
CompassWaypointGUI.saveWaypoints(%host);
}
function CompassWaypointGUI::loadWaypointDelay(%filename)
{
%hostName = getSubStr($ServerInfo::Name, 0, strStr($ServerInfo::Name, "\'"));
%host = %host @ "'s server";
if(isFile("config/client/WP/" @ %hostName @ "'s server.txt"))
CompassWaypointGUI.loadWaypoints(%host);
}
package Compass_Load
{
function serverConnection::onConnectionAccepted()
{
%host = getSubStr($ServerInfo::Name, 0, strStr($ServerInfo::Name, "\'"));
if(isFile("config/client/WP/" @ %host @ "'s server.txt"))
{
%filename = "config/client/WP/" @ %host @ "'s server.txt";
CompassWaypointGUI.loadWaypointDelay(%filename);
}
parent::onConnectionAccepted();
}
};
activatePackage(Compass_Load);