• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Macro to Plugin Conversion (1 Viewer)

FunWithUs

New member
Joined
Aug 21, 2005
RedCents
Is it possible to convert a macro to a plugin? Would a macro have to be completely rewritten or would it only require some minor changes?

Thanks for giving me a place to ask questions!
 
I found this snippet:
Rich (BB code):
/declare INI string outer "AutoIRC_${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

The AutoIRC_${Me.Name}.ini would look something like this:
Rich (BB code):
[General_Options] 
UseIRC=1 
[IRC_Settings] 
IRCServer=local.irc.server 
IRCPort=6667 
IRCChannel=#botchan

I was wondering if it would be possible to convert it to a plugin, or combine it with the existing mq2irc. My goal is to have it log into IRC as soon as your character logs in, and join a specified channel.

Subroutines are structured different in a plugin than a macro right? So basically I could use this as a guide "psudo code", and then try to find the proper structure for it? Or could I cut and paste it with a couple of headers and footers?

I guess a better question would be, is this the sort of thing that a beginner should be attempting? I want to make something I would find useful and have it be something I am capable of making.

If it can be done, it will be my first plugin. :p If not, I am going to have to keep looking around for another project to learn on.
 
This is my first attempt at making any kind of plugin or macro, and in this case I attempted to convert a macro snippet into a plugin.

I am about 99.9999% sure that the code below (if it can be called that) will not work as is, and there are a lot of changes that will need to be done before I could compile it. Before you laugh, this code is a rough draft, which I plan to use to piece together something workable.

A lot of what is below was cut and pasted from the macro snippet. Other parts were cut and pasted from other plugins. I have done what I can to try and adjust the syntax.

My question is, where would I go from this point to start trying to make corrections? Start with structure or syntax? The goal is to have the macro log into the IRC server as soon as the character enters the world, using information from an .ini file.

Any suggestions would be greatly appreciated on what I should do next to learn and get this to work at the same time!

Rich (BB code):
#include "../MQ2Plugin.h" 

PreSetup("MQ2AutoIRC"); 

/declare INI string outer "AutoIRC_${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]} 

VOID JoinIRC(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   if (${IRCChannel.Left[1].NotEqual[#]}) { 
      /echo Channel name needs to start with a # }
   else { 
// Not Connected 
   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 

}}

// Called once, when the plugin is to initialize 
PLUGIN_API VOID InitializePlugin(VOID) 
{ 
   DebugSpewAlways("Initializing MQ2AutoIrc"); 
}

// Called once, when the plugin is to shutdown 
PLUGIN_API VOID ShutdownPlugin(VOID) 
{ 
   DebugSpewAlways("Shutting down MQ2AutoIrc"); 
}
 
Macro to Plugin Conversion

Users who are viewing this thread

Back
Top