Page 1 of 4

NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Sun Nov 23, 2003 3:33 am
by MacroFiend
These are already there as $freeinv(space) and $freeinv(size) but to me, it doesn't seem overly logical in their placement. $char(space) and $char(space,free) will return the number of free spaces. $char(space,size) will return the size capacity of the first container with open space. They are both there to provide completeness.

EQLib_MacroParser.cpp

Code: Select all


	// $char(space)
	// $char(space,free)
    } else if (!strncmp("char(space",szVar,10)) {
        if (!strstr(szVar,")")) {
            return PMP_ERROR_BADPARM;
        } else {
 			PCONTENTS pItem = NULL;
			i += (strstr(szVar,")")-szVar);
			PCHAR szArg = szVar+10;
			if (!strncmp(",free)",szArg,6) || !strncmp(")",szArg,1)) {
				DWORD count=0;
				DWORD slot,pslot;
				CHAR szTemp[MAX_STRING] = {0};
				for (slot=22;slot<30;slot++) {
					if (pItem = pCharInfo->Inventory[slot]) {
						if (pItem->Item->Type == ITEMTYPE_PACK) {
							for (pslot=0;pslot<pItem->Item->Container.Slots;pslot++) {
								if (!pItem->Contents[pslot]) count++;
							}
						}
					} else {
						count++;
					}
				}
				itoa(count,szTemp,10);
				strcat(szOutput,szTemp);
			// $char(space,size)
			} else if (!strncmp(",size)",szArg,6)) {
				DWORD size=0;
				DWORD slot,pslot;
				BOOL hasfree = FALSE;
				CHAR szTemp[MAX_STRING] = {0};
				for (slot=22;slot<30;slot++) {
					if (pItem = pCharInfo->Inventory[slot]) {
						if (pItem->Item->Type == ITEMTYPE_PACK) {
							hasfree=FALSE;
							for (pslot=0;pslot<pItem->Item->Container.Slots;pslot++) {
								if (!pItem->Contents[pslot]) hasfree=TRUE;
						}
							if (hasfree && (pItem->Item->Container.SizeCapacity>size)) size=pItem->Item->Container.SizeCapacity;
						}
					} else {
						size=4;
					}
				}
				itoa(size,szTemp,10);
				strcat(szOutput,szTemp);
			}
		}[color=red]

	// $char(unknown)[/color]

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 5:36 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 5:37 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 5:38 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 5:39 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:16 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:17 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:18 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:20 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:21 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:22 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 6:23 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 7:00 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 7:01 pm
by xyilla

Re: NEW FEAT: $char(space), $char(space,free), $char(space,size)

Posted: Mon Oct 27, 2025 7:03 pm
by xyilla