updatebazaarprices.mac

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

havsum
decaying skeleton
decaying skeleton
Posts: 6
Joined: Tue Dec 07, 2004 9:56 pm

Post by havsum » Tue Jan 31, 2006 4:16 pm

I don't know it was working for a while and I did not see it making that much of a difference in the bazaar. I mean now a days if you want to unload items you undercut people anyways. This macro did that automatically for you. I don't want it to run in the backround, just one pass through my items as I start my trader and than the macro closes would be fine with me.

At least thats how it worked for me last time I used it. It would scan the bazzar at the time I started the macro set all the prices 1pp lower than the lowest in the bazaar and than close.

M.D.
orc pawn
orc pawn
Posts: 19
Joined: Fri Nov 25, 2005 12:56 am

Post by M.D. » Thu Feb 02, 2006 6:15 pm

Sorry A_Druid_00 but I think I've found a work around to get this running again. Personally, I think it would be hilarious if this macro was used by enough people that it wrecks in-game economy.

Anyway, I am not claiming that the code below is perfect by any means. My use of .Mid to walk the price is probably considered cheating by some, but hey, it works. I didn't write to original calculations, but if you have questions/suggestions, feel free to post them.

Code: Select all

|update.mac
|Auto-Update Bazaar Prices 
|
|Original by Sparr 
| 
|Updated by M.D. - 2/2/06
|
|Updates the prices of your trader items to compete with other prices found via /bazaar 
|Must have a price set for the items you wish to update otherwise they will be skipped

