NEW FEATURE: $char(hotbutton,xx)

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

NEW FEATURE: $char(hotbutton,xx)

Post by EqMule » Thu Jul 31, 2003 9:06 am

ok here it is... I needed this for some AA hotbuttons...
syntax example:

Code: Select all

/echo $char(hotbutton,3)
will return TRUE if there is a hotbutton in slot 3 which can be activated. it will return FALSE if its not "refreshed" or if there is no hotbutton in that slot.

in EQLib_MacroParser.cpp

Code: Select all

						// $char(hotbutton,x) example: /echo $char(hotbutton,1)
						} else if (!strncmp("char(hotbutton,",szVar,15)) {
							if (!strstr(szVar,")")) {
								DebugSpew("PMP - Bad $char() '%s'",szVar);
								i--;
								szOutput[j] = '@';
								j++;
							} else {
								CHAR szTemp[MAX_STRING] = {0};
								if (EQADDR_CLASSHOTBUTTONWND) {
									PEQHOTBUTTONWINDOW pHotButtonWindow = NULL;
									PEQHOTBUTTONWINDOW pHotButton = NULL;
									pHotButtonWindow = (PEQHOTBUTTONWINDOW)*EQADDR_CLASSHOTBUTTONWND;
									i += (strstr(szVar,")")-szVar);
											
									PCHAR szArg = szVar+15;
									DWORD HB = atoi(szArg);
									if (HB>0 && HB<11) {
										HB--;
										if (pHotButtonWindow->HotButtons[HB]){
											pHotButton = NULL;
											pHotButton = (PEQHOTBUTTONWINDOW)pHotButtonWindow->HotButtons[HB];
											DebugSpew("hotbutton check for HB %x and arg passed was %s",HB,szArg);
											if (pHotButton->HBRefreshed != 0) {
												strcpy(szTemp,"FALSE");
											} else {
												strcpy(szTemp,"TRUE");
											}
										} else {
											strcpy(szTemp,"NULL");
										}
									}
								}else {
									strcpy(szTemp,"offset error");
								}
							strcat(szOutput,szTemp);
							j += strlen(szTemp);
							}[color=red]
						// $char(buff,xxx)[/color] 
in EQLib.h

Code: Select all

DWORD *EQADDR_CLASSHOTBUTTONWND;
in EQLib_Main.cpp

Code: Select all

extern DWORD *EQADDR_CLASSHOTBUTTONWND;

Code: Select all

	GetPrivateProfileString("Class Locations","ClassHotButtonWnd","0",szBuffer,MAX_STRING,ClientINI);		EQADDR_CLASSHOTBUTTONWND = (PDWORD)strtoul(szBuffer,NULL,16);
and finally a new struct is needed in MQ.h

Code: Select all

typedef struct _EQHOTBUTTONWINDOW {
			DWORD   WindowID; 
			DWORD   TimeMouseOver;         //how many ms the window has had the mouse over it... 
			DWORD   Unknown0x008;      // 2000 seems a common value 
			DWORD   Unknown0x00c;      //500 seems a common value 
			BYTE    Flag; 
			BYTE    MouseOver;         //01 yes 00 no 
			BYTE    Unknown0x012; 
			BYTE    Unknown0x013; 
			BYTE    Unknown0x014[12]; 
			struct  _EQWINDOW *pDownTheTreeOnSameWindow; 
			struct  _EQWINDOW *pNextWindow; 
			DWORD   Flags4; 
			DWORD   Z;               //not sure but its logical to assume it at this point... 
			DWORD   X; 
			DWORD   Y; 
			DWORD   Height; 
			DWORD   Width; 
            DWORD   Depth;            //hmmm... 
            BYTE    Unknown0x040[12]; 
            BYTE    Open;            //1 open 0 closed 
            BYTE    Unknown0x051[7]; 
            DWORD   somekindofID; 
            DWORD   *pUnknownStruct0x060; 
            struct  _EQWINDOWINFO *Info; 
			BYTE	Unknown[88];
			BYTE	Unknown1[68];
			DWORD	SlotID;
			DWORD	Unknown2;
			DWORD	HBRefreshed;
			DWORD	Unknown3[2];
			BYTE	Selector;		//this graphically selects an item on/off
			BYTE	Unknown4[7];
			BYTE	Unknown5[40];
			DWORD	HotButtonWndView;//0 to 9 for the different views
struct _EQHOTBUTTONWINDOW	*HotButtons[10];//theese will change when you switch page...
} EQHOTBUTTONWINDOW, *PEQHOTBUTTONWINDOW;
and as usual in eqgame.ini we need the offset to the class

Code: Select all

[Class Locations]
ClassHotButtonWnd=005fe230
play nice.
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Sun Aug 03, 2003 6:48 am

EqMule on a coding spree? :)
Very nice feature. I assume this works with AA buttons too?
Now I'll go read the AA request thingie and probably see that this is in fact what it does :)

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sun Aug 03, 2003 8:15 am

Question on this...

I would like to use a hotkey with /alt activate #. The reason I don't use a socials button with /alt activate # is because I can never see when the AA Ability is ready to be used.

Will this only work if you put the actual AA hotbutton in a hotkey slot, or will it work if I also put a socials key with /alt activate # in the hotkeys slot.

I was thinking the function would let you know when an AA ability has refreshed.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Sun Aug 03, 2003 8:58 am

Wassup wrote:Will this only work if you put the actual AA hotbutton in a hotkey slot, or will it work if I also put a socials key with /alt activate # in the hotkeys slot.
try it... I dont know, but I do know this, if you have created a AA hotbutton and you place that in hotbutton window slot 1 you can check if its ready to use with this function...

off course it will work with other buttons as well, forage for example, but we allready have another function for that dont we...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Tue Aug 05, 2003 8:50 pm

can I get this tested and cvsed? 8)
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Fri Aug 08, 2003 9:30 am

I was looking through some stuff from that map file that was accidently released a bit ago and found this:

Code: Select all

public: bool __thiscall AltAdvManager::IsAbilityReady(class EQ_PC *,int const &,int *)		0046552d	?IsAbilityReady@AltAdvManager@@QAE_NPAVEQ_PC@@ABHPAH@Z	f		EQ_AltAdvManager.obj	0001:0006452d
Would this be of any use to you at all?

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Fri Aug 08, 2003 3:26 pm

looks easy to call Ill take a look at it. thanks
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.