How to correctly add a new variable?

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

Moderator: MacroQuest Developers

anOrcPawn00
a lesser mummy
a lesser mummy
Posts: 41
Joined: Sat May 10, 2003 6:15 am

How to correctly add a new variable?

Post by anOrcPawn00 » Wed May 21, 2003 7:05 pm

For the past day I've been trying to extend $zone() to return the info from the ZONEINFO struct (such as $zone(zem), etc) and my code is completely ignored each time. I'm probably missing something very obvious or basic here but I'm on the verge of loosing my sanity over this, so please bear with me (still trying to figure how MQ works and to remember the little C++ I know) ;)

Here's the code for $zone (with my modification in bold). Doing $zone(bonus) just makes MQ print @zone(bonus), through the else branch.

Code: Select all

// $zone(xxx)

					} else if (!strncmp("zone(",szVar,5)) {



						// $zone()

						if (!strncmp("zone()",szVar,6)) {

							i+=5;

							strcat(szOutput,GetFullZone(pChar->Zone));

							j+=strlen(GetFullZone(pChar->Zone));



						// $zone(bound)

						} else if (!strncmp("zone(bound)",szVar,13)) {

							i+=12;

							strcat(szOutput,GetFullZone(pCharInfo->ZoneBoundId));

							j+=strlen(GetFullZone(pCharInfo->ZoneBoundId));



						// $zone(birth)

						} else if (!strncmp("zone(birth)",szVar,13)) {

							i+=12;

							strcat(szOutput,GetFullZone(pCharInfo->ZoneBirthId));

							j+=strlen(GetFullZone(pCharInfo->ZoneBirthId));



						[b]// $zone(bonus)
						} else if (!strncmp("zone(bonus)",szVar,13)) {

							i+=12;

							strcat(szOutput,"TestOK");

							j+=strlen("TestOK");[/b]

						// $zone(Unknown)

						} else {

							DebugSpew("PMP - Bad $zone() '%s'",szVar);

							i--;

							szOutput[j] = '@';

							j++;

						}



					// $zone

					} else if (!strncmp("zone",szVar,4)) {

						i+=3;

						strcat(szOutput,GetFullZone(pChar->Zone));

						j+=strlen(GetFullZone(pChar->Zone));

Here's the bit from the debug spew:

Code: Select all

PMP - Bad $zone() 'zone(bonus)'

Echo - [MacroQuest] @zone(bonus)

CChatHook::Detour([MacroQuest] @zone(bonus))