• 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

Request - Plugin Writing

bertoxboy

Member
I have some ideas, sort of never wrote a plugin, but I do write in some languages for shits and giggles... (robotics)

Is there any kind of "Hello World" kind of plugin that I can dissect and get my feet wet with?
 
I thought this was helpful: Creating a MacroQuest2 plugin.

Assumes that you've got MQ2 compiling already.

Wasn't too bad to write a quick plugin to scratch an itch I had. Afterwards I think I found an existing plugin that does the same thing I wanted & more. Whoops :).

EDIT: using community 2015 you'll need to 'upgrade the toolset' as per the instructions... but the plugin generator makes it with the old toolset (or whatever... I'm not big on VS usually). So I had to look up how to do that to get my plugin to compile w/o errors. Right click on the solution & do something or another... Google gave me the magic I needed when I needed it :p.
 
Ok so creating a plugin wasn't hard, but simply creating a plugin that does nothing is pointless... Where do I write my instructions? MQ2Myplugin.cpp ?

i guess im looking for something kind of like an open source file i can look at and see the syntax, etc....

when I open a macro, i can see all the routines and syntax. i can copy paste it and edit other macs using snippets from here and there. but what about plugins, here on RG everything is precompiled. from macroquest2.com it is open source but way too complicated for me to simply open and understand what's going on. I'd love to see the source for a plugin that does something as simple as a HUD providing info or something like mq2autoforage source
 
I can try to walk you through my mental process writing a simple plugin... I wanted to get a notification when a particular mob spawned (epic drop). Because I suffer from some of the typical software engineer mental deficiencies I decided the best course of action was to roll my own before I bothered looking at what wheels were already invented & waiting for me to use them :p.

So I dug around the mq2 website/wiki to find the links I provided above.
Got MQ2 to compile in vs2015.
Generated a stub plugin; got it to compile in vs2015.

Decided I was basically in a legacy code situation. Meaning I'm going to need to figure out a lot of tedious BS without anyone to really ask questions to with a reasonable turn around time. I mean, technically, eqmule is on here and there are other people here who have written plugins. On the other hand I can't just hit them up & ask them if they want to get beers and let me pick their brain :p.

Looked through the stub methods available to me within my plugin. OnAddSpawn looked like the most promising method name & comments. I don't trust comments. Comments are dirty filthy liars (not a commentary on mq2... just professional paranoia that has saved my ass on a number of occasions). So I looked up all references within my project to OnAddSpawn (shift-F12 or some crap? I usually use eclipse not visual studio).

I found where MQ2 calls OnAddSpawn. Great run of the mill observer pattern (more or less... dll loading instead of registerObserver method etc). Also noted no apparent concurrency. Mental note to not do anything slow within my event handler. Secondary mental note to worry later, when/if it's relevant, if mq2 is thread-safe and how badly I could screw things up forking off threads on events instead of handling them inline.

So anyway, that told me that OnAddSpawn did indeed look like a promising place to put my garbage. I slapped a few lines of code into there, compiled, loaded the plugin, & it worked. Hurray.

I didn't look at all at HUD drawing until you posted this. I think you want to look at "OnDrawHUD" & maybe look at the MQ2HUD source code that came with mq2.

EDIT here & below:
Forgot to throw in the "i don't know wtf I'm talking about" caveat. I've played with MQ2 sources for like 3-ish hours tops.

So I guess the TL;DR take away I have so far is that MQ2 is essentially an event-driven observer/observable architecture where plugins are the observers. That means that anything you do in a plugin needs to happen when one of these events occurs.

I suppose the exception to that would be that you could probably do some stuff like fork a thread to run when the plugin is initialized & then set a variable during unload that will terminate that thread cleanly etc. Like if you need to do things at random times unrelated to what MQ2 is doing. Caveats about the thread safety of mq2 (which I have no idea). Guessing the MQ2IRC thing must do something along these lines.
 
Sweet, that's allot of useful information. I really want to create a plugin to manage boxing, be it a group of 6 or an army of 72. I just hope I have the time to put everything together. And the know how... I hope I can ask people questions here.
 
Request - Plugin Writing

Users who are viewing this thread

Back
Top
Cart