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

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

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

Post by MacroFiend » Sun Nov 23, 2003 3:33 am

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]

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 5:36 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 5:37 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 5:38 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 5:39 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:16 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:17 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:18 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:20 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:21 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:22 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 6:23 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 7:00 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 7:01 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

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

Post by xyilla » Mon Oct 27, 2025 7:03 pm