item pickup and move script-not working right

Moderator: MacroQuest Developers

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

item pickup and move script-not working right

Post by aChallenged1 » Tue Jul 04, 2006 9:40 am

Once again, I'm looking for help. I'm posting the code for the working version of the script, which is longer than required, and the non-working version, in which I tried to shorten the working one.
All items existed at the time of the test. When I run the listed script I get the following errors.
ErrorMessages wrote:Unparsable in Calculation: 'S'
Could not calculate Summoned: Black Bread
Summoned: Black Bread is in slot 0
0 should be zero
opening Dimensional Pocket in Inventory packslot 8
my count is 1
I have NULL
closing bag with food
Summoned: Black Bread before
Summoned: Glob of Water after
Unparsable in Calculation: 'S'
Could not calculate Summoned: Globe of Water
Summoned: Globe of Water is in slot 0
0 should be zero
opening Dimensional Pocket in Inventory packslot 8
my count is 2
i have NULL
closing bag with food
Summoned: Globe of Water before
Summoned: Glob of Water after
done moving food and drink
Non-working version

Code: Select all

function main()
{
	declare SearchItem string
	declare PickItUp int
	declare ThisBag int

	variable int Count=1
	do
	{
		if ${Count}==1
		{
			PickItUp:Set[${FindItem[=Summoned: Black Bread]}]
            SearchItem:Set[Summoned: Black Bread]
		}
		else
		{
			PickItUp:Set[${FindItem[=Summoned: Globe of Water]}]
            SearchItem:Set[Summoned: Globe of Water]
		}
		echo ${SearchItem} is in slot ${PickItUp}
		if ${PickItUp}>29
		{
			if ${PickItUp}>321
			{
				ThisBag:Set[29]
				echo ${ThisBag} set  bag 8 food
			}
			elseif ${PickItUp}>311
			{
				ThisBag:Set[28]
				echo ${ThisBag} set  bag 7 food
			}
			elseif ${PickItUp}>301
			{
				ThisBag:Set[27]
				echo ${ThisBag} set  bag 6 food
			}
			elseif ${PickItUp}>291
			{
				ThisBag:Set[26]
				echo ${ThisBag} set  bag 5 food
			}
			elseif ${PickItUp}>281
			{
				ThisBag:Set[25]
				echo ${ThisBag} set bag 4 food
			}
			elseif ${PickItUp}>271
			{
				ThisBag:Set[24]
				echo ${ThisBag} set bag 3 food
			}
			elseif ${PickItUp}>261
			{
				ThisBag:Set[23]
				echo ${ThisBag} set bag 2 food
			}
			elseif ${PickItUp}>250
			{
				ThisBag:Set[22]
				echo ${ThisBag} set bag 1 food
			}
			echo ${ThisBag} holds it
			waitframe
			echo opening bag#${Math.Calc[${ThisBag}-21].Int} with ${SearchItem} in it
			NoModKey EQItemNotify ${ThisBag} RightMouseUp
			wait 5 ${Window[pack${ThisBag}].Open}
			NoModKey shift EQItemNotify ${PickItUp} LeftMouseUp
			wait 5
			echo closing bag with food
			NoModKey EQItemNotify ${ThisBag} RightMouseUp
		}
		else
		{
			echo ${ThisBag} should be zero
			shift EQItemNotify ${PickItUp} LeftMouseUp
		}
		echo opening Dimensional Pocket in Inventory packslot 8
		NoModKey EQItemNotify 29 RightMouseUp
		wait 5 ${Window[pack8].Open}
		if ${Count}==1
		{
			echo my count is ${Count}
			echo I have ${Cursor.Name}
			NoModKey shift EQItemNotify 321 LeftMouseUp
		}
		else
		{
			echo my count is ${Count}
			echo i have ${Cursor.Name}
			NoModKey shift EQItemNotify 322 LeftMouseUp
		}
		wait 5
		echo closing bag with food
		NoModKey EQItemNotify 29 RightMouseUp
		echo ${SearchItem} before
		SearchItem:Set[Summoned: Glob of Water]
		echo ${SearchItem} after
	}
	while ${Count:Inc}<=2
	endscript bagtest
}

function atexit()
{
	echo done moving food and drink
}
Working, but long version

Code: Select all

