Sell Macro

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

User avatar
Hades0721
a lesser mummy
a lesser mummy
Posts: 31
Joined: Sun Apr 11, 2004 4:57 pm
Contact:

Sell Macro

Post by Hades0721 » Wed May 12, 2004 2:00 am

I'm tired of having to individually select each stack to sell it but I'm having trouble getting this macro to work. Macro jumps straight to :done. Not sure why.

Code: Select all

| - SellItem.mac - 
| 
| Usage: /macro SellItem "Bottle of Milk" 
| 11/21/03 

| #event Selling "for the Electrum Malachite Bracelet."


Sub Main  

   /declare OldMoney int local   
   /declare NewMoney int local    

   /call Sell
/return

Sub Sell
   /autoinv 

   :Finding 
      /if (${FindItemCount[${Param0}]}==0) /goto :Done 
      /itemnotify ${FindItem[${Param0}].InvSlot} leftmouseup 

   :WaitFind 
      /if (${Bool[${SelectedItem}]}==FALSE) /goto :WaitFind 

   :Selling 
      /delay 1s 
      /vardata OldMoney ${Me.Cash} 
      /shift /notify MerchantWnd MW_Sell_Button leftmouseup 

   :WaitSell 
      /vardata NewMoney $(Me.Cash} 
      /if (${NewMoney}==${OldMoney}) /goto :WaitSell 
      /goto :Finding 

   :Done 
   	/echo No more to sell!!!      
	/endmacro
/return 
"I'm Goin' to Hell. Who's comin' with me?" - Eminem

SeanRare
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Apr 19, 2004 3:52 pm
Location: Salt Lake City, UT

Few Possibilities

Post by SeanRare » Wed May 12, 2004 8:51 pm

Can't run MQ atm, so I'm just going to make some guesses.

1. You have OldMoney and NewMoney declared as locals inside of Sub Main. I don't think they will be available in Sub Sell.

2. Right under ":Finding", you refer to Param0. Yet in Sub Main you /call Sell with no parameters.

Maybe it's one of those things? *shrug* Not sure what default behavior is when stuff is missing/out of scope.

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Try this

Post by Override » Sun May 16, 2004 2:08 am

Here you go. Try this.

Code: Select all

Sub Main  

   /declare OldMoney int Outer    
   /declare NewMoney int Outer
   /declare ItemToSell string Outer
   /varset ItemToSell ${Param0}    

   /call Sell 
/return 

Sub Sell 
   /autoinv 

   :Finding 
      /if (${FindItemCount[${ItemToSell}]}==0) /goto :Done 
      /itemnotify ${FindItem[${ItemToSell}].InvSlot} leftmouseup 

   :WaitFind 
      /if (${Bool[${SelectedItem}]}==FALSE) /goto :WaitFind 

   :Selling 
      /delay 1s 
      /varset OldMoney ${Me.Cash} 
      /shift /notify MerchantWnd MW_Sell_Button leftmouseup 

   :WaitSell 
      /varset NewMoney $(Me.Cash} 
      /if (${NewMoney}==${OldMoney}) /goto :WaitSell 
      /goto :Finding 

   :Done 
      /echo No more to sell!!!      
   /endmacro 
/return 
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Sun May 16, 2004 3:39 am

I just realized something, be sure to add the = to the code. Change it to this:

Code: Select all

   :Finding 
      /if (${FindItemCount[=${ItemToSell}]}==0) /goto :Done 
      /itemnotify ${FindItem[=${ItemToSell}].InvSlot} leftmouseup 
From this:

Code: Select all

 :Finding 
      /if (${FindItemCount[${ItemToSell}]}==0) /goto :Done 
      /itemnotify ${FindItem[${ItemToSell}].InvSlot} leftmouseup 
If not then if you enter /macro sell water, it may be selling your Staff of Flowing Water since the word water is in it :)
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

Epoch18
orc pawn
orc pawn
Posts: 16
Joined: Mon Sep 15, 2003 1:39 pm

Post by Epoch18 » Sun Jul 18, 2004 7:02 pm

Just tried this one too (pretty identical to other I just tried as well) and same problem. It just clicks once on the item I specify, nothing more.

HELP! Please :)

EDIT:
I also just noticed this. In the code it's written:

Code: Select all

Sub Main  
   :WaitFind 
      /if (${Bool[${SelectedItem}]}==FALSE) /goto :WaitFind 
Shouldn't it be:

Code: Select all

   :WaitFind 
      /if (${Bool[${ItemToSell}]}==FALSE) /goto :WaitFind 
And if that is the case, I've already tried the macro with that change, however it gives me a looping error:
Invalid notifications 'leftmousedown'
Is this no longer a supported command?

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Sun Jul 25, 2004 10:43 pm

There seems to be a problem with SelectedItem right now, im not sure what is going on, my buy or sell macros are not working due to it.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]