• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Macro to Plugin Conversion

FunWithUs

New member
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
Cart