PLUGIN: MQ2AutoPotion

Zippzipp

Lifetime Member
Joined
Dec 1, 2006
Messages
343
Reaction score
0
Points
16
Description: This plugin auto clicks potions when they wear off. It allows you to maintain 2 potions based on Potion belt. Feel free to modify it to be more robust i just kinda threw it together.

Commands:

Code:
/autopotion - toggles auto potion on and off
/seteffect # "Effect Name"  - Sets the effect to keep up and binds it to potion belt slot #

for example: To keep up Potion Ability X which is in potion belt slot 1 you would type.

/seteffect 1 "Potion Ability X"
/autopotion

Here is the source code:

Code:
#include "../MQ2Plugin.h"


PreSetup("MQ2AutoPotion");
bool on = false;
CHAR buff1[2048] = {0};
CHAR buff2[2048] = {0};
bool casting = false;

int castTimer = 0;


VOID AutoPotion(PSPAWNINFO pChar, PCHAR szLine){

	if(on == false){
		WriteChatf("AutoPotion: On");
		on = true;
	} else {
		WriteChatf("AutoPotion: Off");
		on = false;
	}
}

VOID SetPotion(PSPAWNINFO pChar, PCHAR szLine){
	CHAR szArg1[MAX_STRING] = {0};
	GetArg(szArg1, szLine, 1);

	if(!strcmpi(szArg1, "1")){
		GetArg(buff1, szLine, 2);
	}
	if(!strcmpi(szArg1,"2")){
		GetArg(buff2, szLine,2);
	}
}

// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
    DebugSpewAlways("Initializing MQ2AutoPotion");
	AddCommand("/autopotion",AutoPotion);
	AddCommand("/seteffect",SetPotion);
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
    DebugSpewAlways("Shutting down MQ2RonPotion");
	RemoveCommand("/autopotion");
	RemoveCommand("/seteffect");
}




// This is called every time MQ pulses
PLUGIN_API VOID OnPulse(VOID)
{
	bool found = false; 
	DWORD SID = 0;
	PSPELL pSpell = NULL;
	int i;

	if(castTimer < GetTickCount()){
		casting = false;
	}



	if(on == true && casting == false) {

		if(strcmp(buff1,"") != 0) {
			pSpell = GetSpellByName(buff1);
			for(i=0;i<25;i++){
				SID = GetCharInfo2()->Buff[i].SpellID;
				if(pSpell->ID == SID) {
					found = true;
				}
				SID = 0;
			}

			if(found == false){
				DoCommand(NULL,"/potionbelt activate 1");
				castTimer = GetTickCount()+30000;
				casting = true;
				return;
			}
		}
		found = false;

		pSpell = NULL;
		if(strcmp(buff2,"")!=0) {
			pSpell = GetSpellByName(buff2);
			for(i=0;i<25;i++){
				SID = GetCharInfo2()->Buff[i].SpellID;
				if(pSpell->ID == SID) {
					found = true;
				}
				SID = 0;
			}
			if(found == false){
				DoCommand(NULL,"/potionbelt activate 2");
				casting = true;
				castTimer = GetTickCount()+30000;
				return;
			}
		}
	}




}
 

Attachments

  • MQ2AutoPotion.dll
    64.1 KB · Views: 9
Last edited:
Hmm question. Can this be modified for a event? Say like HP of self under 30pct, click potionbelt2 (HoT Potion)? Many macro's have this included, would be neat if it was a plugin instead.
 
yea it could be source is posted so anyone who wants to add that stuff go for it.
 
Hmm question. Can this be modified for a event? Say like HP of self under 30pct, click potionbelt2 (HoT Potion)? Many macro's have this included, would be neat if it was a plugin instead.
MQ2Melee can already do it, if you are interested in using it.

htw
 
I seem to crash everytime I use /autopotion any one else getting that?

This plugin is what ive been lookin for. Seems I cant use it (not sure why) Just loads up ok, but when I use the /autopotion command it crashes to desktop. Does anyone know of another program like this?
 
Crashes on me as well when I try to use /autopotion
 
Hrmm sounds like a bug. Are you putting quotes around the name of the effect? in the /seteffect line?
 
I have the same issue

/seteffect 1 "Distillate of Skinspikes V" I don't get any feed back on weather or not the line was accepted.

as soon as I /autopotion I CTD

Loader Version: 1.8.4.8(2009.7.16

Plugin version/date for the problem plugin:UNK 7/28/09

Plugin version/date for MQ2Main.dll: 15.11.2.12 7/17/09
and MQ2MMOBugs.dll:1.4.1.16 07/17/09

Operating System (for example, Windows XP 32):Vista 32bit SP1

Have you restarted mmoloader?:yes

Have you reboot your PC?:yes

Do you use WinEQ2? no

Do you use InnerSpace? no

Do you use a custom UI? If so, which (provide link if possible)? Tablets Blue

Provide the contents of your UIErrors.txt in your your main EverQuest dir:

Do you have the necessary plugins loaded to accomplish what you are trying to do?: yes

What firewall software do you use?: Mcafee

What antivirus software do you use?:Mcafee

What antispyware software do you use?:Mcafee

[Plugins]
mq2mmobugs=mq2mmobugs
mq2advbeep=mq2advbeep
mq2autoaccepttrades=mq2autoaccepttrades
mq2autoforage=mq2autoforage
mq2autogroup=mq2autogroup
mq2itemdisplay=mq2itemdisplay
mq2bzsrch=mq2bzsrch
mq2cast=mq2cast
mq2chatfilter=mq2chatfilter
mq2chatwnd=mq2chatwnd
mq2custombinds=mq2custombinds
mq2docrack=mq2docrack
mq2eqbugfix=mq2eqbugfix
mq2exchange=mq2exchange
mq2famkiller=mq2famkiller
mq2fps=mq2fps
mq2gmcheck=mq2gmcheck
mq2hud=mq2hud
mq2labels=mq2labels
mq2map=mq2map
mq2mmofastmem=mq2mmofastmem
mq2mmowarp=mq2mmowarp
mq2moveutils=mq2moveutils
mq2piggyzone=mq2piggyzone
mq2reachit=mq2reachit
mq2speedutils=mq2speedutils
mq2stealth=mq2stealth
mq2switchchar=mq2switchchar
mq2targets=mq2targets
mq2tracking=mq2tracking
mq2wintitle=mq2wintitle
mq2autopotion=mq2autopotion
 
your either really bored or trying to increase your post count....
HEHE, does not matter, it is always obvious if someone does. But, there are quite a few variables on whether to let em get by with it or not, mainly about content. This one is one I would ditch, if I were doing it. ;)

Anyway, it'll be linked to the sale post, which may or may not get approved based on those "other factors". haha

htw
 
ahh I got it solved, on the /setteffect command, we should type in the potion's effect not the name of the potion. Try that and see if it works, worked for me.