Bazaar Search Conversion--Dumpster Diving

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

Moderator: MacroQuest Developers

semper
orc pawn
orc pawn
Posts: 15
Joined: Thu Apr 22, 2004 9:52 pm

Bazaar Search Conversion--Dumpster Diving

Post by semper » Fri May 14, 2004 10:17 am

Code: Select all

|Semper's conversion of Driftinsupra's Dumpster diving script 
|Thanks to Driftinsupra for the original code, Lax and the devs for MQ2 
|and making me learn this without handing it to me, and Chill, mpmq, 
|ml2517, and banannaboy for their much needed help and suggestions. 


Sub Main 

/declare File outer 
/declare Counter int outer 
/declare l1 int outer 
/declare Traderid outer 
/declare Price outer 
/declare Iniprice int outer 

/varset File Bazprice.ini 
/varset Counter 1 

:mainloop 

/echo Searching for ${Ini[${File},Names,val${Counter}]} 

/bzsrch race any class any ${Ini[${File},Names,val${Counter}]} 


| is request done? 
:loop 
/delay 10    
/if (${Bazaar.Done}==FALSE) /goto :loop 

/if (${Bazaar.Count}==0) { 
   /echo ${Ini[${File},Names,val${Counter}]} not found, continuing on... 
   /varcalc Counter ${Counter}+1 
   /goto :mainloop 
   } 
} 
/echo found ${Bazaar.Count} items 

/varset l1 1 
/varset Price ${Bazaar.Item[${l1}].Price} 
/varset Traderid ${Bazaar.Item[${l1}].Trader} 
/varset Iniprice ${Ini[${File},Prices,val${Counter}]} 


/if (${Bazaar.Count}>1) { 
   /for l1 1 to ${Math.Calc[${Bazaar.Count}1]} 
   /echo ${l1} Price ${Bazaar.Item[${l1}].Price} 
   /if (${Price}>=${Iniprice}) { 
      /varset Price ${Bazaar.Item[${l1}].Price} 
      /varset Traderid ${Bazaar.Item[${l1}].Trader} 
      /docommand ${If[${Bazaar.Count}==${l1},/goto :finalcheck,/next l1]} 
   } 
   /if (${Price}<=${Iniprice}) { 
      /goto :finalcheck 
   } 
} 
          
:finalcheck 

/if (${Price}>=${Iniprice})  { 
   /varcalc Counter ${Counter}+1 
   /echo Prices too high 
   /goto :mainloop 
} 

/echo Targeting ${Spawn[${Traderid}]} 
/target ${Spawn[${Traderid}]} 
/delay 20 
/face 
} 

/endmacro 
Edited credits as requested.

semper
orc pawn
orc pawn
Posts: 15
Joined: Thu Apr 22, 2004 9:52 pm

Post by semper » Fri May 14, 2004 1:46 pm

As requested
Ini format is as follows:

Code: Select all

[Names]  /names of the items you are looking for
val1=rune of whatever
val2=sword of stuff


[Prices]  /Price to compare to the advertised prices in baz.  1 p 1g 1s 1c would be listed as 1111, 1p 0g 0s 0c would list as 1000
val1=9062
val2=50000

*Edit: Okay, as posted it draws from the macro directory. However, you can put in your own path (ie /varset File c:\mq2\ini\bazprice.ini).


Place your ini in the INI folder in your mq2 directory. If you call it something other than Bazprice.ini you will have to change the variable statements accordingly.

semper
orc pawn
orc pawn
Posts: 15
Joined: Thu Apr 22, 2004 9:52 pm

Post by semper » Wed Jun 02, 2004 11:21 am

Hmm, broken again. Bzsrch down? Macro runs but does nothing and no errors. Echoes "Searching for [1st item]" then sits there with no results in Baz window.

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Wed Jun 02, 2004 3:08 pm

What if it's 20 plat, 20 gold, 0 silver, and 20 bronze?

2020020?

Cuase that could be many different combonations of that. Just kinda wondering. (like it could be 2plat 0gold, 200silver, and 20bronze ;) )

User avatar
Capt. Morgan
decaying skeleton
decaying skeleton
Posts: 2
Joined: Tue May 04, 2004 6:10 pm
Contact:

Post by Capt. Morgan » Wed Jun 02, 2004 3:17 pm

Excellent question! I am also wondering why people look at me funny when I tell them I am 4 feet and 23 inches tall.

Thornado
orc pawn
orc pawn
Posts: 16
Joined: Wed May 12, 2004 6:59 pm

Post by Thornado » Wed Jun 02, 2004 6:17 pm

Drumstix42 wrote:What if it's 20 plat, 20 gold, 0 silver, and 20 bronze?

2020020?

Cuase that could be many different combonations of that. Just kinda wondering. (like it could be 2plat 0gold, 200silver, and 20bronze ;) )
Really you can set it to be 20 copper when setting bazaar prices in trader mode but thats the same as 2 silver so really in your example the price is 4020 Or 4 plat (200 silver is 2 plat) 0 gold, 2 silver and 0 Copper.
Last edited by Thornado on Thu Jun 03, 2004 11:00 am, edited 1 time in total.

VirusX
orc pawn
orc pawn
Posts: 14
Joined: Sun May 16, 2004 7:52 pm

old skool huh

Post by VirusX » Thu Jun 03, 2004 2:36 am

hehe bronze I thought it was copper ;p pickin on ya =)