Page 1 of 1

Sell Macro

Posted: Wed May 12, 2004 2:00 am
by Hades0721
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 

Few Possibilities

Posted: Wed May 12, 2004 8:51 pm
by SeanRare
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.

Try this

Posted: Sun May 16, 2004 2:08 am
by Override
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 

Posted: Sun May 16, 2004 3:39 am
by Override
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 :)

Posted: Sun Jul 18, 2004 7:02 pm
by Epoch18
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?

Posted: Sun Jul 25, 2004 10:43 pm
by Override
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.