Creation/Dev/Troubleshooting Graal v4 IRC

From Graal Bible
Revision as of 03:50, 1 July 2007 by Twinny (talk | contribs) (Undo revision 8679 by Special:Contributions/Anti-Up (User talk:Anti-Up))

Written by Skyld, 28/08/2005.

Introduction

After a rising number of people are having problems using the IRC and events system in their scripting, I have decided to write this document to assist in troubleshooting problems.

No IRC server connection

If you are finding that commands like:

sendtext("irc", "login", "EventsBot");
sendtext("irc", "privmsg", {"IRCBot", "!resetevents"});

... in your events bots are not returning any responses, then your server might not be GScript2-enabled. You will need to use the old style scripting as described in Bots using old scripting.

IRC Bot appears to be online but does not receive data

If your IRC Bot is logging in and joining channels properly but not returning any information, the most simple problem is that you have made a spelling error.

function onRecieveText(texttype, textoptions, textlines)

This won't work because onReceiveText is spelt wrong. Ensure that it is spelt correctly.

function onReceiveText(texttype, textoptions, textlines)

EventsBot will not register

If you used the EventsBot start script from the Graal 4 IRC Wiki page, then you may encounter a problem where the EventsBot will not login correctly. This is simply fixed, by replacing this:

textlines[1] == "!eventsbotlogin"

With this:

textlines[2] == "!eventsbotlogin"

Thanks to napo_p2p for discovering this this and posting the error.

EventsBot is registered, but no admin control is available in the serverlist

When you receive a PRIVMSG from IRCBot saying "!eventsbotlogin", you must provide two important details about your setup.

  • Send the account names of those who should have admin access:
    sendtext("irc", "privmsg", {"IRCBot", {"!eventadmins", "AccountName", "AccountName2"}});
  • Send the discussion channel for your events:
    sendtext("irc", "privmsg", {"IRCBot", {"!eventchannel", "#ChannelName"}});

When the EventsBot logs in, after sending the above data, the listed account names should have access to the Admin tab for events when they log onto the game server.

My IRC bot occasionally disappears and does not reappear until script update

This could be for a couple of reasons:

  • The IRC server was reloaded and connections were reset
  • The IRC server fails or a problem arises
  • The gserver/npcserver has been restarted

To ensure that the IRC bot always restores it's connection, you should put your connect routine in a seperate function, and use something like this:

function onCreated() IRCConnect();
function onInitialized() IRCConnect();
function onServerListerConnect() IRCConnect();

Also, ensure that the IRC bot is correctly resetting it's connection by logging out in your connect routine:

// Logout first
sendtext("irc", "logout", "");
// Then login and do stuff
sendtext("irc", "login", "Nickname");

My IRC bot does not accept name changes properly on script update

This occurs because you have tried to use a new name without freeing your previous one. Just logging in again with a new name will not work. Instead, you have to log out and then log in using the new name.

sendtext("irc", "logout", "");
sendtext("irc", "login", "Nickname");

In fact, it's probably a good idea to make your IRC bot log out and in again on every connection.

Randomly, my IRC bot reports everyone in the channel joining again

ADDCHANNELUSER is sent to IRC scripts every time a user joins a channel that you or your IRC bot is also in. This allows making of a user list for that channel, or simply monitoring who joins and leaves. It has been known for this to occasionally occur, listing everyone in the channel at once. This could happen for a number of reasons:

  • You have reset your connection to the IRC server, maybe by a script update, and the IRC server is telling you again who is in the channel
  • The IRC server has been reloaded, and as a result, connections have been dropped

This is not a problem as such, but if this is a problem for you specifically, consider removing any messages that occur on this event, or if you are listing users, make sure your list does not show any user more than once.

My IRC bot is not setting it's name correctly

You may find that in an attempt to set your IRC bot's name, it may be named IRCBot_N instead. There is a simple reason for this. IRC connections from the serverside demand the nickname to begin with the following:

  • IRCBot_
  • EventsBot_
  • Graal_

Any other nicknames will not be accepted.

Note: This is not the case with IRC connections from the clientside.

Other problems

If you are having a problem that is not listed here, Skyld may be able to help you. Contact details are available on Skyld's user page, and may be able to help solve the problem. New problems will also be added here when found.