Skyld |
05-13-2006 06:26 PM |
Dynamic serverlist info
Classic, hosted and gold servers can now dynamically send their own information to the serverlist by adding some code into their EventsBot. This allows servers to display live statistics, and event information (like Era does at the minute). If you choose not to feed information from your EventsBot, then the information that is on the serverlist will remain.
Here is the code that is required to create a serverinfo response. If you have an eventsbot already, it should not be difficult to adapt it:
PHP Code:
function onCreated()
{
sendtext("irc", "login", "EventsBot_servername");
}
function onReceiveText(texttype, textoptions, textlines)
{
if (texttype != "irc" ||
textoptions != "privmsg")
{
return;
}
switch (textlines[2][0])
{
case "!eventsbotlogin":
{
sendtext("irc", "privmsg", {"IRCBot", {"!eventadmins", {"acc", "acc"}}});
sendtext("irc", "privmsg", {"IRCBot", {"!eventchannel", "#channel"}});
// tell the serverlist that you are serving serverlist info
sendtext("irc", "privmsg", {"IRCBot", {"!handleserverinfo", 1}});
break;
}
// called whenever anybody clicks the server on the serverlist
case "!getserverinfo":
{
temp.list = {
"<center>",
"<font size=24>Server Name</font><br>",
"<img src=login_server_servername.png><br>",
"</center><sbreak>",
"<ignorelinebreaks>",
"Description"
};
sendtext("irc", "notice", {textlines[0], {"!serverinfo", temp.list}});
break;
}
}
}
If you want the existing info for your server, contact me via forum PM and I will send it to you. Also, if you are not sure about your server's image, run /find login_server_*.png in RC.
|