Autolog Into IRC

Have a macro idea but not sure where to start? Ask here.

Moderator: MacroQuest Developers

Fixxer
a ghoul
a ghoul
Posts: 146
Joined: Wed Apr 13, 2005 8:15 am

Autolog Into IRC

Post by Fixxer » Tue Jul 12, 2005 5:55 am

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.

drzoon
a hill giant
a hill giant
Posts: 239
Joined: Tue May 04, 2004 5:38 pm

Post by drzoon » Tue Jul 12, 2005 7:23 am

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.

outlander
a hill giant
a hill giant
Posts: 232
Joined: Mon Feb 14, 2005 11:40 am

Post by outlander » Tue Jul 12, 2005 7:59 am

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.

Fixxer
a ghoul
a ghoul
Posts: 146
Joined: Wed Apr 13, 2005 8:15 am

Post by Fixxer » Wed Jul 13, 2005 7:22 am

Thanks for that. I'll try adding it and see how it goes.