Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-13-2006, 06:26 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Exclamation 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.
__________________
Skyld

Last edited by Skyld; 05-13-2006 at 08:36 PM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:57 AM.


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