atom(script) IRC_ReceivedNotice(string User, string From, string To, string Message) { ; This event is fired every time that an IRCUser that you have connected ; receives a NOTICE. You can do anything fancy you want with this, but, ; for now, we're just going to echo it to the console window. ; Deal with Nickserv: if (${From.Equal[Nickserv]}) { ; NOTE: 'test1' and 'test2' have already been registered with ; Nickserv. if (${Message.Find[This nickname is registered and protected]}) { ; Send the password to Nickserv. You might want to do this ; more elegantly by saving passwords in the script via variables ; or xml. if (${To.Equal[test1]}) { IRCUser[test1]:PM[Nickserv,"identify Test1Password"] } elseif (${To.Equal[test2]}) { IRCUser[test2]:PM[Nickserv,"identify Test2Password"] } return } elseif (${Message.Find[Password accepted]}) { echo [${To}] Identify with Nickserv successful ; if this was an attempt to register the nick after having been ; denied access to a channel, we want to indicate that it was ; successful by resetting the number of attempts to zero if (${RegisteredChannelRetryAttempts} > 0) RegisteredChannelRetryAttempts:Set[0] return } elseif (${Message.Find[Password incorrect]}) { echo Incorrect password while attempting to identify ${To} with Nickserv return } elseif (${Message.Find[Password authentication required]}) { echo Password authentication is required before you can issue commands to Nickserv return } elseif (${Message.Find[nick, type]}) { ; Junk message we don't need to see return } elseif (${Message.Find[please choose a different]}) { ; Junk message we don't need to see return } } if (${Message.Find[DCC Send]}) { ; This is handled by the CTCP event -- I'm not sure why clients send both ; a NOTICE and a CTCP when they're dcc'ing files return } elseif (${Message.Find[DCC Chat]}) { ; This is handled by the CTCP event -- I'm not sure why clients send both ; a NOTICE and a CTCP when they're dcc'ing files return } echo [${User}] ${To} just received a NOTICE from ${From} :: "${Message}" } atom(script) IRC_ReceivedChannelMsg(string User, string Channel, string From, string Message) { ; This event is fired every time that an IRCUser that you have connected ; receives a Channel Message. You can do anything fancy you want with this, ; but, for now, we're just going to echo it to the console window. echo [${User} - ${Channel}] -- (${From}) "${Message}" } atom(script) IRC_ReceivedPrivateMsg(string User, string From, string To, string Message) { ; This event is fired every time that an IRCUser that you have connected ; receives a Private Message. You can do anything fancy you want with this, ; but, for now, we're just going to echo it to the console window. ; NOTE: ${User} should always be the same as ${To} in this instance. However, it is ; included for continuity's sake. echo [Private Message -> ${To}] (${From}) "${Message}" } atom(script) IRC_ReceivedEmote(string User, string From, string To, string Message) { ; This event is fired every time that an IRCUser recognizes an "emote" ; from another user. Please note that ${To} is typically a 'channel' ; in this event. echo [${User} - ${To}] ${From} "${Message}" } atom(script) IRC_ReceivedCTCP(string User, string From, string To, string Message) { ; This event is fired every time that an IRCUser that you have connected ; receives a CTCP request. ; IMPORTANT: isxIRC handles all of these requests for you, so this ; event is only here to let you know that it occured. echo [${User} - CTCP from ${From} to ${To}] "${Message}" } atom(script) IRC_TopicSet(string User, string Channel, string NewTopic, string TopicSetBy) { ; This event is fired every time that someone changes the topic of a channel ; of which one of your IRCUser connections is a part. You can do anything ; fancy you want with this, but, for now, we're just going to echo it to the ; console window. echo [${User} - ${Channel}] New Topic: "'${NewTopic}'" (by ${TopicSetBy}) } atom(script) IRC_NickChanged(string User, string OldNick, string NewNick) { ; This event is fired every time that someone changes their NICK in a channel ; of which one of your IRCUser connections is a part. You can do anything ; fancy you want with this, but, for now, we're just going to echo it to the ; console window. echo [${User}] '${OldNick}' has changed their Nick to '${NewNick}' } atom(script) IRC_KickedFromChannel(string User, string Channel, string WhoKicked, string KickedBy, string Reason) { ; This event is fired every time that one of your IRCUsers are kicked from a ; channel. You can do anything fancy you want to do with this, but, for now, we're ; just going to echo the information to the console window echo [${User}] ${WhoKicked} has been KICKED from ${Channel}! echo Reason: "${Reason}" (by ${KickedBy}) ; Auto rejoin! :) IRCUser[${WhoKicked}]:Join[${Channel}] } atom(script) IRC_NickJoinedChannel(string User, string Channel, string WhoJoined) { ; This event is fired every time that someone joins a channel other than ; the IRCUser. echo [${User} - ${Channel}] ${WhoJoined} has joined channel ${Channel}. } atom(script) IRC_NickLeftChannel(string User, string Channel, string WhoLeft) { ; This event is fired every time that someone leaves a channel other than ; the IRCUser. This event is NOT fired when someone (or yourself) is KICKED echo [${User} - ${Channel}] ${WhoLeft} has left channel ${Channel} } atom(script) IRC_NickQuit(string User, string Channel, string Nick, string Reason) { ; This event is fired every time that someone QUITS the server if (${Channel.Length} == 0 ) { echo [${User}] ${Nick} has QUIT. (${Reason}) } else { echo [${User} - ${Channel}] ${Nick} has QUIT. (${Reason}) } } atom(script) IRC_PRIVMSGErrorResponse(string User, string ErrorType, string To, string Response) { ; This event is fired whenever an IRCUser that you have connected receives an ; error response while trying to send a PM. ; NOTE: The IRC protocol considers a message sent to a channel to be a "PM" to ; that channel. ; Possible ${ErrorType} include: "NO_SUCH_NICKORCHANNEL", "NO_EXTERNAL_MSGS_ALLOWED" if (${ErrorType.Equal[NO_SUCH_NICKORCHANNEL]}) { echo [${User}] Sorry, '${To}' does not exist. return } elseif (${ErrorType.Equal[NO_EXTERNAL_MSGS_ALLOWED]}) { echo [${User}] Sorry, ${To} does not allow for external messages. echo [${User}] You will need to join ${To} in order to send messages to the channel. return } } atom(script) IRC_JOINErrorResponse(string User, string ErrorType, string Channel, string Response) { ; This event is fired whenever an IRCUser that you have connected receives an ; error response while trying to join a channel. ; Possible ${ErrorType} include: "BANNED", "MUST_BE_REGISTERED" if (${ErrorType.Equal[BANNED]}) { echo [${User}] Sorry, you have been banned from ${Channel}! return } elseif (${ErrorType.Equal[REQUIRES_KEY]}) { echo [${User}] Sorry, this channel requires a password. return } elseif (${ErrorType.Equal[MUST_BE_REGISTERED]}) { echo [${User}] Received a message that we were not identified/registered. ; We will try and identify with nickserv and rejoin a total of 5 times before giving up. ; This is necessary because sometimes the script will try and join a registered channel ; before nickserv has a chance to acknowledge identification. Again, this method is ; not very elegant because the passwords are hardcoded; however, it proves the point. if (${RegisteredChannelRetryAttempts} <= 5) { echo [${User}] Identifying with Nickserv now. if (${UserName.Equal[test1]}) { IRCUser[test1]:PM[Nickserv,"identify Test1Password"] } elseif (${User.Equal[test2]}) { IRCUser[test2]:PM[Nickserv,"identify Test2Password"] } IRCUser[${User}]:Join[${Channel}] RegisteredChannelRetryAttempts:Inc return } } } atom(script) IRC_AddChannelBan(string User, string Channel, string WhoSet, string Ban) { ; This event is fired whenever an IRCUser that you have connected receives a ; message that a ban has been added to the channel. isxIRC handles updating ; the banlist for each channel, so this event is just here for notifying the ; user echo [${User} - ${Channel}] ${WhoSet} has banned "${Ban}"! } atom(script) IRC_RemoveChannelBan(string User, string Channel, string WhoSet, string Ban) { ; This event is fired whenever an IRCUser that you have connected receives a ; message that a ban has been removed from a channel. isxIRC handles updating ; the banlist for each channel, so this event is just here for notifying the ; user echo [${User} - ${Channel}] ${WhoSet} has removed the ban "${Ban}"! } atom(script) IRC_UnhandledEvent(string User, string Command, string Param, string Rest) { ; This event is here to handle any events that are not handled otherwise by the ; the extension. There will probably be a lot of spam here, so you won't want to ; echo everything. The best thing to do is only use this event when there is something ; that is happening with the client that you want added as a feature to isxIRC and need ; the data to tell Amadeus. ; However, we do want any ERROR messages! if (${Command.Equal[ERROR]}) { echo CRITICAL IRC ERROR: ${Rest} } } atom(script) IRC_NickTypeChange(string User, string Channel, string NickName, string NickType, string Toggle, string WhoSet) { ; This event is fired whenever an IRCUser that you have connected receives an ; message that a nick has had their 'type' changed on a channel (ie, being set ; as an OP) ; Possible ${NickType} include: "OWNER", "SOP", "OP", "HOP", "Voice", "Normal" ; Possible ${Toggle} include: "TRUE, "FALSE" ; Ok, first of all, if it's Chanserv that's doing the MODE changing, we just don't ; care enough to echo it. If you want to utilize it in your scripts otherwise, feel ; free! if (${WhoSet.Find[Chanserv]}) return ; NOTE: isxIRC takes care of updating the Nicks lists for all channels with their ; 'type'. So, the script is only responsible for notifying the user or any ; other custom functions desired. if (${NickType.Equal[OWNER]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${NickName} has been made an OWNER on ${Channel} by ${WhoSet}! else echo [${User}] ${NickName} has had their OWNER flag removed on ${Channel} by ${WhoSet}! } elseif (${NickType.Equal[SOP]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${NickName} has been made a SUPER OPERATOR on ${Channel} by ${WhoSet}! else echo [${User}] ${NickName} has had their SUPER OPERATOR flag removed on ${Channel} by ${WhoSet}! } elseif (${NickType.Equal[OP]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${NickName} has been made an OPERATOR on ${Channel} by ${WhoSet}! else echo [${User}] ${NickName} has had their OPERATOR flag removed on ${Channel} by ${WhoSet}! } elseif (${NickType.Equal[HOP]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${NickName} has been made a HALF OPERATOR on ${Channel} by ${WhoSet}! else echo [${User}] ${NickName} has had their HALF OPERATOR flag removed on ${Channel} by ${WhoSet}! } elseif (${NickType.Equal[VOICE]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${NickName} has been made a VOICE on ${Channel} by ${WhoSet}! else echo [${User}] ${NickName} has had their VOICE flag removed on ${Channel} by ${WhoSet}! } } atom(script) IRC_ChannelModeChange(string User, string Channel, string ModeType, string Toggle, string WhoSet, string Extra) { ; This event is fired whenever an IRCUser that you have connected receives an ; message that a channel has had its 'mode' changed. ; NOTE: This event will fire for every user that's in a channel! So, if you ; have more than one user in a channel, you'll get duplicate messages :) ; Possible ${ModeType} include: "PASSWORD", "LIMIT", "SECRET", "PRIVATE", "INVITEONLY", ; "MODERATED", "NOEXTERNALMSGS", "ONLYOPSCHANGETOPIC", "REGISTERED", ; "REGISTRATIONREQ", "NOCOLORSALLOWED" ; Possible ${Toggle} include: "TRUE, "FALSE" ; Possible ${Extra} include: The "password" for the PASSWORD ${ModeType} and the "limit" ; for the LIMIT ${ModeType} ; Ok, first of all, if it's the server that's doing the MODE changing, we just don't ; care enough to echo it. If you want to utilize it in your scripts otherwise, feel ; free! variable int i = 1 do { if (${IRCUser[${i}].Server.Equal[${WhoSet}]}) return } while (${i:Inc} <= ${IRC.NumUsers}) ; NOTE: isxIRC takes care of updating the Channel lists within the extension. So, the ; script is only responsible for notifying the user or any other custom functions desired. if (${ModeType.Equal[PASSWORD]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] A PASSWORD has been set on ${Channel}: ${Extra} (${WhoSet}) else echo [${User}] ${WhoSet} has removed the PASSWORD on ${Channel} } elseif (${ModeType.Equal[LIMIT]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] A LIMIT has been placed on ${Channel} of ${Extra} Users! (${WhoSet}) else echo [${User}] ${WhoSet} has removed the user LIMIT on ${Channel} } elseif (${ModeType.Equal[SECRET]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as SECRET by ${WhoSet} else echo [${User}] ${WhoSet} has removed the SECRET flag from ${Channel} } elseif (${ModeType.Equal[PRIVATE]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as PRIVATE by ${WhoSet} else echo [${User}] ${WhoSet} has removed the PRIVATE flag from ${Channel} } elseif (${ModeType.Equal[INVITEONLY]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as INVITE ONLY by ${WhoSet} else echo [${User}] ${WhoSet} has removed the INVITE ONLY flag from ${Channel} } elseif (${ModeType.Equal[MODERATED]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as MODERATED by ${WhoSet} else echo [${User}] ${WhoSet} has removed the MODERATED flag from ${Channel} } elseif (${ModeType.Equal[NOEXTERNALMSGS]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as NO EXTERNAL MESSAGES by ${WhoSet} else echo [${User}] ${WhoSet} has removed the NO EXTERNAL MESSAGES flag from ${Channel} } elseif (${ModeType.Equal[ONLYOPSCHANGETOPIC]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as ONLY OPS CHANGE TOPIC by ${WhoSet} else echo [${User}] ${WhoSet} has removed the ONLY OPS CHANGE TOPIC flag from ${Channel} } elseif (${ModeType.Equal[REGISTERED]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as REGISTERED by ${WhoSet} else echo [${User}] ${WhoSet} has removed the REGISTERED flag from ${Channel} } elseif (${ModeType.Equal[REGISTRATIONREQ]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as REGISTRATION REQUIRED by ${WhoSet} else echo [${User}] ${WhoSet} has removed the REGISTRATION REQUIRED flag from ${Channel} } elseif (${ModeType.Equal[NOCOLORSALLOWED]}) { if (${Toggle.Equal[TRUE]}) echo [${User}] ${Channel} has been designated as NO COLORS ALLOWED by ${WhoSet} else echo [${User}] ${WhoSet} has removed the NO COLORS ALLOWED flag from ${Channel} } } function main() { ; If isxIRC isn't loaded, then no reason to run this script. if (!${IRC(exists)}) return ;Initialize some variables variable int RegisteredChannelRetryAttempts = 0 variable int UsersCount = 1 variable int ChannelsCount = 1 variable int NicksCount = 1 ;Initialize/Attach the event Atoms that we defined previously Event[IRC_ReceivedNotice]:AttachAtom[IRC_ReceivedNotice] Event[IRC_ReceivedChannelMsg]:AttachAtom[IRC_ReceivedChannelMsg] Event[IRC_ReceivedPrivateMsg]:AttachAtom[IRC_ReceivedPrivateMsg] Event[IRC_TopicSet]:AttachAtom[IRC_TopicSet] Event[IRC_NickChanged]:AttachAtom[IRC_NickChanged] Event[IRC_KickedFromChannel]:AttachAtom[IRC_KickedFromChannel] Event[IRC_ReceivedCTCP]:AttachAtom[IRC_ReceivedCTCP] Event[IRC_PRIVMSGErrorResponse]:AttachAtom[IRC_PRIVMSGErrorResponse] Event[IRC_JOINErrorResponse]:AttachAtom[IRC_JOINErrorResponse] Event[IRC_NickTypeChange]:AttachAtom[IRC_NickTypeChange] Event[IRC_NickJoinedChannel]:AttachAtom[IRC_NickJoinedChannel] Event[IRC_NickLeftChannel]:AttachAtom[IRC_NickLeftChannel] Event[IRC_NickQuit]:AttachAtom[IRC_NickQuit] Event[IRC_ReceivedEmote]:AttachAtom[IRC_ReceivedEmote] Event[IRC_ChannelModeChange]:AttachAtom[IRC_ChannelModeChange] Event[IRC_AddChannelBan]:AttachAtom[IRC_AddChannelBan] Event[IRC_RemoveChannelBan]:AttachAtom[IRC_RemoveChannelBan] Event[IRC_UnhandledEvent]:AttachAtom[IRC_UnhandledEvent] ; Connect to irc.lavishsoft.com with two connections. Use "Test1" ; as the NICK for the first one, and "Test2" as the nick for the second. ; Note that your connections do NOT have to be to the same server; however, ; all Nicks MUST be different (even if they're on different servers) IRC:Connect[irc.lavishsoft.com,Test1] wait 5 IRC:Connect[irc.lavishsoft.com,Test2] wait 5 ; NOTE: The 'IRC_ReceivedNotice' atom will take care of identifying us with NickServ ; Now, since we're scripting ALL the events ...let's turn on QuietMode. If you are ; debugging new scripts, or are having problems, be sure to turn it off so that ; the extension will spew things to the console. With QuietMode turned on, you won't ; see much of anything in the console. If you want to avoid the initial spam of logging ; in and joining channels, then just move this line to earlier in this function. IRC:QuietMode[on] ; Join some channels ;IRCUser[test1]:Join[#isxeq2] ;wait 25 IRCUser[test1]:Join[#isxvg] wait 25 ;IRCUser[test2]:Join[#macroquest] ;wait 25 IRCUser[test2]:Join[#isxvg] ;Tell the user that the script has initialized and is running! echo isxIRC Sample Script [All features sampling] ACTIVE ; This bit of scripting tells the script to "waitframe" over and ; over while ${IRC(exists)}. In other words, as long as the ; extension is loaded. do { waitframe } while ${IRC(exists)} ;We're done with the script, so let's detach all of the event atoms Event[IRC_ReceivedNotice]:DetachAtom[IRC_ReceivedNotice] Event[IRC_ReceivedChannelMsg]:DetachAtom[IRC_ReceivedChannelMsg] Event[IRC_ReceivedPrivateMsg]:DetachAtom[IRC_ReceivedPrivateMsg] Event[IRC_TopicSet]:DetachAtom[IRC_TopicSet] Event[IRC_NickChanged]:DetachAtom[IRC_NickChanged] Event[IRC_KickedFromChannel]:DetachAtom[IRC_KickedFromChannel] Event[IRC_ReceivedCTCP]:DetachAtom[IRC_ReceivedCTCP] Event[IRC_PRIVMSGErrorResponse]:DetachAtom[IRC_PRIVMSGErrorResponse] Event[IRC_JOINErrorResponse]:DetachAtom[IRC_JOINErrorResponse] Event[IRC_NickTypeChange]:DetachAtom[IRC_NickTypeChange] Event[IRC_NickJoinedChannel]:DetachAtom[IRC_NickJoinedChannel] Event[IRC_NickLeftChannel]:DetachAtom[IRC_NickLeftChannel] Event[IRC_NickQuit]:DetachAtom[IRC_NickQuit] Event[IRC_ReceivedEmote]:DetachAtom[IRC_ReceivedEmote] Event[IRC_ChannelModeChange]:DetachAtom[IRC_ChannelModeChange] Event[IRC_AddChannelBan]:DetachAtom[IRC_AddChannelBan] Event[IRC_RemoveChannelBan]:DetachAtom[IRC_RemoveChannelBan] Event[IRC_UnhandledEvent]:DetachAtom[IRC_UnhandledEvent] ;Send a final message telling the user that the script has ended echo isxIRC Sample Script INACTIVE }