function main()
{
	variable int PickItUp
	variable int ThisBag
	echo ${FindItem[=Summoned: Black Bread].InvSlot}
	PickItUp:Set[${FindItem[=Summoned: Black Bread].InvSlot}]
	echo ${PickItUp} Black Bread

	if ${PickItUp}>29
	{
		if ${PickItUp}>321
		{
			ThisBag:Set[29]
			echo ${ThisBag} set  bag 8 food
		}
		elseif ${PickItUp}>311
		{
			ThisBag:Set[28]
			echo ${ThisBag} set  bag 7 food
		}
		elseif ${PickItUp}>301
		{
			ThisBag:Set[27]
			echo ${ThisBag} set  bag 6 food
		}
		elseif ${PickItUp}>291
		{
			ThisBag:Set[26]
			echo ${ThisBag} set  bag 5 food
		}
		elseif ${PickItUp}>281
		{
			ThisBag:Set[25]
			echo ${ThisBag} set bag 4 food
		}
		elseif ${PickItUp}>271
		{
			ThisBag:Set[24]
			echo ${ThisBag} set bag 3 food
		}
		elseif ${PickItUp}>261
		{
			ThisBag:Set[23]
			echo ${ThisBag} set bag 2 food
		}
		elseif ${PickItUp}>250
		{
			ThisBag:Set[22]
			echo ${ThisBag} set bag 1 food
		}
		echo ${ThisBag} holds it
        waitframe
        echo opening bag with food
		NoModKey EQItemNotify ${ThisBag} RightMouseUp
		wait 5 ${Window[pack${ThisBag}].Open}
		NoModKey shift EQItemNotify ${PickItUp} LeftMouseUp
        wait 5
        echo closing bag with food
		NoModKey EQItemNotify ${ThisBag} RightMouseUp
	}
	else
	{
		echo ${ThisBag} should be zero
		shift EQItemNotify ${PickItUp} LeftMouseUp
	}

	wait 5
    echo opening dimensional pocket in slot 8
	NoModKey EQItemNotify 29 RightMouseUp
	wait 5
	NoModKey EQItemNotify 321 LeftMouseUp
	wait 5
    echo closing dimensional pocket in slot 8
	NoModKey EQItemNotify 29 RightMouseUp

	echo ${FindItem[=Summoned: Globe of Water].InvSlot}
	PickItUp:Set[${FindItem[=Summoned: Globe of Water].InvSlot}]
	echo ${PickItUp} globe of water

	if ${PickItUp}>29
	{
		if ${PickItUp}>321
		{
			ThisBag:Set[29]
			echo ${ThisBag} set bag 8 drink
		}
		elseif ${PickItUp}>311
		{
			ThisBag:Set[28]
			echo ${ThisBag} set bag 7 drink
		}
		elseif ${PickItUp}>301
		{
			ThisBag:Set[27]
			echo ${ThisBag} set bag 6 drink
		}
		elseif ${PickItUp}>291
		{
			ThisBag:Set[26]
			echo ${ThisBag} set bag 5 drink
		}
		elseif ${PickItUp}>281
		{
			ThisBag:Set[25]
			echo ${ThisBag} set bag 4 drink
		}
		elseif ${PickItUp}>271
		{
			ThisBag:Set[24]
			echo ${ThisBag} set bag 3 drink
		}
		elseif ${PickItUp}>261
		{
			ThisBag:Set[23]
			echo ${ThisBag} set bag 2 drink
		}
		elseif ${PickItUp}>250
		{
			ThisBag:Set[22]
			echo ${ThisBag} set bag 1 drink
		}
		echo ${ThisBag} holds it
        waitframe
        echo opening bag
		NoModKey EQItemNotify ${ThisBag} RightMouseUp
		wait 5 ${Window[pack${ThisBag}].Open}
		NoModKey shift EQItemNotify ${PickItUp} LeftMouseUp
        wait 5
		NoModKey EQItemNotify ${ThisBag} RightMouseUp
	}
	else
	{
		echo ${ThisBag} should be zero
		shift EQItemNotify ${PickItUp} LeftMouseUp
	}

	wait 5
	NoModKey EQItemNotify 29 RightMouseUp
	wait 5
	NoModKey EQItemNotify 322 LeftMouseUp
	wait 5
	NoModKey EQItemNotify 29 RightMouseUp
}

function atexit()
{
;SearchItem:Set[]
ThisBag:Set[]
PickItUp:Set[]
}
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

kellewic
a lesser mummy
a lesser mummy
Posts: 38
Joined: Tue Jun 08, 2004 2:27 am
Location: AZ

Post by kellewic » Tue Jul 04, 2006 3:41 pm

This

Code: Select all

PickItUp:Set[${FindItem[=Summoned: Black Bread]}]
is setting a string into an int which will give you 0. FindItem returns an object of type 'item', which when echo'd gives the item name.

you probably want:

Code: Select all

PickItUp:Set[${FindItem[=Summoned: Black Bread].InvSlot}]
which gives you the slot the item was found in.


I posted code that does what you are looking for, albeit in object form, but you might be able to get some hints from it. Look for 'packs.inc' in this thread (second post):

http://macroquest2.com/phpBB2/viewtopic.php?t=13404

There is a PickUp and PutDown method in the ItemSlot object.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Tue Jul 04, 2006 5:54 pm

Thanks, I knew I was missing something, but I couldn't figure it out.

LOL, and I should have noticed it. Tired eyes and mind can do that.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:34 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:35 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:37 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:38 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:39 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:40 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:41 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 11:42 am


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 12:19 pm


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 12:21 pm


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 12:58 pm


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

Re: item pickup and move script-not working right

Post by xyilla » Fri Jul 18, 2025 12:59 pm