Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Dynamic serverlist info (https://forums.graalonline.com/forums/showthread.php?t=66016)

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(texttypetextoptionstextlines

  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.

xAndrewx 05-13-2006 06:37 PM

Very cool Skyld, very cool. :p

bumbo 05-15-2006 05:11 AM

Here is a question, does the picture required need to be on some central server location? Or can we host it on our server in a directory somewhere?

if it needs to be centralized we will run into the same problems as before, but if it can be hosted locally on our own servers (perhaps a coding issue?) then we can avoid having to track someone down to upload.

Edit:I assume after re-reading skyld's post that it can be held locally, I'd just like that confirmed please

Admins 05-15-2006 10:29 AM

We might add some way to share the images with the login server, right now it's not possible. But with the dynamic serverlist thing you can display different text, event results, ongoing events etc.

dNeonb 05-15-2006 10:11 PM

I like this. Could be quite useful. Good job :)

Matt 12-24-2010 06:06 AM

Sorry for the bump, but i recommend this get stuck. This is extremely wanted, and useful.

Deas_Voice 01-31-2011 10:32 PM

Quote:

Originally Posted by Matt (Post 1617843)
Sorry for the bump, but i recommend this get stuck. This is extremely wanted, and useful.

what he said.

--and it doesn't work for hosted anymore, could hosted have this function back? also, how do you set the icon of a server thought? i mean on the server list.

fowlplay4 02-01-2011 12:09 AM

Quote:

Originally Posted by Deas_Voice (Post 1626979)
what he said.

--and it doesn't work for hosted anymore, could hosted have this function back? also, how do you set the icon of a server thought? i mean on the server list.

You don't you have to make a request to Stefan to have it changed to the one you supply him.


All times are GMT +2. The time now is 10:08 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.