Error in $pack()

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

Moderator: MacroQuest Developers

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Error in $pack()

Post by MacroFiend » Sat Sep 06, 2003 10:10 pm

I dicovered tonight (I love starting new characters) that if the slot called in $pack doesn't have a container in it, the line pointer is being double-advanced. I would imagine that this was overlooked when it was migrated to the new PMP. Looking at it, there are two extranious i += in the if statements that return NULL. Below are the changes needed.

Remove the cyan lines

Code: Select all

[color=red]
		i += (strstr(szVar,")")-szVar);

		if (szVar[5]=='e' || szVar[5]=='E') {
			strcat(szOutput,"NULL");[/color]
[color=cyan]			i += (strstr(szVar,")")-szVar);[/color][color=red]
			return i;
		}
[/color]
then a little further ...

Code: Select all

[color=red]
			DebugSpew("Pack-- Bank = %d, pItem = %x, pContainer = %x",Bank,pItem,pContainer);

			if ((!pItem) || (pItem->Item->Type != ITEMTYPE_PACK)) {
				strcat(szOutput,"NULL");[/color]
[color=cyan]				i += (strstr(szVar,")")-szVar);[/color][color=red]
			} else {
[/color]

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sun Sep 07, 2003 9:14 am

you are correct. Good catch, though I don't think that's what's causing our crash...

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sun Sep 07, 2003 9:55 am

fixed in CVS. also found and fixed the CTD if no bag in slot.

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Didn't know about the CTD ...

Post by MacroFiend » Sun Sep 07, 2003 12:26 pm

I just kept getting "no comparison" when I was trying to run macros w/ $pack() in it... wanted to get rid of the error it was spewing at me.