Sub Main 
 /declare slot int local 
 /declare dupecheck int local 
 /declare itemname string local 
 /declare result int local 
 /declare stddev int local 
 /declare itemsfound int local 
 /declare pricetotal int local 
 /declare avgprice int local 
 /declare minprice int local 
 /declare avgdev int local 
 /declare devhigh int local 
 /declare quartprice int local 
 /declare maxprice int local 
 /declare price int local 
 /declare fairprice int local 
 /declare targetprice int local 
 /declare newtargetprice int local 
 /declare PlatVal int local
 /declare targetstr string local 
  
 /echo Starting Auto-update...

 :OpenTraderAgain 
 /trader 
 /delay 1s ${Window[BazaarWnd].Open} 
 /if (!${Window[BazaarWnd].Open}) /goto :OpenTraderAgain 

 :OpenBazaarAgain 
 /bazaar 
 /delay 2s ${Window[BazaarSearchWnd].Open} 
 /if (!${Window[BazaarSearchWnd].Open}) /goto :OpenBazaarAgain 
  
 /notify BazaarSearchWnd BZR_UpdatePlayerButton leftmouseup 
 /delay 2s 

 /varset slot -1 
 :nextslot 
 /varcalc slot ${slot}+1 
 /if (${slot}>79) /goto :donewithslots  
 /notify BZW_BazaarSlotsWnd BZR_BazaarSlot${slot} leftmouseup 
 /if (!${Window[BazaarWnd].Child[BZW_SetPrice_Button].Enabled}) /goto :nextslot 
 /if (!${Window[BazaarWnd].Child[BZW_Clear_Button].Enabled}) /goto :nextslot 
 /varset itemname ${Window[BZW_BazaarSlotsWnd].Child[BZR_BazaarSlot${slot}].Tooltip} 

 :SearchBazaarAgain 
 /bzsrch race any class any stat any slot any type any price 0 9999999 ${itemname} 
 /delay 5s ${Bazaar.Done} 
 /if (!${Bazaar.Done}) /goto :SearchBazaarAgain 
 /if (!${Bazaar.Count}) /goto :nextslot

 /varset itemsfound 0 
 /varset pricetotal 0 
 /varset minprice 9999999 
 /varset maxprice 0 
 /for result 1 to ${Bazaar.Count} 
 /if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) { 
   /varcalc itemsfound ${itemsfound}+${Bazaar.Item[${result}].Quantity} 
   /varcalc pricetotal ${pricetotal}+${Bazaar.Item[${result}].Price}*${Bazaar.Item[${result}].Quantity} 
   /if (${Bazaar.Item[${result}].Price}<${minprice}) /varset minprice ${Bazaar.Item[${result}].Price} 
   /if (${Bazaar.Item[${result}].Price}>${maxprice}) /varset maxprice ${Bazaar.Item[${result}].Price} 
 } 
 /next result 
 /if (!${itemsfound}) /goto :nextslot 
 /varset avgprice ${Math.Calc[${pricetotal}/${itemsfound}/1000].Int} 
 /varset minprice ${Math.Calc[${minprice}/1000].Int} 
 /varset maxprice ${Math.Calc[${maxprice}/1000].Int}
 /varset stddev 0 
 /varset avgdev 0 
 /for result 1 to ${Bazaar.Count} 
 /if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) { 
   /varcalc stddev ${stddev}+((${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}-${avgprice})^2)*${Bazaar.Item[${result}].Quantity} 
   /varcalc avgdev ${avgdev}+${Math.Abs[${Bazaar.Item[${result}].Price}-${avgprice}*1000]}*${Bazaar.Item[${result}].Quantity} 
 } 
 /next result 
 /varset stddev ${Math.Calc[(${stddev}/${itemsfound})^.5]} 
 /varset avgdev ${Math.Calc[${avgdev}/${itemsfound}/1000].Int}

 /varcalc quartprice (${avgprice}+${minprice})/2 
 /varset fairprice 9999999 
 /for result 1 to ${Bazaar.Count} 
 /if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) { 
   /if (${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}>=${quartprice}&&${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}<${fairprice}) /varset fairprice ${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int} 
 } 
 /next result 
  
 /if (${itemsfound}<15) { 
   /varset targetprice ${Math.Calc[${avgprice}-${stddev}]} 
   /varset targetprice ${If[${targetprice}<${minprice},${minprice},${targetprice}]} 
 } else { 
   /varset targetprice ${fairprice} 
 } 
 /varcalc targetprice ${targetprice}-1 
  
 /if (${targetprice}<${Math.Calc[${SelectedItem.Value}/1050]}) { 
   /echo Underpriced Goods! ${itemname} for ${minprice}pp value:${Math.Calc[${SelectedItem.Value}/1050]} etc:(${avgprice},${targetprice},${stddev},${itemsfound}) 
   /varset targetprice ${Math.Calc[${SelectedItem.Value}/1000].Int} 
 } 

 /varset newtargetprice 9999999 
 /for result 1 to ${Bazaar.Count} 
 /if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) { 
   /if (${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}>${targetprice}&&${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}<${newtargetprice}) /varset newtargetprice ${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int} 
 } 
 /next result 
 /if (${newtargetprice}>1000) { 
   /varcalc targetprice ${newtargetprice}-50 
 } else { 
   /varcalc targetprice ${newtargetprice}-5 
 } 
 /if (${targetprice}<=0) /varset targetprice 1

 /varset targetstr ${targetprice}

 /if (${targetprice}<${Window[BazaarWnd].Child[BZW_Money0].Text}) { 
   /echo Repricing ${itemname} from ${Window[BazaarWnd].Child[BZW_Money0].Text} to ${targetprice} 
   :openqtywndagain 
   /notify BazaarWnd BZW_Money0 leftmouseup 
   /delay 2s 
   /if (!${Window[QuantityWnd].Open}) /goto :openqtywndagain 
   /delay 1
   /keypress backspace chat 
   /keypress backspace chat
   /keypress backspace chat
   /keypress backspace chat
   /keypress backspace chat
   /keypress backspace chat
   /keypress backspace chat
   /keypress backspace chat  
   /delay 1
   /for PlatVal 1 to 7 
   /squelch /keypress ${targetstr.Mid[${PlatVal},1]} chat 
   /next PlatVal   
   /notify QuantityWnd QTYW_Accept_Button leftmouseup 
   /delay 1 
   /notify BazaarWnd BZW_SetPrice_Button leftmouseup 
   /delay 1   
 }  
 /goto :nextslot
 :donewithslots
 /end
/return

hawk810
orc pawn
orc pawn
Posts: 11
Joined: Sat Nov 05, 2005 6:30 pm

Post by hawk810 » Fri Mar 03, 2006 10:23 pm

Anyone else having trouble with this?.. works one day, and doesent the next.. very strange. I think its having a problem with the /notify on the BazaarSlots

it worked for me once on the latest distro (03/01/06) for about 2 hours.. didnt make any changes and now it doesent work..

Typing this manually does not work either

Code: Select all

/notify BZW_BazaarSlotsWnd BZR_BazaarSlot1 leftmouseup 
and i am unable to echo

Code: Select all

${Window[BZW_BazaarSlotsWnd].Child[BZR_BazaarSlot1].Tooltip} 
(with slot1 highlighted etc..)

BazaarWnd shows up in /windows, and looking in the xml, BZW_BazaarSlotsWnd and BZR_BazaarSlot1 havent changed. I am unsure how the windows work exactly, since BZW_BazaarSlotsWnd is being called and is a sub of BazaarWnd, but not listed in /windows directly...

While running the debug it appears to be getting hung up on

Code: Select all

/if (!${Window[BazaarWnd].Child[BZW_SetPrice_Button].Enabled}) /goto :nextslot 
any enlightenment would be most appreciated.

