Bazaar Buying macro

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

Moderator: MacroQuest Developers

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

Post by Override » Wed Sep 08, 2004 5:15 pm

Yeah, its also funny SlimFast, I'm working on a pull macro too with anti-add code, LOL. But I thought about doing something like that at first, but I wanted to do it with not much writing code involved. I am going to add a price logging function into with min price, average and max price that it has seen too. But that will be soon. Also I am working on a trader macro that uses this same function that it will search the bazaar for an item for the highest price to buy at set, then it goes gets the item, and when it goes back to trader mode it sets the price to sell that item back at to 25% higher then what you paid for it, but if someone else is selling it to below that 25% price and above the price you buy it at it will set it to 1pp lower then his price. But it will not go lower then 1pp higher then the price you buy it at. I am going to add ini support so you can add in lots of items to it.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

BadBoy
a hill giant
a hill giant
Posts: 158
Joined: Thu Sep 05, 2002 11:53 am

Post by BadBoy » Wed Sep 08, 2004 6:44 pm

See, the problem with those waypoints are, if the person is behind a post, you may get stuck in the post.


Another thing I found:

When you try searching something like "10 dose ant's potion", you get "10 dose ant[]s potion" the [] signifying a box.

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

Post by Override » Wed Sep 08, 2004 7:18 pm

BadBoy wrote:See, the problem with those waypoints are, if the person is behind a post, you may get stuck in the post.


Another thing I found:

When you try searching something like "10 dose ant's potion", you get "10 dose ant[]s potion" the [] signifying a box.
I have put a thing in that if you get stuck on the post it works its way around, I have tried it on a lot of people around post and it gets stuck for a second then works its way off. And the name thing, I will look into that, I'm not sure exactly how to fix that one. I will work on it though.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

BadBoy
a hill giant
a hill giant
Posts: 158
Joined: Thu Sep 05, 2002 11:53 am

Post by BadBoy » Wed Sep 08, 2004 7:40 pm

OR, your waypoints are very good. Mind you, I do get stuck every so often, but it will happen. Too many variables to integrate into that.

BadBoy
a hill giant
a hill giant
Posts: 158
Joined: Thu Sep 05, 2002 11:53 am

Post by BadBoy » Sun Sep 12, 2004 9:06 am

another flaw:

