Page 1 of 1

Bazaar Search Conversion--Dumpster Diving

Posted: Fri May 14, 2004 10:17 am
by semper

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.

Posted: Fri May 14, 2004 1:46 pm
by semper
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.

Posted: Wed Jun 02, 2004 11:21 am
by semper
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.

Posted: Wed Jun 02, 2004 3:08 pm
by Drumstix42
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 ;) )

Posted: Wed Jun 02, 2004 3:17 pm
by Capt. Morgan
Excellent question! I am also wondering why people look at me funny when I tell them I am 4 feet and 23 inches tall.

Posted: Wed Jun 02, 2004 6:17 pm
by Thornado
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.

old skool huh

Posted: Thu Jun 03, 2004 2:36 am
by VirusX
hehe bronze I thought it was copper ;p pickin on ya =)