Plugin: MQ2AutoGroup

Rusty

Lifetimer
Joined
Aug 29, 2005
Messages
199
Reaction score
2
Points
18
Like it says this will autogroup, or auto accept raid invites from the names you have in your ini. Big thanks to Psycotic for the coding help. And to the other coders who's code i borrowed to try and put this thing together. Hopefully someone finds this plugin semi usefull.

ini
Code:
[Settings] 
AutoGroup=on 
[Names] 
Name0=bob 
Name1=fred 
Name2=harry

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

PreSetup("MQ2AutoGroup");

//Setup stuff
int MAXLIST = 20;

bool AutoGroupOn = true;
//bool AutoGroupGuild = true;
int CurrentMaxNames = 0;
int TotalNames = 0;
char Name[100][64];
#define COLOR_NAME "\ay" 
#define COLOR_NAME_TEST "\ag" 
#define COLOR_NAME_BRACKET "\ar" 
#define COLOR_OFF "\ax" 


//Show help
VOID ShowHelp(VOID)
{
    WriteChatf("\ar+++ AutoGroup - Usage +++\ax");
    WriteChatf("Status Autogroup is Currently: %s", AutoGroupOn?"\agOn":"\arOff");
    WriteChatColor("/AutoGroup < \ayCharName\ax > This will add a Character name to the AutoGroup.ini that you will auto accept invites from.");
//    WriteChatColor("/AutoGroup < Guild > Guildies on/off");
    WriteChatColor("/AutoGroup < \agOn\ax >  Auto group on!");
    WriteChatColor("/AutoGroup < \arOff\ax >  Auto group off!");
    
    return;
}

//Write ini if there is none
VOID WriteINI(VOID)
{
	WritePrivateProfileString("Settings","AutoGroup","on",INIFileName);
      ShowHelp();
//	WritePrivateProfileString("Settings","AutoGroupGuild","off",INIFileName);
//	WritePrivateProfileString("Names","Name1","Nada",INIFileName);
}

//Load ini when player enters game
VOID LoadINI(VOID)
{
char szTemp[MAX_STRING];
TotalNames = 0;
	if(GetPrivateProfileString("Settings","AutoGroup","",szTemp,MAX_STRING,INIFileName))
	{
		if (!strcmp(szTemp,"on"))
			AutoGroupOn = true;
		else
			AutoGroupOn = false;
	}
	else
		WriteINI();
//	if(GetPrivateProfileString("Settings","AutoGroupGuild","",szTemp,MAX_STRING,INIFileName))
//	{
//		if (!strcmp(szTemp,"on"))
//			AutoGroupGuild = true;
//		else
//			AutoGroupGuild = false;
//	}
	for (int i = 0; i<(MAXLIST+1); i++) 
	{
		sprintf(szTemp,"Name%i",i);
		if(!GetPrivateProfileString("Names",szTemp,"",Name[i],64,INIFileName))
			return;
		else
			TotalNames++;
	}
}

VOID DoAutoGroupOn(PSPAWNINFO pChar, PCHAR szLine)
{
char szTemp[MAX_STRING];
	if (gGameState == GAMESTATE_INGAME) 
	{
		if (szLine[0]==0)
		{
//			WriteChatf("AutoGroup is now: %s", AutoGroupOn?"\agOn":"\arOff");
//			WriteChatf("AutoGroupGuild is now: %s", AutoGroupGuild?"\agOn":"\arOff");
			ShowHelp();
			return;
		}
		if (!strcmpi(szLine,"on"))  
			AutoGroupOn = true;
		else if (!strcmpi(szLine,"off"))
			AutoGroupOn = false;
//		else if (!strcmpi(szLine,"guild"))
//			AutoGroupGuild=!AutoGroupGuild;
		else 
		{
			WriteChatf("Adding \ay< %s >\ax to list of people you'll auto-join",szLine);
			sprintf(szTemp,"Name%i",TotalNames);
			WritePrivateProfileString("Names",szTemp,szLine,INIFileName);
                  TotalNames++;
                  LoadINI();
			return;
		}
		WriteChatf("AutoGroup is now: %s", AutoGroupOn?"\agOn":"\arOff");
//		WriteChatf("AutoGroupGuild is now: %s", AutoGroupGuild?"\agOn":"\arOff");
LoadINI();
	}
}

BOOL CheckNames(PCHAR szName)
{
//	bool CheckGuild = false;
//	PCHARINFO pChar=GetCharInfo();
//	PSPAWNINFO pSpawn = (PSPAWNINFO)pSpawnList;
//	while (pSpawn)
//	{
//		if ((pChar->GuildID == pSpawn->GuildID) && (!strcmpi(szName,pSpawn->Name)) && (AutoGroupGuild))
//			return true;
//			pSpawn = pSpawn->Next;
//	}

	for (int i = 0; i<(TotalNames+1); i++) 
	{
		if (!strcmpi(szName,Name[i]))
                  return true;
	}
	return false;
}