iceman01
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jan 15, 2006 6:25 am

Post by iceman01 » Wed Mar 08, 2006 5:00 pm

Does not work for me either, crashes when I try to use this, blah!

georgesilver
orc pawn
orc pawn
Posts: 16
Joined: Tue May 25, 2004 9:10 am

Post by georgesilver » Thu Mar 09, 2006 8:59 am

Dosent Crash but Dosent do anything either. Runs then stops about 2 seconds later.


Gs

NFC
a hill giant
a hill giant
Posts: 151
Joined: Mon Dec 19, 2005 2:16 pm

Post by NFC » Sat Mar 18, 2006 8:02 am

Been having the same trouble with this. Thought it may have been my custom Bazaar window so tried it with default, still no go.

The one time I did get it to actually do anything it appeared to be searching items (lots of info flashing in the bazaar window) but no prices changed. Looking closely at the items it was "updating" it was calling up Spell: Nullify Magic, which was nowhere in any of the bags I have.

Gnits
a snow griffon
a snow griffon
Posts: 371
Joined: Fri Jun 03, 2005 7:56 pm

Post by Gnits » Wed Mar 29, 2006 7:08 pm

Ok, i have it working.

IF you look at your UI files you will see the name of the window make sure that the references to BZR_BazaarSlotsWnd matches what your window then it works.

Word to the wise, dont run this while you are in trader mode or it will compete against you as well. I havent looked into the logic to figure that out, though its in there.

oz
orc pawn
orc pawn
Posts: 28
Joined: Thu Jul 21, 2005 1:56 am

Fixed

Post by oz » Wed Mar 29, 2006 8:44 pm

Ok i've fixed it as long as your using the default UI for your bazaar windows it should work

|update.mac
|Auto-Update Bazaar Prices
|
|Original by Sparr
|
|Updated by M.D. - 2/2/06
|
|Updates the prices of your trader items to compete with other prices found via /bazaar
|Must have a price set for the items you wish to update otherwise they will be skipped

Sub Main
/declare slot int local
/declare dupecheck int local
/declare itemname string local
/declare result int local
/declare stddev int local
/declare itemsfound int local
/declare pricetotal int local
/declare avgprice int local
/declare minprice int local
/declare avgdev int local
/declare devhigh int local
/declare quartprice int local
/declare maxprice int local
/declare price int local
/declare fairprice int local
/declare targetprice int local
/declare newtargetprice int local
/declare PlatVal int local
/declare targetstr string local

/echo Starting Auto-update...

:OpenTraderAgain
/echo Opening Trade Window
/trader
/delay 1s ${Window[BazaarWnd].Open}
/if (!${Window[BazaarWnd].Open}) /goto :OpenTraderAgain

:OpenBazaarAgain
/bazaar
/echo Opening Bazaar Window
/delay 2s ${Window[BazaarSearchWnd].Open}
/if (!${Window[BazaarSearchWnd].Open}) /goto :OpenBazaarAgain

/notify BazaarSearchWnd BZR_UpdatePlayerButton leftmouseup
/echo Updating Current Traders...
/delay 2s

/varset slot -1
:nextslot
/echo Selecting Slot ${slot}
/varcalc slot ${slot}+1
/if (${slot}>79) /goto :donewithslots
/notify BazaarWnd BZR_BazaarSlot${slot} leftmouseup
/if (!${Window[BazaarWnd].Child[BZW_SetPrice_Button].Enabled}) /goto :nextslot
/if (!${Window[BazaarWnd].Child[BZW_Clear_Button].Enabled}) /goto :nextslot
/varset itemname ${Window[BazaarWnd].Child[BZR_BazaarSlot${slot}].Tooltip}
/delay 1s
/echo Found ${itemname} in Slot ${slot}
}

:SearchBazaarAgain
/bzsrch race any class any stat any slot any type any price 0 9999999 ${itemname}
/delay 5s ${Bazaar.Done}
/if (!${Bazaar.Done}) /goto :SearchBazaarAgain
/if (!${Bazaar.Count}) /goto :nextslot

