Page 1 of 1

Autolog Into IRC

Posted: Tue Jul 12, 2005 5:55 am
by Fixxer
How difficult would it be to create a snippet or .inc that would automatically log into an IRC server and get in a channel based off an .ini file?

I tried to simply write in a sub that would log a character in, but it was always the same character regardless of which character I actually logged in.

Thanks.

Posted: Tue Jul 12, 2005 7:23 am
by drzoon
I wrote a sub to log onto IRC with my character name, relevant sections below:

Code: Select all

/declare INI string outer "Whatever_${Me.Name}.ini"

/declare UseIRC bool outer ${Ini[${INI},General_Options,UseIRC]}
/declare IRCServer string outer ${Ini[${INI},IRC_Settings,IRCServer]}
/declare IRCPort int outer ${Ini[${INI},IRC_Settings,IRCPort]}
/declare IRCChannel string outer ${Ini[${INI},IRC_Settings,IRCChannel]}

|### Join IRC ###
Sub JoinIRC
	/if (${IRCChannel.Left[1].NotEqual[#]}) {
		/echo Channel name needs to start with a #
		/endmacro
	}

	/if (${Irc}) {
		/if (${Irc.Server.NotEqual[${IRCServer}]} || ${Irc.Nick.NotEqual[${Me.Name}]}) {
			/squelch /i quit
			/squelch /iconnect ${IRCServer} ${IRCPort} ${IRCChannel} ${Me.Name}
		} else {
			| This is currently broken in the MQ2IRC plugin code, it will always re-join the channel
			/if (${IRC.Channel.NotEqual[${IRCChannel}]}) {
				/squelch /i part
				/i join ${IRCChannel}
			}
		}
	} else {
		/squelch /iconnect ${IRCServer} ${IRCPort} ${IRCChannel} ${Me.Name}
	}
	/delay 3s
/return
Ini file:

Code: Select all

[General_Options]
UseIRC=1
[IRC_Settings]
IRCServer=local.irc.server
IRCPort=6667
IRCChannel=#botchan
I haven't played for a couple of months, so not sure if recent changes to IRC plugin have fixed the ${IRC.Channel} problem.

Posted: Tue Jul 12, 2005 7:59 am
by outlander
Thanks drzoon been looking for something like this so I didnt have to write my own. I'v added it to outlander.inc which is my bunch of utility subs I use in various macros. When I have something based upon this sub you posted I'll refresh my include that has your bit of code in it.

Posted: Wed Jul 13, 2005 7:22 am
by Fixxer
Thanks for that. I'll try adding it and see how it goes.

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:04 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:05 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:06 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:08 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:10 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:11 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:12 am
by xyilla

Re: Autolog Into IRC

Posted: Wed Jan 07, 2026 5:13 am
by xyilla