PLUGIN_API DWORD OnIncomingChat(PCHAR Line, DWORD Color)
{
CHAR szName[MAX_STRING];
CHAR szMsg[MAX_STRING]; 
	if (strstr(Line,"invites you to join a group.")) {
		GetArg(szName,Line,1);
		if (CheckNames(szName)) {
			DoCommand(GetCharInfo()->pSpawn,"/timed 3s /keypress invite_follow"); 
                        sprintf(szMsg,"Accepted group invite from \ay< %s >\ax",szName);  
                            WriteChatColor(szMsg); 
                           }   
                        }      
	if (strstr(Line,"invites you to join a raid")) {
		GetArg(szName,Line,1);
		if (CheckNames(szName)) {
	           DoCommand(GetCharInfo()->pSpawn,"/timed 3s /raidaccept");   
                        sprintf(szMsg,"Accepted raid invite from \ay< %s >\ax",szName);
                            WriteChatColor(szMsg);    
     }
	}
	return 0;
}


// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2AutoGroup");
	LoadINI();
	AddCommand("/autogroup", DoAutoGroupOn);
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
   DebugSpewAlways("Shutting down MQ2AutoGroup");
   RemoveCommand("/autogroup");
}
 
Last edited by a moderator:
I'd add a little documentation at the top of the code about who wrote it, and how to use it.

Other than that it looks great.

Fry.
 
Has anyone tested this with most recent compile?

I still cant get it to work at all.
 
I beleive the reason any autoinvite macro/plugin won't work now is because SOE now has some of the information relating to a group invite/accept serverside now.
 
Anon456 said:
I beleive the reason any autoinvite macro/plugin won't work now is because SOE now has some of the information relating to a group invite/accept serverside now.
That shouldn't matter (unless I know nothing about plugins...)...
When you get invited into a group it goes /keypress invite_follow.
When you get invited into a raid it goes /raidaccept.
I know the second one is just the normal EQ command, so it should work fine. The first one I have no clue... but instincts tell me it should work... so I think the problem is somewhere else in the coding.
 
Would it be possible for someone to add a setting so that you accept the invite after a random delay? Would be nice maybe if you could set it at like say 20 seconds or have it accept randomly after 10-20 seconds.

Always instantly accepting a group with 0 delay is a bit suspicious if you are lazy and stick all your common group partners and raid leaders on there.
 
autogroup guild?

I see where is says "bool AutoGroupOn = true;
//bool AutoGroupGuild = true;"

what is the command to turn on autogroup from guildies?
 
That isn't active in the plugin from what I have seen. I have played around with adding it back in, but haven't had much time to play with it. How much interest is there in getting this functionality added?
 
I'm definitely interested since I primarily group with guildmembers. I removed the comments pertaining to the guild check loop and the misc boolean variables but it yields an error pertaining to line 115. I'm not certain but just from scanning it for the five or ten minutes I did it appears it to be trying to move on to the next item in the pSpawn array yet it says Next is not a valid member of _SPAWNINFO in EQData, which I found to be true. I'm only beginning to grasp C so I'm not certain of what action to take in this particular instance. More than likely you've noticed it as well and have more insight into the issue than I do; but I thought I'd give a heads up anyway.
 
will it save this list in a file which gets overwritten with every new compile like the waypoints one does?
 
The info is in MQ2AutoGroup.ini, which CAN be overwritten with each new compile.

However, it's probably better to not copy the INI files from the download. The INI files, unless they've been modified, don't need to be rewritten each time a new compile comes out.
 
Eh, I just say, "overwrite all." I will keep a copy in my other directory.
 
After a lot of cursing, I've learned to keep a copy of different ini files that normally get overridden by the compiles posted here. At the top of that list is the autogroup, the chatwin, and my targets inis. I just copy them back after unzipping the pre-compiles.
 
What I do is first rename the old MQ2 directory to something like MQ2.olddate, then extract the new version into C:\MQ2.

I then run the follwing batch file (Called Update.bat) from the renamed old directory to copy the settings I want to keep into the new MQ2 directory, and all of the macros I have. The batch file first copies all of the distro macros into another folder in case I need to compare them.

Here is my Update.bat:

