• 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

MQ2MovementRecorder

zippzipp

Member
This plugin records your movements and allows you to play them back.

Commands are as follows:

/record on <recordname>
/record off
/record delete <recordname>

/playback on <recordname>
/playback off

MQ2MovementRecorder.cpp
Rich (BB code):
///////////////////////////////////////////////////////
//  MQ2MovementRecorder.cpp  by Zippzipp             //
//  created:  20 December 2006                       //
///////////////////////////////////////////////////////


#include "../MQ2Plugin.h"
PreSetup("MQ2MovementRecorder");

int playbackflag = 0;
int recordflag = 0;
int rcount = 0;
CHAR rcountpbVal[MAX_STRING];

CHAR recordname[MAX_STRING];

VOID zRecord(PSPAWNINFO pChar, PCHAR szLine){

	CHAR command[MAX_STRING] = {0};
	CHAR rnBuffer[MAX_STRING] = {0};
	CHAR szMsg[MAX_STRING] = {0};

	GetArg(command,szLine,1);
	if(!strnicmp(command,"off",3)) {
		recordflag = 0;
		sprintf(szMsg,"%d",rcount);
		WritePrivateProfileString(recordname,"rcount",szMsg,INIFileName);
				
		rcount = 0;
		WriteChatColor("Movement Recording Complete",CONCOLOR_YELLOW);
	}else{
		if(!strnicmp(command,"on",3)){
           GetArg(recordname,szLine,2);
		   if(!strnicmp(recordname,"",1))
			   WriteChatColor("You did not specify a record name",CONCOLOR_YELLOW);
		   else{
			    GetPrivateProfileString(recordname,"r0","",rnBuffer,MAX_STRING,INIFileName);
				if(!strnicmp(rnBuffer,"",1)){
					recordflag = 1;
			        WriteChatColor("Recording On",CONCOLOR_YELLOW);
				    WritePrivateProfileString(recordname,"rcount","",INIFileName);
				}else{
					sprintf(szMsg,"Record Name: \'%s\' already exists. Delete it if you wish to overwirte it.",recordname);
					WriteChatColor(szMsg,CONCOLOR_YELLOW);
				}
		   }
		}else{
			if(!strnicmp(command,"delete",6)){
				GetArg(recordname, szLine, 2); 
		        if(!strnicmp(recordname, "", 1)) 
					WriteChatColor("You did not specify a record name",CONCOLOR_YELLOW);
				else{
					GetPrivateProfileString(recordname,"r0","",rnBuffer,MAX_STRING,INIFileName);
					if(!strnicmp(rnBuffer,"", 1)){
						sprintf(szMsg,"Record Name:\'%s\' does not exist.", recordname); 
				        WriteChatColor(szMsg,CONCOLOR_YELLOW);
					}else{
						WritePrivateProfileSection(recordname,"",INIFileName);
					    sprintf(szMsg,"Record Name: \'%s\' Successfully deleted.", recordname); 
				        WriteChatColor(szMsg,CONCOLOR_YELLOW);
					}
				}
		
			}
		}
	}
}

VOID zPlayBack(PSPAWNINFO pChar, PCHAR szLine){
	CHAR command[MAX_STRING] = {0};
	CHAR rnBuffer[MAX_STRING] = {0};
	CHAR szMsg[MAX_STRING] = {0};

	GetArg(command,szLine,1);
	if(!strnicmp(command,"off",3)) {
		recordflag = 0;
		rcount = 0;
		WriteChatColor("Playback Complete",CONCOLOR_YELLOW);
	}else{
		if(!strnicmp(command,"on",3)){
           GetArg(recordname,szLine,2);
		   if(!strnicmp(recordname,"",1))
			   WriteChatColor("You did not specify a record name",CONCOLOR_YELLOW);
		   else{
			    GetPrivateProfileString(recordname,"r0","",rnBuffer,MAX_STRING,INIFileName);
				if(!strnicmp(rnBuffer,"",1)){
					sprintf(szMsg,"Record Name: \'%s\' does not exists.",recordname);
					WriteChatColor(szMsg,CONCOLOR_YELLOW);
				}else{
					playbackflag = 1;
					GetPrivateProfileString(recordname,"rcount","",rcountpbVal,MAX_STRING,INIFileName);
			        WriteChatColor("PlayBack On",CONCOLOR_YELLOW);
				}
		   }
		}
		
	}
}


// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID){
	DebugSpewAlways("Initializing MQ2MovementRecorder");
    AddCommand("/record",zRecord);
	AddCommand("/playback",zPlayBack);
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID){
	DebugSpewAlways("Shutting down MQ2MovementRecorder");
    RemoveCommand("/record");
	RemoveCommand("/playback");
}

// This is called every time MQ pulses
PLUGIN_API VOID OnPulse(VOID){

	CHAR szData[MAX_STRING];
    CHAR szName[MAX_STRING];
	CHAR szLoc[MAX_STRING];

	if(recordflag == 1){
		PSPAWNINFO pCharPulse = GetCharInfo()->pSpawn;
	    
		sprintf(szName,"r%d",rcount);
		sprintf(szData, "%1.2f %1.2f %1.2f %1.2f", pCharPulse->Y, pCharPulse->X, pCharPulse->Z, (float)pCharPulse->Heading);//*0.703125f); 
		WritePrivateProfileString(recordname,szName,szData,INIFileName); 
		rcount++;
	}

	if(playbackflag == 1){
		CHAR x[MAX_STRING];
		CHAR y[MAX_STRING];
		CHAR z[MAX_STRING];
		CHAR head[MAX_STRING];

		sprintf(szName,"r%d",rcount);
		GetPrivateProfileString(recordname,szName,"",szLoc,MAX_STRING,INIFileName);
		GetArg(x, szLoc, 2); 
		GetArg(y, szLoc, 1); 
		GetArg(z, szLoc, 3); 
		GetArg(head, szLoc, 4);
		
		GetCharInfo()->pSpawn->Y = (float)atof(y);
	    GetCharInfo()->pSpawn->X = (float)atof(x);
		GetCharInfo()->pSpawn->Z = (float)atof(z);
		GetCharInfo()->pSpawn->Heading = (float)atof(head);

	    DoCommand(GetCharInfo()->pSpawn,"/keypress forward hold");
		rcount++;
		if(rcount == (int)atoi(rcountpbVal)) {
			playbackflag = 0;
		    rcount = 0;
			WriteChatColor("Playback Complete",CONCOLOR_YELLOW);
			DoCommand(GetCharInfo()->pSpawn,"/keypress back");
		}

	}
	
}

Enjoy!!!

--Zippzipp
 
*wishlist 1* the ability to tell it to continue running forward to zone, or to use a door etc at the end of the path :)

*wishlist 2* the ability to list several paths to run one right after the other (excellent combo with item 1).

But great utility either way :)
 
MQ2MovementRecorder

Users who are viewing this thread

Back
Top
Cart