if "randomperson" and "person" are in the bazaar, and you want to buy something from "randomperson", you always target "person" if he is near instead :(

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

Post by Override » Sun Sep 12, 2004 3:45 pm

yeah, that is one flaw, I was going to add in a check for that too.
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 » Thu Sep 16, 2004 5:58 pm

I have fixed the problem with the pets and the going to the person with the other person name inside it.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

User avatar
Zornecro
a ghoul
a ghoul
Posts: 82
Joined: Sun Sep 19, 2004 10:19 pm
Location: El Paso, TX

Failed to parse

Post by Zornecro » Mon Sep 20, 2004 7:36 pm

Set up the macro and it started searching and found something to buy. It targeted the trader in question, pathed to them, and kept auto-running straight past them into the wall. The MQ window showed:

failed to parse /if condit '&{TargetName.Equal[Kruune]}', non-numeric encountered
- Zornecro Mancer, Retired EQ1 Veeshan
- Unktehila, Redtigre, Twinaxe, EQ2 Crushbone

User avatar
Zornecro
a ghoul
a ghoul
Posts: 82
Joined: Sun Sep 19, 2004 10:19 pm
Location: El Paso, TX

My spin on bargain hunting

Post by Zornecro » Tue Oct 12, 2004 1:39 am

I decided to do my own bazaar bargain hunter. This uses an INI file as a shopping list and searches the bazaar for the best price discount beneath the maximum prices you set for items you want. Then it makes a magic rope to that merchant and tells you what item and price. This is not auto-pathing, and aside from doing some highspeed bazaar searches in sequence, nothing to get a GM's attention. You run it AT keyboard, wait a little while for it to scan through merchants selling at your price points, then follow the rope (if any).

This has an optional parameter in case your shopping list is really a list of popular items you'd like to resell higher and are looking for people selling these items 50% off or what have you. Read the macro comments for more.

Note the items in the shopping list works exactly like typing their names in the bazaar search window, so spell things out if you wanted blood of cazic thule and not words of cazic thule. Just putting "cazic thule" in will find both. Unfortunately, it still does not use EXACT matches. "Tea Leaves" will find "Tea Leaves" and "Emerald Tea Leaves." This is because I don't believe the bazaar search plugin allows for the =itemName syntax. If it does, I will edit this code to include that feature asap.

Also note that since it does not sort by price, the magic rope might lead you to the wrong vendor. I thought doing a search for item named in price 0 to best would get only 1 match, but apparently it is finding wrong matches and ASSUMING (sometimes incorrectly) the top of the list is the right person. This will be corrected when I learn how to sort by price in the bazaar list in ascending order. I think the reason why was a small bug in "KaChing" which I have corrected below. Honestly, a search for 0 to your bargain price should have 1 match, or all the matches should be at or below your best bargain price, no need for sorting. But if needs be, lemme know and I'll modify the routine to select the specific merchant we were wanting.

My 1.4 was buggy, caused CTDs (although it never happened to me), and Grumpy was kind enough to correct the errors. Below is his modified version. He also recommends you keep your shopping list to 90 items or fewer, else this really bogs down. Use separate shopping lists for the event you have a huge number of things you'd like to find at low prices.

I did change KaChing to be better behaved for the find trader function, and I changed back to quoted defines for DEBUG_1 and DEBUG_2 (read my reasons below Grumpy's post).

Code: Select all


| Bazaar Bargain Hunter - bargain.mac for release/macro folder of MQ2 
| v1.4, Zornecro - 8 Oct 2004 
| v1.5, Grumpy - 13 Oct 2004 
| 
| USAGE: /macro bargain "shopping.ini" (while you are currently inside the bazaar) 
| /macro bargain "shopping.ini" 50 
| The second example says you're only interested in finding items matching your 
| shopping list that are discounted AT LEST 50% from your maximum pay price. 
| 
| Shopping.ini (in this example) would contain 1 section: 
| [WantToBuy] 
| Blue Diamond=150 
| Delightful Orb=1000 
| 
| That would search for the cheapest blue diamond at or under 150pp, 
| and a Delightful Orb at or under 1kpp. 
| If you have a longer shopping list, add more lines like these. Don't use quote (") or bar (|) chars. 
| The item on your list found at the best discount off your maximum price 
| will be selected, and the trader found and the "magic rope" drawn if possible. 
|================================================================================================ 

#turbo 40 

|Define these as "/squelch /echo" to quiet down their spam 
#define DEBUG_1 "/squelch /echo"
#define DEBUG_2 "/squelch /echo"

Sub Main 
	/declare bestItem string outer 
	/declare bestPrice int outer ${maxAskingPrice} 
	/declare bestVendor string outer 
	/declare bestDiscount float outer 0 
	/declare indx int local 
	/declare index2 int local 
	/declare iniFile string local 

	DEBUG_2 Attempting to open Bazaar Search window. 
	/windowstate BazaarSearchWnd open 

	/if (${Defined[Param0]} && ${String[${Param0}].Length}>0) { 
		/varset iniFile "${Param0}" 
		DEBUG_1 shopping list in file: ${iniFile} 
	} else { 
		/echo USAGE: /macro bargain "shopping.ini" 
		/echo Please read comments at the top of bargain.mac. 
		/endmacro 
	} 
	/if (${Defined[Param1]} && ${Float[${Param1}]}>0) /varcalc bestDiscount ${Param1}/100 

	/popup Browsing your shopping list: ${iniFile} 
	/call ShoppingList "${iniFile}" 
	/if (${Macro.Return}==0) { 
		DEBUG_1 Nothing at ${Math.Calc[100*${bestDiscount}]}% off... 
		/popup Nothing for sale you want (at ${Int[${Math.Calc[100*${bestDiscount}]}]}% off)! 
	} else { 
		DEBUG_1 List match: ${bestItem} from ${bestVendor} selling for ${bestPrice} (${Math.Calc[100 * ${bestDiscount}]}% off) 
		/popup Go buy ${bestItem} from ${bestVendor} at ${bestPrice} (${Math.Calc[100 * ${bestDiscount}]}% off) 
		/call KaChing 
	} 
/return 

|Sub: ShoppingList (see top of macro for ini file info) 
|Returns: nonzero if it finds an item at or under the desired discount. 
Sub ShoppingList(string iniName) 
	DEBUG_2 ReadINI "${iniName}" "WantToBuy" 
	/call ReadINI "${iniName}" "WantToBuy" 
	/if (!${Defined[newArray]}) /return 0 

	/declare indx int local 
	/declare maxprice[${newArray.Size}] int local 
	/for indx 1 to ${newArray.Size} 
		/varset maxprice[${indx}] ${Ini[${iniName}, WantToBuy, ${newArray[${indx}]}]} 
		DEBUG_2 ${newArray[${indx}]}=${maxprice[${indx}]} 
	/next indx 

	DEBUG_2 have ${newArray.Size} Shopping list items to check... 
	/declare sli int local 
	/declare bi int local 
	/declare discount float local 0 
	/for sli 1 to ${newArray.Size} 
		/delay 10 ${Bazaar.Done} 
		DEBUG_2 Checking ${newArray[${sli}]} for <= ${maxprice[${sli}]}... 
		/bzsrch race any class any stat any slot any type any price 0 ${maxprice[${sli}]} "${newArray[${sli}]}" 
		/delay 50 ${Bazaar.Done} 
		/if (!${Bazaar.Count}) { 
			DEBUG_2 None that cheap! 
			/goto :nextItem 
		} 
		/if (${Bazaar.Count} >= 200) { 
			DEBUG_1 Sure you wanted to pay ${maxprice[${sli}]} for a ${newArray[${sli}]}? 
			/goto :nextItem 
		} 
		/for bi 1 to ${Bazaar.Count} 
			/varcalc discount (${maxprice[${sli}]} - ${Math.Calc[${Bazaar.Item[${bi}].Price} \ 1000]}) / ${maxprice[${sli}]} 
			/if (${discount} >= ${bestDiscount}) { 
				/varset bestDiscount ${discount} 
				/varset bestItem ${Bazaar.Item[${bi}].Name} 
				/varset bestPrice ${Math.Calc[${Bazaar.Item[${bi}].Price} \ 1000]} 
				/varset bestVendor ${Bazaar.Item[${bi}].Trader.CleanName} 
			} 
		/next bi 
		/echo ${bestItem} for ${bestPrice} from ${bestVendor} (${Math.Calc[${bestDiscount} * 100]}%) 
:nextItem 
	/next sli 
/return ${bestItem.Length} 

|Sub: KaChing - we have something to buy (in outer variables bestPrice and bestItem) 
Sub KaChing 
	DEBUG_1 trying to find a path for you... 
	DEBUG_2 /bzsrch race any class any stat any slot any type any price 0 ${bestPrice} "${bestItem}" 
	/bzsrch race any class any stat any slot any type any price 0 ${bestPrice} "${bestItem}" 
	/delay 10s ${Bazaar.Done} 
	/if (!${Bazaar.Count}) {
		/echo Find Trader failed! 
	} else {
		/notify BazaarSearchWnd BZR_ItemList listselect 1 
		/delay 1s 
		/notify BazaarSearchWnd BZR_FindTraderButton leftmouseup 
	}
/return 

Sub ReadINI(string fileName, string SectionName) 
   DEBUG_1 Attempting to Read Section [${SectionName}] from ${fileName}... 
   /if (${Ini[${fileName}, ${SectionName}, -1, NO].Equal[NO]}) { 
      DEBUG_1 Section [${SectionName}] wasn't found in File:${fileName} 
      /return 
   } 
   /call CountDefines "${fileName}" "${SectionName}" 
   /declare newArraySize int local 
   /varset newArraySize ${Macro.Return} 
   /if (${newArraySize} <= 0) { 
      DEBUG_1 [${SectionName}] found, but had no definitions. 
      /return 
   } 

   /if (${Defined[newArray]}) { 
      DEBUG_1 newArray Defined 
      /deletevar newArray 
      DEBUG_1 newArray deleted 
      } 
   DEBUG_1 Declaring newArray[${newArraySize}] string outer... 
   /declare newArray[${newArraySize}] string outer 

   /declare indx int local 
   /declare values string local 
   DEBUG_1 getting values from Ini 
   /varset values ${Ini[${fileName},${SectionName}]} 
   DEBUG_1 got values 
   /for indx 1 to ${newArraySize} 
      /varset newArray[${indx}] ${values.Arg[${indx},"|"]} 
      |DEBUG_1 newArray[${indx}]=${newArray[${indx}]} 
   /next indx 
   DEBUG_1 [${SectionName}] info Read Successfully from ${fileName}, ${newArraySize} items. 
/return 

Sub CountDefines(string fileName, string SectionName) 
   /declare theCount int local 
   /declare vars string local 
   DEBUG_1 CountDefines Ini[${fileName},${SectionName}] 
   /varset vars ${Ini[${fileName},${SectionName}]} 
    
   /if (${vars.Length}<1) { 
      DEBUG_1 null found. 
      /varset theCount 0 
   } else { 
      DEBUG_1 vars: ${vars} 
      /varcalc theCount ${vars.Count["|"]} - 1 
      DEBUG_1 Total: ${theCount} 
      /if (${theCount} < 1) /varset theCount 1 
   } 
/return ${theCount} 
This no longer needs my INIreader.inc, Grumpy bug fixed that too and put the subs inside the code above.
Example of my shopping.ini:

Code: Select all

; Zornecro, 8 Oct 2004
; In the lines following [WantToBuy], you put item name=price
; Where the item name can be full or partial, spaces allowed.
; Put an = without a space on either side between the item and the
; maximum price you are willing to pay for it.
; PRICES ARE IN PLATINUM, not coppers!
; You might think by looking at this list it is copper, but nope, these are
; L65 spells and epic drops and other rare items that sell for LOTS on
; my server.

[WantToBuy]
Spell: Ferocity=5000
Spell: Chill Bones=500
Blood of Cazic Thule=50000
Spiroc Feathers=5000
Silver Disc=5000
Words of Awareness=1000
Words of Sapience=1000
Words of Exhiliration=1000
Spell: Sedulous Subversion=1000
Last edited by Zornecro on Wed Oct 13, 2004 5:27 pm, edited 6 times in total.
- Zornecro Mancer, Retired EQ1 Veeshan
- Unktehila, Redtigre, Twinaxe, EQ2 Crushbone

Grumpy
a hill giant
a hill giant
Posts: 167
Joined: Sun Nov 10, 2002 4:22 pm

Post by Grumpy » Wed Oct 13, 2004 12:49 pm

You didn't test this macro at all did you? After numerous CTDs, I managed to fix this thing. There were numerous MQ syntax errors, especially in the readini include.

Here's a version that actually works (and was tested), still a little rough, but at least it won't CTD.

Code: Select all

| Bazaar Bargain Hunter - bargain.mac for release/macro folder of MQ2
| v1.4, Zornecro - 8 Oct 2004
| v1.5, Grumpy - 13 Oct 2004
|
| USAGE:    /macro bargain "shopping.ini" (while you are currently inside the bazaar)
|      /macro bargain "shopping.ini" 50
|   The second example says you're only interested in finding items matching your
|   shopping list that are discounted AT LEST 50% from your maximum pay price.
|
|      Shopping.ini (in this example) would contain 1 section:
|      [WantToBuy]
|      Blue Diamond=150
|      Delightful Orb=1000
|
|   That would search for the cheapest blue diamond at or under 150pp,
|   and a Delightful Orb at or under 1kpp.
|   If you have a longer shopping list, add more lines like these. Don't use quote (") or bar (|) chars.
|   The item on your list found at the best discount off your maximum price
|   will be selected, and the trader found and the "magic rope" drawn if possible.
|================================================================================================

#turbo 40

|Define these as "/squelch /echo" to quiet down their spam
#define DEBUG_1 /squelch /echo
#define DEBUG_2 /squelch /echo

Sub Main
   /declare bestItem string outer
   /declare bestPrice int outer ${maxAskingPrice}
   /declare bestVendor string outer
   /declare bestDiscount float outer 0
   /declare indx int local
   /declare index2 int local
   /declare iniFile string local

   DEBUG_2 Attempting to open Bazaar Search window.
   /windowstate BazaarSearchWnd open

   /if (${Defined[Param0]} && ${String[${Param0}].Length}>0) {
      /varset iniFile "${Param0}"
      DEBUG_1 shopping list in file: ${iniFile}
   } else {
      /echo USAGE: /macro bargain "shopping.ini"
      /echo Please read comments at the top of bargain.mac.
      /endmacro
   }
   /if (${Defined[Param1]} && ${Float[${Param1}]}>0) /varcalc bestDiscount ${Param1}/100

   /popup Browsing your shopping list: ${iniFile}
   /call ShoppingList "${iniFile}"
   /if (${Macro.Return}==0) {
      DEBUG_1 Nothing at ${Math.Calc[100*${bestDiscount}]}% off...
      /popup Nothing for sale you want (at ${Int[${Math.Calc[100*${bestDiscount}]}]}% off)!
   } else {
      DEBUG_1 List match: ${bestItem} from ${bestVendor} selling for ${bestPrice} (${Math.Calc[100 * ${bestDiscount}]}% off)
      /popup Go buy ${bestItem} from ${bestVendor} at ${bestPrice} (${Math.Calc[100 * ${bestDiscount}]}% off)
      /call KaChing
   }

/return

|Sub: ShoppingList (see top of macro for ini file info)
|Returns: nonzero if it finds an item at or under the desired discount.
Sub ShoppingList(string iniName)
   DEBUG_2 ReadINI "${iniName}" "WantToBuy"
   /call ReadINI "${iniName}" "WantToBuy"
   /if (!${Defined[newArray]}) /return 0

   /declare indx int local
   /declare maxprice[${newArray.Size}] int local
   /for indx 1 to ${newArray.Size}
      /varset maxprice[${indx}] ${Ini[${iniName}, WantToBuy, ${newArray[${indx}]}]}
      DEBUG_2 ${newArray[${indx}]}=${maxprice[${indx}]}
   /next indx

   DEBUG_2 have ${newArray.Size} Shopping list items to check...
   /declare sli int local
   /declare bi int local
   /declare discount float local 0
   /for sli 1 to ${newArray.Size}
      /delay 10 ${Bazaar.Done}
      DEBUG_2 Checking ${newArray[${sli}]} for <= ${maxprice[${sli}]}...
      /bzsrch race any class any stat any slot any type any price 0 ${maxprice[${sli}]} "${newArray[${sli}]}"
      /delay 50 ${Bazaar.Done}
      /if (!${Bazaar.Count}) {
         DEBUG_2 None that cheap!
         /goto :nextItem
      }
      /if (${Bazaar.Count} >= 200) {
         DEBUG_1 Sure you wanted to pay ${maxprice[${sli}]} for a ${newArray[${sli}]}?
         /goto :nextItem
      }
      |/varcalc bestPrice ${maxprice[${sli}]} + 1
      /for bi 1 to ${Bazaar.Count}
         /varcalc discount (${maxprice[${sli}]} - ${Math.Calc[${Bazaar.Item[${bi}].Price} \ 1000]}) / ${maxprice[${sli}]}
         /if (${discount} >= ${bestDiscount}) {
            /varset bestDiscount ${discount}
            /varset bestItem ${Bazaar.Item[${bi}].Name}
            /varset bestPrice ${Math.Calc[${Bazaar.Item[${bi}].Price} \ 1000]}
            /varset bestVendor ${Bazaar.Item[${bi}].Trader.CleanName}
         }
      /next bi
      /echo ${bestItem} for ${bestPrice} from ${bestVendor}  (${Math.Calc[${bestDiscount} * 100]}%)
      
:nextItem
   /next sli
/return ${bestItem.Length}

|Sub: KaChing - we have something to buy (in globals bestPrice, bestProfit and bestItem)
Sub KaChing
   DEBUG_1 trying to find a path for you...
   DEBUG_2 /bzsrch race any class any stat any slot any type any price 0 ${bestPrice} "${bestItem}"
   /bzsrch race any class any stat any slot any type any price 0 ${bestPrice} "${bestItem}"
   /delay 10s ${Bazaar.Done}
   /if (!${Bazaar.Count}) DEBUG_2 KaChing  failed!
   /notify BazaarSearchWnd BZR_ItemList listselect 1
   /delay 1s
   /notify BazaarSearchWnd BZR_FindTraderButton leftmouseup
/return 

Sub ReadINI(string fileName, string SectionName)
   DEBUG_1 Attempting to Read Section [${SectionName}] from ${fileName}...
   /if (${Ini[${fileName}, ${SectionName}, -1, NO].Equal[NO]}) {
      DEBUG_1 Section [${SectionName}] wasn't found in File:${fileName}
      /return
   }
   /call CountDefines "${fileName}" "${SectionName}"
   /declare newArraySize int local
   /varset newArraySize ${Macro.Return}
   /if (${newArraySize} <= 0) {
      DEBUG_1 [${SectionName}] found, but had no definitions.
      /return
   }

   /if (${Defined[newArray]}) {
   	DEBUG_1 newArray Defined
   	/deletevar newArray
   	DEBUG_1 newArray deleted
   	}
   DEBUG_1 Declaring newArray[${newArraySize}] string outer...
   /declare newArray[${newArraySize}] string outer

   /declare indx int local
   /declare values string local
   DEBUG_1 getting values from Ini
   /varset values ${Ini[${fileName},${SectionName}]}
   DEBUG_1 got values
   /for indx 1 to ${newArraySize}
      /varset newArray[${indx}] ${values.Arg[${indx},"|"]}
      |DEBUG_1 newArray[${indx}]=${newArray[${indx}]}
   /next indx
   DEBUG_1 [${SectionName}] info Read Successfully from ${fileName}, ${newArraySize} items.
/return

Sub CountDefines(string fileName, string SectionName)
   /declare theCount int local
   /declare vars string local
   DEBUG_1 CountDefines Ini[${fileName},${SectionName}]
   /varset vars ${Ini[${fileName},${SectionName}]}
   
   /if (${vars.Length}<1) {
      DEBUG_1 null found.
      /varset theCount 0
   } else {
      DEBUG_1 vars: ${vars}
      /varcalc theCount ${vars.Count["|"]} - 1
      DEBUG_1 Total: ${theCount}
      /if (${theCount} < 1) /varset theCount 1
   }
/return ${theCount} 
Additional notes:

1. prices in the .ini file are in number of plat, not copper, 1000 is 1000 pp, not 1 pp.

2. do not put more than about 90 items in the shopping file, it will break the macro (and take a long time), create multiple shopping.ini files if you have more than this many items to search for.

3. For best results, have /bazaar window up and set to sorting by prices, ascending, if you don't, it will still find the right vendor, but it can send you off in the wrong direction, I'll fix this later (or Zornecro can).

4. It also doesn't check for exact matches, if ini file says "Tea Leaves=10", it will match anything with "Tea Leaves" in the name (possibly giving a false hit). Also fairly easy to fix, but I was mainly interested in not crashing.

5. I folded the .inc back into the main source (just so I wouldn't have to deal with extra debugging issues), now that it's working, we could seperate it out again. (currently you don't need the .inc in the original post).

User avatar
Zornecro
a ghoul
a ghoul
Posts: 82
Joined: Sun Sep 19, 2004 10:19 pm
Location: El Paso, TX

Post by Zornecro » Wed Oct 13, 2004 4:08 pm

:oops: I really did use it, but must have made an edit-while-posting mistake (or several, as you pointed out).

Thanks a lot for working at the fix. I might as well correct my original post and credit you for the expert help. I am a new MQ2 user, only about one week of experience with it. :oops:

I think you still want to use the syntax:

Code: Select all

#define DEBUG_1 "/squelch /echo"
because without quotes, I'm pretty sure if you:

Code: Select all

/echo DEBUG_1
you will see: "[MQ2] /squelch" and not the "[MQ2] /squelch /echo" you were expecting. Therefore, as defined, the debugs are expanding to stuff like:

Code: Select all

/squelch We are searching for...
and it wouldn't surprise me in the least we are squelching MQ2 coughing up a lung and/or CTD, attempting to use "we are searching for" as a command!

The Natural Beastlord Hunter uses quoted defines, and seems to work perfectly in the "/squelch /echo" as well as "/echo" definitions.

We have to wait for the next zip because sony changed eqgame.exe on us to be sure. Unless someone has access to a EQ emulator and a working MQ2 for it and can post here...?
- Zornecro Mancer, Retired EQ1 Veeshan
- Unktehila, Redtigre, Twinaxe, EQ2 Crushbone

Grumpy
a hill giant
a hill giant
Posts: 167
Joined: Sun Nov 10, 2002 4:22 pm

Post by Grumpy » Wed Oct 13, 2004 11:00 pm

Possible, it depends on whether MQ2 follows the conventions C/C++ in it's implementation of #define. I can tell you that before I took the quotes out, I wasn't getting anything out of the lines with either DEBUG_1 or DEBUG_2, with current code, they are quiet when defined as

/squelch /echo

and spew debug lines when defined as

/echo

To reall do it right we should define them as:

|
(the single line comment character) when we don't want output and as:

/echo
or
/mqlog

when we do.

As for the syntax errors, it's possible it will work with the quotes, but that's not how the readme defines them, and I was fixing ANYTHING that looked like it might be causing my CTDs. After I stopped the CTDs, then I fiddled with a few things to make it work like I thought it should.

I think what was causing the CTDs was:

Code: Select all

/varset ${newArray}[${indx}] ${values.Arg[${indx},|]}
rather than:

Code: Select all

/varset newArray[${indx}] ${values.Arg[${indx},"|"]}
The second way is what the readme says about declaring and varset and varcalc, I'm not exactly sure what it was doing in the first example. There were several similar entries.

Like this one:

Code: Select all

 /varset vars "${Ini[${fileName},${SectionName}]}"
I'm pretty sure what that is doing is creating a string that CONTAINS beginning and ending quotes, rather than just the key names.

To be perfectly fair, it may have been the fact that I started with a 311 item ini file that caused the CTDs (mostly missing twilight sea quest items, and spell research bits, if you must know). The resulting return string from $Ini code above was corrupt (didn't have the || at the end) causing some weird behaviors later on.

I also am waiting for new offsets/code. I may want it to stop searching once it find the first item, maybe a commandline parameter to decide.

User avatar
Zornecro
a ghoul
a ghoul
Posts: 82
Joined: Sun Sep 19, 2004 10:19 pm
Location: El Paso, TX

Post by Zornecro » Thu Oct 14, 2004 12:19 am

I hear rumor SOE really changed the memory protection system, so we may have some wait on our hands (much sorrow and attaboys aimed toward MQ2 devs).

newArray was a parameter of ReadINI, so you'd pass in the name of an array you wanted to create, which is assumed wasn't in existance at that moment. There could be an issue with MQ2 dimensioning an array to 300+ where it doesn't do memory checking so goes out of bounds and CTDs.

When you /call ReadIni myfile.ini MySection wantedList what happens is the code /declare ${newArray}[${newArraySize}] string outer gets turned into the following at run-time:

Code: Select all

/declare wantedList[12] string outer
...assuming newArraySize evaluates to 12 (int or string).

MQ2 syntax is some of the hardest to get used to if you are a C++ or C programmer (I am and the ${ gets me almost every time the required slash before /if does). It is consistent, does evaluate expressions well, lets you have recursively/incrementally constructed statements (such as I did above), and other stuff that I guess I'd appreciate less if I were a PhD in Computer Science, but since I dropped out of 1st semester college, it looks like fooking genius to me. :wink:

Oh, and the syntax to put "|" in the Arg[] statement works either way. You'll find oodles of macros that do NOT quote the bar character in Arg and Token. In fact, I borrowed my working code from one (see snippets section). The | character is only a comment when a line begins with nothing except whitespace before it. After that, it either is a character in an argument, or a "bitwise OR" operator, depending on context.

One of the problems I had is I'd do this:

Code: Select all

/declare foo string outer    |1 of several globals needed
Well, foo ended up being "|1 of several globals needed" and not empty. I had messy strings and other problems, and resigned myself to ALWAYS commenting ABOVE what I'm about to do with a full comment line and not attempt an "at the end of the statement" comment.

Quotes are something I figure out on the fly using /echo statements. I decide when I need them and when I don't.

I /echo'd the input parameters to ReadINI and when I did a /call "foo.ini" "goodSection" myArray I'd echo these as: foo.ini goodSection myArray. This is no big deal EXCEPT where you have a complex path to your file name (especially if the INI filename contains spaces) which are normally assumed to be parameter delimeters in /call statements, so you MUST quote string values that have whitespace in them.

I found if you don't KNOW whether a string is going to have a space or not, it doesn't hurt to use call and quote everything where you are ambiguous. When I perform assignments from reading the INI file, I wanted to be able to say "Blood of Cazic Thule=42" and not just "Thule=42" or use ugly underscore translation or what have you. So the assignment of an ${Ini[]} call putting quotes around it takes care of these ambiguous moments where the (key) value out of the INI file may or may not have spaces, and/or where the Arg[] or Token[] result may or may not have spaces. (I believe /setvar stringname this that theother without quoting it sets stringname==this.)
- Zornecro Mancer, Retired EQ1 Veeshan
- Unktehila, Redtigre, Twinaxe, EQ2 Crushbone

Scary_Penguin
a lesser mummy
a lesser mummy
Posts: 76
Joined: Sun Nov 16, 2003 11:45 am

Post by Scary_Penguin » Sat Oct 16, 2004 2:55 am

Considering this macro (the one by override, not the other one that popped into this thread) asks you to start in front of Caerlyna, why not put a small script in the beginning to move you to there from wherever you happen to be standing? Shouldnt be too hard for it to reference your current location against the anchor points you have in your common files, move you among those based on whichever you are closest to, and send you to a new anchor in front of her.

Edit: Also, what would you think of changing the /face commands in the movement incs to /face nolook? that way people who lag heavily in the bazaar could execute this a bit smoother, not having to deal with bazaar population (many still lag heavily even with traders invisible).

Just some suggestions! :)
Scary:.

No, Really.

rustedone
orc pawn
orc pawn
Posts: 14
Joined: Sat Aug 21, 2004 11:07 pm

Post by rustedone » Tue Nov 30, 2004 4:23 pm

ok this is a copy and paste from one of my original posts on overrides main post... which seems to be getting long and its understandable....
just wondering if anyone has had similar issues with this or im just a freak and or a retard and dont understand the concept of this macro....
oh and the other macro posted here works good... except for the fact that it wont go buy it for you, then return to some set point, run the macro again, find x items until its out of items or money.
ok havin some issues with the bazaar buying macro... its not distinguishing prices correctly... it is trying to buy items for ALOT more pp than it is being told.... also is there a way to set it so that maybe it will calculate how much pp u have available and how many of x item you can afford?.....

here is my code... let me know if something is wrong

Code: Select all

#include common/bazaarbuy.inc
#include common/buy.inc
#include common/gogetitem.inc

Sub Main 

   /declare ItemToBuy string inner
   /declare HighestPriceToPay int inner
   /declare TotalYouWant int inner
   :start

   /varset ItemToBuy "Mudflow Stone"
   /varset HighestPriceToPay 1000000
   /varset TotalYouWant 1

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy mudflow stone for 1kpp

   /varset ItemToBuy "sphalerite"
   /varset HighestPriceToPay 1000000
   /varset TotalYouWant 1

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy saphalerite for 1kpp

   /varset ItemToBuy "Tourmaline"
   /varset HighestPriceToPay 1000000
   /varset TotalYouWant 1

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy tourmaline for 1kpp

   /varset ItemToBuy "sphalerite"
   /varset HighestPriceToPay 1000000
   /varset TotalYouWant 1

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy sphalerite for 1kpp

   /varset ItemToBuy "Dust of Discord"
   /varset HighestPriceToPay 500000
   /varset TotalYouWant 8

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy dust of discord for 500pp

   /varset ItemToBuy "Pyrilen Plasma"
   /varset HighestPriceToPay 1000000
   /varset TotalYouWant 1

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy pyrilen plasma for 1kpp

   /varset ItemToBuy "slugworms"
   /varset HighestPriceToPay 200000
   /varset TotalYouWant 20

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy slugworms for 200pp

   /varset ItemToBuy "Discordant Scoriae"
   /varset HighestPriceToPay 500000
   /varset TotalYouWant 20

   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}

|should buy discordant scoriae for 500pp

/delay 600s
/goto :start

/return

ive tried taking the 0's out for the copper, silver, and gold... and all it does then is try to buy items that are far over priced.... currently it wont try to buy anything


PS ive used your other macro's override and they are awsome.... please release that tailoring one soon i would love to get my tailoring up :D

if i run this portion just like this....

Code: Select all

   /varset ItemToBuy "Dust of Discord"
   /varset HighestPriceToPay 500
   /varset TotalYouWant 8
   /call BazaarBuy ${ItemToBuy} ${HighestPriceToPay} ${TotalYouWant}
|should buy dust of discord for 500pp
it will find dust of discord selling for 4k each... not 500pp