Code:
@Echo Off
Copy *MacroQuest.ini C:\MQ2\
Copy MacroQuest.ini C:\MQ2\
Copy drinal*.ini C:\MQ2\
Copy MQ2AutoForage.ini C:\MQ2\
Copy MQ2AutoGroup.ini C:\MQ2\
Copy MQ2BuffQueue_*ini C:\MQ2\
Copy MQ2BuffTool_*.ini C:\MQ2\
Copy MQ2Cast.ini C:\MQ2\
Copy MQ2CastTimer.ini C:\MQ2\
Copy MQ2Charnotes.ini C:\MQ2\
Copy MQ2Dps.ini C:\MQ2\
Copy MQ2Eqbc.ini C:\MQ2\
Copy MQ2FeedMe.ini C:\MQ2\
Copy MQ2Forage_*.ini C:\MQ2\
Copy MQ2GMCheck.ini C:\MQ2\
Copy MQ2HUD.ini C:\MQ2\
Copy MQ2Map.ini C:\MQ2\
Copy MQ2MoveUtils.ini C:\MQ2\
Copy MQ2Randomstuff.ini C:\MQ2\
Copy MQ2Slayer.ini	C:\MQ2\
Copy mq2slaymonk.ini C:\MQ2\
Copy MQ2SpellTimer.ini C:\MQ2\
Copy MQ2Targets.ini C:\MQ2\
Copy MQ2Timer.ini C:\MQ2\
Copy MQ2Twist*.ini C:\MQ2\
Copy SpawnMaster.ini C:\MQ2\
XCopy Configs C:\MQ2\Configs\ /Y /S /E
MD C:\MQ2\Macros\Orig\
Copy C:\MQ2\Macros\*.* 		/Y	C:\MQ2\Macros\Orig\
CD Macros
Copy *.* 					/Y	C:\MQ2\Macros\ 
XCopy Common C:\MQ2\Macros\Common\ /Y /S /E
XCopy MQ2InvIni C:\MQ2\Macros\MQ2InvIni\ /Y /S /E
XCopy Stuff C:\MQ2\Macros\Stuff\ /Y /S /E
CD ..
Copy Update.Bat /Y	C:\MQ2\

Obviously , if you install MQ2 into another directory, change all of the references as needed.
 
Ok, Nightmare is officially a god. :D:D

One more off-topic INI related question: Is there a way in Macroquest.ini to look for INI files in a separate folder? Similarly to how it looks for macros in \Macros\ and logs in \Logs\?

Would be even easier if I just copied Macroquest.ini and my INI folder over.
 
Very nice, I hope I can find that when I want it!

On second thought, that's too complex for me. :-(
 
will this also auto accept task invites from your list of people ? and is there a way to set it so it will auto accept from anyone in your guild without having to go through and put all the names in ?
 
I wrote MQ2TaskAddAccept which will ... accept tasks.

The problem with the guild portion is that if the person in not in your zone, it's much much harder to grab their guild info (hard, but not impossible). I just think that no one's ever just bullied their way through it to code it.
 
Last edited:
ok i see the taskadd plugin in the compile and turned it on, I hate missing free task adds if i am afk
 
Alright, I went ahead and did a major rewrite of this. Names are dynamic, i.e., no max, no wasted mem.

Your old INI will be compatible.

If guild option is on, will auto accept raid or group invite from any guild member, whether they are in zone with you or not. ;-)

Code:
[SIZE=3][COLOR=#ffffff][SIZE=3][COLOR=#ffffff][/COLOR][/SIZE][/COLOR][/SIZE][COLOR=#00ff00][COLOR=#00ff00]Usage: /autogroup [help | on | off | guild | load | save | add | del | clear | list][/COLOR][/COLOR]
[COLOR=#00ff00][/COLOR][COLOR=#ffffff][COLOR=#ffffff] 
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]Automatically accepts group/raid invite from specified chars, or guild.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]Names are NOT case sensitive.[/COLOR][/COLOR]
[COLOR=#00ff00][/COLOR][COLOR=#ffffff][COLOR=#ffffff] 
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]Using /autogroup with no options will show current status.[/COLOR][/COLOR]
[COLOR=#00ff00][/COLOR][COLOR=#ffffff][COLOR=#ffffff] 
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]on = Turns automatic group/raid invite accept from specified chars on.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]off = Turns automatic group/raid invite accept from specified chars off.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]guild = Toggles automatic group/raid invite accept from your guild members.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]load = Loads options and names from .ini file[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00](any current unsaved names will be lost!).[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]save = Updates .ini to match current options and names.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]add = Add a new char name (ex: /autogroup add bubbawar).[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]del = Delete a char name (ex: /autogroup del 15 deletes name #15).[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]clear = Clears all char names.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR][COLOR=#00ff00][COLOR=#00ff00]list = Lists current char names.[/COLOR][/COLOR][COLOR=#ffffff][COLOR=#ffffff]
[/COLOR][/COLOR]

htw
 

Attachments

  • MQ2AutoGroup.dll
    186.5 KB · Views: 8