Quest Loot inc

magicdragon

New member
Joined
Sep 26, 2007
Messages
137
Reaction score
0
Points
0
Just before the patch I decided I needed an .inc file to work with Pete's bot.mac that would let me tell one of my toons to come loot an item for a quest. With MQ2 down I've had lots of time to look here and MQ2's forums, but I've not found any mac's or inc's that work to loot a specific linked item on command.
While I can't load MQ2 to be able to mess with eqbc to figure to make it work, I thought I would put this out here and see if anyone has done something simular and knows how to make this work. What I've worked out so far will tell the toon I want it to loot something, but will run into problems trying to move to the sender and find the corpse to loot.
Code:
#event Quest_Loot "[MQ2] #1# loot #2#"

Sub Event_Quest_Loot(string cname, string text, string lootit)
/declare lootitem string outer
/declare lootcount int outer

	/varset lootitem ${lootit.Right[-56]}
	/varset lootitem ${lootitem.Left[-1]}
	/if (${String[${cname}].Equal[${Me.CleanName}]} && ${String[${text}].Equal[loot]}) {
		/target ${Sender}
		/moveto ID
		/delay 20s ${Spawn[${Sender}].Distance}<15
		/target ${NearestSpawn[1, corpse radius 100]}
		/moveto ID
		/delay 2s
		/loot
		/delay 10s ${Corpse.Open}
		/delay 2s
		/varset lootcount ${Corpse.Items}
			/for x 1 to ${lootcount}
			/if (${String[${Corpse.Item[${x}]}].Equal[${lootitem}]}) {
			/shift /itemnotify loot${x} leftmouseup
			/delay 10s ${Window[ConfirmationDialogBox].Open}
			/notify ConfirmationDialogBox Yes_Button leftmouseup
			/delay 10s ${Cursor.ID}
			/delay 1s
				:storeit
				/autoinv
				/delay 2s
				/if (${Cursor.ID}) /goto :storeit
			}
			/next x
	}
	/keypress esc
/return
/endm
So when I type "/bc mytoon loot link" the event should pickup "Character name" "loot" and "link" my problem is it doesn't pickup the Sender.

Code:
#event EQBC "<#1#> #2#" 
#event EQBC "[#1#(msg)] #2#"
Sub Event_EQBC(EQBCSay,EQBCSender,EQBCCommand)
This would pickup the sender, but how would I pick out the link without messing up the code for bot.mac.
 
It shouldnt interfere. However, I can add it to bot mac once you are done since it is a good idea. I may make some modifications because now that you mention this, I would like it to parse any linked loot and check against a set list. It would make it so nodrop stuff wouldnt go to waste.
 
Last edited:
It shouldnt interfere. However, I can add it to bot mac once you are done since it is a good idea. I may make some modifications because now that you mention this, I would like it to parse any linked loot and check against a set list. It would make it so nodrop stuff wouldnt go to waste.

I would love this. I've been tinkering with a .inc file myself to add to your mac for my own personal uses, and this is one of the routines I was trying to perfect.

One question for you Pete (and anyone else). Can I add #events in an .inc file or do they have to be added to the .mac file?
 
You can add entire routines and events into any inc file. Just use the [Custom] section to /call them.

[Custom]
CustomRestTotal=1
CustomRest1=/call QuestLoot

That was the purpose behind the custom section. So you can add any command you want without interfering with the macro. Your only mod to the mac would be to add #include questloot.inc or whatever. But if anyone ever has something that works across multiple classes/uses then I can add it into the mac itself. I try to limit the bloat but im not above using a good, versatile idea.

The events will auto detect once you do the #include, so there is nothing you have to /call for those since it will autocheck them.
 
Last edited:
I've done some testing, but not much so I'm not 100% sure I've got everything right yet, but this is looking good so far. to the top of bot.mac add #include QuestLoot.inc and to the Sub Event_Chat add the following to bot.mac
Code:
/declare lootlength int local
/varcalc lootlength ${String[${Me.CleanName}].Length}+2
/if (${String[${ChatText.Left[${String[${Me.CleanName}].Length}]}].Equal[${Me.CleanName}]} && ${String[${ChatText.Mid[${lootlength},4]}].Equal[loot]}) /call Quest_Loot "${Sender}" "${ChatText}"

This is my QuestLoot.inc
Code:
Sub Quest_Loot(Sender, ChatText)
/declare lootitem string local
/declare lootcount int local
/declare xcorpse int local
/declare findlink int local
/declare itemfound bool local FALSE

/varcalc findlink ${String[${Me.CleanName}].Length}+62
/varset lootitem ${ChatText.Right[-${findlink}]}
/varset lootitem ${lootitem.Left[-1]}

/target ${Sender}
/moveto ID
/delay 20s ${Spawn[${Sender}].Distance}<15

:targetcorpse
/target ${NearestSpawn[1, corpse radius 100]}
/moveto ID
/delay 2s
/loot
/delay 10s ${Corpse.Open}
/delay 2s
/varset lootcount ${Corpse.Items}
/for xcorpse 1 to ${lootcount}
/if (${String[${Corpse.Item[${xcorpse}]}].Equal[${lootitem}]}) {
	/varset itemfound TRUE
	/if (${Corpse.Item[${xcorpse}].NoDrop}) {
		/shift /itemnotify loot${xcorpse} leftmouseup
		/delay 10s ${Window[ConfirmationDialogBox].Open}
		/notify ConfirmationDialogBox Yes_Button leftmouseup
		/delay 10s ${Cursor.ID}
		/delay 1s
	} ELSE {
		/shift /itemnotify loot${xcorpse} leftmouseup
		/delay 10s ${Cursor.ID}
		/delay 1s
	}
		:storeit
		/autoinv
		/delay 2s
		/if (${Cursor.ID}) /goto :storeit
}
/next xcorpse
/keypress esc
/if (!${itemfound}) /goto :targetcorpse

/return
 
Last edited:
I added what you were looking to do to bot.mac. So you could just try that. But yes, you would #include questloot.inc. but NO, you would not /declare each time you did an event chat or you would get an already declared error message.

I usually handle an include with a load section.
Code:
Sub QuestLootLoad
/declare QuestLootLoaded int outer 1
/declare lootlength int outer
/blahblah
/return

Sub QuestLoot
/if (!${QuestLootLoaded}) /call QuestLootLoad
/blah
/return
Now since you are only checking 1 declare, you could just do:
/if (!${Defined[lootlength}) /declare lootlength int outer


All that said, it seems like you are going about it in a weird way. As long as it works, that is all that matters I suppose.

Also, does "inner" work? Since this isnt c++, ive only seen local, outer, and global as options.