/varset itemsfound 0
/varset pricetotal 0
/varset minprice 9999999
/varset maxprice 0
/for result 1 to ${Bazaar.Count}
/if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) {
/varcalc itemsfound ${itemsfound}+${Bazaar.Item[${result}].Quantity}
/varcalc pricetotal ${pricetotal}+${Bazaar.Item[${result}].Price}*${Bazaar.Item[${result}].Quantity}
/if (${Bazaar.Item[${result}].Price}<${minprice}) /varset minprice ${Bazaar.Item[${result}].Price}
/if (${Bazaar.Item[${result}].Price}>${maxprice}) /varset maxprice ${Bazaar.Item[${result}].Price}
}
/next result
/if (!${itemsfound}) /goto :nextslot
/varset avgprice ${Math.Calc[${pricetotal}/${itemsfound}/1000].Int}
/varset minprice ${Math.Calc[${minprice}/1000].Int}
/varset maxprice ${Math.Calc[${maxprice}/1000].Int}
/varset stddev 0
/varset avgdev 0
/for result 1 to ${Bazaar.Count}
/if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) {
/varcalc stddev ${stddev}+((${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}-${avgprice})^2)*${Bazaar.Item[${result}].Quantity}
/varcalc avgdev ${avgdev}+${Math.Abs[${Bazaar.Item[${result}].Price}-${avgprice}*1000]}*${Bazaar.Item[${result}].Quantity}
}
/next result
/varset stddev ${Math.Calc[(${stddev}/${itemsfound})^.5]}
/varset avgdev ${Math.Calc[${avgdev}/${itemsfound}/1000].Int}

/varcalc quartprice (${avgprice}+${minprice})/2
/varset fairprice 9999999
/for result 1 to ${Bazaar.Count}
/if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) {
/if (${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}>=${quartprice}&&${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}<${fairprice}) /varset fairprice ${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}
}
/next result

/if (${itemsfound}<15) {
/varset targetprice ${Math.Calc[${avgprice}-${stddev}]}
/varset targetprice ${If[${targetprice}<${minprice},${minprice},${targetprice}]}
} else {
/varset targetprice ${fairprice}
}
/varcalc targetprice ${targetprice}-1

/if (${targetprice}<${Math.Calc[${SelectedItem.Value}/1050]}) {
/echo Underpriced Goods! ${itemname} for ${minprice}pp value:${Math.Calc[${SelectedItem.Value}/1050]} etc:(${avgprice},${targetprice},${stddev},${itemsfound})
/varset targetprice ${Math.Calc[${SelectedItem.Value}/1000].Int}
}

/varset newtargetprice 9999999
/for result 1 to ${Bazaar.Count}
/if (${Bazaar.Item[${result}].Name.Equal[${itemname}]}&&!${Me.Name.Equal[${Bazaar.Item[${result}].Trader.Name}]}) {
/if (${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}>${targetprice}&&${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}<${newtargetprice}) /varset newtargetprice ${Math.Calc[${Bazaar.Item[${result}].Price}/1000].Int}
}
/next result
/if (${newtargetprice}>1000) {
/varcalc targetprice ${newtargetprice}-50
} else {
/varcalc targetprice ${newtargetprice}-5
}
/if (${targetprice}<=0) /varset targetprice 1

/varset targetstr ${targetprice}

/if (${targetprice}<${Window[BazaarWnd].Child[BZW_Money0].Text}) {
/echo Repricing ${itemname} from ${Window[BazaarWnd].Child[BZW_Money0].Text} to ${targetprice}
:openqtywndagain
/notify BazaarWnd BZW_Money0 leftmouseup
/delay 2s
/if (!${Window[QuantityWnd].Open}) /goto :openqtywndagain
/delay 1
/keypress backspace chat
/keypress backspace chat
/keypress backspace chat
/keypress backspace chat
/keypress backspace chat
/keypress backspace chat
/keypress backspace chat
/keypress backspace chat
/delay 1
/for PlatVal 1 to 7
/squelch /keypress ${targetstr.Mid[${PlatVal},1]} chat
/next PlatVal
/notify QuantityWnd QTYW_Accept_Button leftmouseup
/delay 1
/notify BazaarWnd BZW_SetPrice_Button leftmouseup
/delay 1
}
/goto :nextslot
:donewithslots
/end
/return
Me Version 1.2

iceman01
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jan 15, 2006 6:25 am

Post by iceman01 » Thu May 18, 2006 1:13 pm

Tried this, goest to slot one, does nothing. Any ideas?

newgamez88
orc pawn
orc pawn
Posts: 27
Joined: Thu Mar 09, 2006 12:01 pm

Post by newgamez88 » Fri May 19, 2006 2:51 am

I just do it manually. Create a hotkey with a single line

/bzsrch race any class any stat any slot any type any price 0 9999999 ${SelectedItem.Name}

Then I open both /baz and /trader windows, click on one of my items and hit the hotkey. I'll sort the list in the /baz window by price and compare with mine. Then I can manually set my price.

It's not that I don't trust the macro, just don't trust other people in bazaar :)

iceman01
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jan 15, 2006 6:25 am

Post by iceman01 » Wed May 31, 2006 8:49 pm

Does anyone have a clue how to get this to move from the first slot? Cannot get this to work. Thx in advance.