Bazaar Trader INI Update Macro (True Market Value)

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Bazaar Trader INI Update Macro (True Market Value)

Post by Zacaria » Fri Jan 02, 2004 8:10 am

Well just like the Subject says, this script updates your BZR_ ini file in your EQ directory so you dont have to do any leg work.

FIRST of all let me give a disclaimer saying that you should always backup your INI file before running this if your smart.

Also, First run of this script creates a bypass ini file so you can specify how you want the script to handle your files (Sell Low, Average, Dont MEss With)

Code: Select all

|Bazaarupdate.mac 
|Written By Zacaria
|04-Jan-2004
| 1.0c
|----------------------
|  Script Description
|----------------------
|
|This Script is used to Update your Bazaar Trader
|It will search the bazaar using the Bazaar Search Plugin (Make Sure you Have it Loaded)
|It uses the Bazaar Ini in your everquest Directory and also have a Bypass file so you can specify how you want your items handled
|
| Syntax: /mac Bazaarupdate <verbose>
| Example: /mac Bazaarupdate 1 
|
| With Verbose on the Outputted "Echos" Will be spamtastic! :)



#turbo
#Event MaxBazaar "The bazaar has reached its maximum number of traders. Please try again in a few minutes."

Sub Main(Verbose)
|Global Declares
/declare BZRINI global
/declare l2 global
/declare l11 global
/declare ByPassIni global
/declare OutSellPrice global
/declare OutSellPriceH global
/declare PricePctV global
/declare MQ_Directory global
/declare BazaarDelay global

|User Set Variables!
|
|PricePctV = Sell Percentage Difference. So if someone has an item and your Ini says its 50% less then him, it will up it to this value (Handy for when sellers leave etc)
/varset PricePctV 30
|OutSellPrice This is the amount (In Copper) that you want your Items to outbid everyone by [default of 1000 = 1pp]
/varset OutSellPrice 1000
|ByPass Ini is the File used for Item Bypassing etc. 
|Syntax in the File: 1= Bypass it completly and you will setup the price, 2= Set to sell fast (Lowest Price), 0= Average Price of everyone.
/varset ByPassIni $char(name)_bypass.ini
|BZRINI Here is the location of your Bazaar File!!!
/varset BZRINI "c:\Everquest\BZR_"
|BZRINI Dont Change This (Should be the same for Everyone
/varcat BZRINI $char(name)_
|BZRINI This is For your Server... Check your Trader file for it
/varcat BZRINI YOURSERVERHERE
|BZRINI Shouldnt have to change this
/varcat BZRINI ".ini"
|YOU MUST SETUP YOUR MQ Directory Here.
/varset MQ_Directory c:\Mq2\
|
|End User Set Variables

/varcat MQ_Directory locations.txt

|This is where I cleanup the Windows Prior to Running This.

/call TraderWindowStuff 0

/call ConvertPlat @OutSellPrice
/varset OutSellPriceH "$return"
/for l2 0 to 7
	/if "$pack(@l2,name)"!~"Trader's Satchel" /next l2
	/if $pack(@l2,empty)==TRUE /next l2
	/for l11 0 to 9
		/if "$item(@l2,@l11,name)"=="NULL" /next l11
		/if "$item(@l2,@l11,name)"!="NULL" {
		/call Add_Item "$item(@l2,@l11,name)" @Verbose
		}
	/next l11
/next l2

/call TraderWindowstuff 1
/return


Sub Add_Item(ItemName,Verbose)

/declare Spell local
/declare Ini_Price local
/declare Ini_PriceH local
/declare l1 local
/declare length local
/declare price local
/declare traderid local
/declare index local
/declare Average_Price local
/declare PriceH local
/declare Low_Price local
/declare Item_Value local
/declare Item_ValueH local
/declare PricePct Local
/declare OutSell local

/varset Average_Price 0

/if "$ini("@ByPassIni","Item","@ItemName")"=="NOTFOUND" {
	/ini "@ByPassIni" "Item" "@ItemName" "0"
	/echo @ItemName not in the Bypass File (@ByPassIni) Skipping Price Update until Next Run of the Script!!
	/goto :next
} else {
	/if n $ini("@ByPassIni","Item","@ItemName")==1 {
	/echo @ItemName Currently Flagged to Not Be Messed With. SKIPPING!!!! Change @ByPassIni if you want to change this.
	/goto :next
	}
	/if n $ini("@ByPassIni","Item","@ItemName")==2 {
	/echo @ItemName Currently Flagged for FAST SELL! Putting it at the Lowest possible Bazaar Price (Minus @OutSellPriceH).
	/varset OutSell 1
	}
}



/varset Item_Value $int($item(@l2,@l11,value))
/varset length $strlen("@ItemName")
|Setup the Bypass Ini File


|Get The Ini Price of the Item from the Bazaar Ini File
/if n $instr(:,"@ItemName")!=-1 { 
	/varset Spell "@ItemName:1"
	/varset Ini_Price $ini(@BZRINI,"ItemToSell","@Spell")
} else {
	/varset Ini_Price $ini(@BZRINI,"ItemToSell","@ItemName")
}
| Start the Search Portion

/if "@Ini_Price"!="NOTFOUND" {
/call ConvertPlat "@Ini_Price"
/varset Ini_PriceH "$return"
} else {
/varset Ini_Price 0
/varset Ini_PriceH "--Not Set Add Your Own Price!--"
}


/if "@ItemName"=="NULL" /return
/call SpamTastic "@Verbose" "Currently Searching for @ItemName (INI Price: @Ini_PriceH)"
/bzsrch race any class any @ItemName


| is request done? 
:loop 
/delay 1  
/if "$bazaar()"=="FALSE" /goto :loop 

/if n $bazaar(count)==0 {
	/call SpamTastic "@Verbose" "\---@ItemName not found (Current Price: @Ini_PriceH)"
	/goto :next
} 

/varset price $bazaar(0,price) 
/varset traderid $bazaar(0,trader)
	
/if n $bazaar(count)>=1 {
	/if n @index==-1 { 
		/call SpamTastic "@Verbose" "\-----No matches for @ItemName found."
		/goto :next
	} 
	/if n $bazaar(count)==1 {
		/if n @Ini_Price>@price {
			/varset PricePct $int($calc($calc(1-$calc(@price/@Ini_Price))*100))
			/if n @PricePct>@PricePctV {
				/echo @ItemName Currently The Price Difference is GREATER then @PricePctV% (@PricePct %), So I am going to leave the price at Previous Setting as not to lower the price too much.
				/goto :next
			}
		} else {
			/varset PricePct $int($calc($calc(1-$calc(@Ini_Price/@price))*100))
			/if n @PricePct>@PricePctV {
				/echo @ItemName Currrently The Price Different is GREATER then @PricePctV% (@PricePct %), Which means your underbidding him by that much. Upping the Price by $int($calc(@PricePct-@PricePctV))%
				/varset Low_Price $int($calc(@price-$calc(0.@PricePctV*@price)))
				/varset Ini_Price @price
				/goto :onward
			}
		}

	}
	/for l1 0 to $calc($bazaar(count)-1)
		/if "@ItemName"=="$bazaar(@l1,name)" { 
			/varset Average_Price $calc(@Average_Price+$bazaar(@l1,price))
			/if n $bazaar(@l1,price)<@price { 
				/varset price $bazaar(@l1,price) 
				/varset traderid $bazaar(@l1,trader) 
			}
		} 
	/next l1
	
	/if n OutSell==1 {
		/varset Low_Price $int(@price)
		/varsub Low_Price @OutSellPrice
		/varset Low_Price $int(@Low_Price)
	} else {
		/varset Average_Price $calc(@Average_Price/$bazaar(count))
		/varset Low_Price @Average_Price
	}
	:onward
	/call ConvertPlat @Low_Price
	/varset PriceH "$return"
	/call ConvertPlat @Item_Value
	/varset Item_ValueH "$return"
	
	/if n $instr(:,"@ItemName")!=-1 {
		/if n @Ini_Price>0 {
			/if n @Ini_Price!=@Item_Value {
				/if n @Item_Value>@Low_Price {
					/ini "@BZRINI" "ItemToSell" "@Spell" "@Item_Value"
					/echo Item below its Value! @ItemName!! [Price Set to @Item_ValueH]
					/goto :next
				}
			} else {
			/goto :next
			}
		}
		/if n "@Ini_Price">"@Low_Price" {
			/echo Lowered the Price of the @ItemName due to demands! (Old: @Ini_PriceH New: @PriceH )
			/ini "@BZRINI" "ItemToSell" "@Spell" "@Low_Price"
			/goto :next
		}
	}
	
	/if n @Ini_Price>0 {
		/if n @Ini_Price!=@Item_Value {
			/if n @Item_Value>@Low_Price {
				/ini "@BZRINI" "ItemToSell" "@ItemName" "@Item_Value"
				/echo Item below its Value! @ItemName!! [Price Set to @Item_ValueH]
				/goto :next
			}
		} else {
		/goto :next
		}
	
	}
	/if n "@Ini_Price">"@Low_Price" {
		/echo Lowered the Price of the @ItemName due to demands! (Old: @Ini_PriceH New: @PriceH)
		/ini "@BZRINI" "ItemToSell" "@ItemName" "@Low_Price"
	}
	
	
	/call SpamTastic "@Verbose" "\-----Nothing to Do for @ItemName, Going to Next Item"
	:next

}
/return

sub ConvertPlat(CashAmt)
	/declare platAmt local
	/declare goldAmt local
	/declare silverAmt local
	/declare copperAmt local
	/varset platAmt $int($calc(@CashAmt\1000))
	/varset goldAmt $int($calc(@CashAmt%1000\100))
	/varset silverAmt $int($calc(@CashAmt%100\10))
	/varset copperAmt $int($calc(@CashAmt%10))
	/varset CashAmt "@platAmt Platinum"
	/if n @goldAmt>0 {
	/varcat CashAmt " @goldAmt Gold"
	}
	/if n @silverAmt>0 {
	/varcat CashAmt " @silverAmt Silver"
	}
	/if n @copperAmt>0 {
	/varcat CashAmt " @copperAmt Copper"
	}

/return @CashAmt

sub SpamTastic
/if n @Param0==1 {
/echo @Param1
}
/return

sub TraderWindowStuff(TraderWindowVar)
/if n @TraderWindowVar==1 {
	/trader
	/click left bzrtrader_start
	/delay 20
	/doevents
	/return
}
/cleanup
|Adding Stuff to the Locations File so that I can reference to it later.
/if $ini("@MQ_Directory","bzrtrader_start","UILabel")=="NOTFOUND" {
	/ini "@MQ_Directory" "bzrtrader_start" "UILabel" "BazaarWnd"
	/ini "@MQ_Directory" "bzrtrader_start" "XMLFile" "EQUI_BazaarWnd.xml"
	/ini "@MQ_Directory" "bzrtrader_start" "ScreenID" "BZW_End_Button"
}

/return

sub Event_MaxBazaar
/delay @BazaarDelay
/varset BazaarDelay 15s
/call TraderWindowStuff 1
/return
V1.0a 02-Jan-2004 --- This was the First Release Real Crude
V1.0b 02-Jan-2004 --- Updated the Macro to reduce the spam. New Syntax.
V1.0c 04-Jan-2004 --- Updated the code so you dont have to worry about having the Bazaar Window open. Will automatically close it and will start it up again and put you in trader mode before it stops. If there is too many traders it will cycle and keep trying. *******MAKE SURE YOU SET YOUR MQ DIRECTORY******* As it updates your locations.txt file so it can click the button!
Last edited by Zacaria on Sun Jan 04, 2004 7:40 am, edited 4 times in total.

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Post by Zacaria » Fri Jan 02, 2004 8:13 am

BTW Lax said he was updating the $item code so it will show charges, so if your items have charges on them its currently screwed up, unless of course its a spell (which also might not work that good lol)

BUT anyways its still in test phase let me know your feedback..

Reason i say that is if you look at items with charges in the trader ini it is like

Spell: Manastorm:1

since Manastorm has 1 charge of the spell

so if you have a

Ant Potion with 5 charges its Ant Potion:5=200

that should be fixed next update.

jdelpheki
a lesser mummy
a lesser mummy
Posts: 51
Joined: Tue Dec 09, 2003 2:46 pm

Bazaar item value

Post by jdelpheki » Sat Jan 03, 2004 5:50 am

i cant find the $bazaar variable that returns teh data in the value area on the item description window

Any help ????
Time to die A microwave Burrito!

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Post by Zacaria » Sat Jan 03, 2004 5:56 am

load the bazaar search plugin :)

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Sun Jan 04, 2004 2:04 pm

It's odd, the thing runs and spams like crazy because I sell satchels full of the same item which i've told it to bypass, but it never changes prices for the other items i have, even if the bypass file is set to update them.
Opinions are like assholes, everyone has one, but most of them stink.

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Post by Zacaria » Sun Jan 04, 2004 5:57 pm

hmm, if its set to 0 then it'll update them with an average price. If you have them set lower then everyone else but not lower then the set percentage then you'll never see anything. As for the spamming of the "bypassing item" i'll see about changing that to the non-spamming portion of the echos. check the prices of your items manually and see if they conform with everyone else in the bazaar :)

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Sun Jan 04, 2004 8:22 pm

I'd have to check the item when I get home, but the average setting is way underpricing. Item that was 1k was set to 538pp after the script saw a high of 1200, and a low of 23, with most others in the 1200-900 range. Sell price to merchants was 40ish. All it takes is one person mystyping a value (selling somethign for 1pp that should be 5k) and the whole average drops....thus, WAY underbidding.

After lowering my price, it then lowers the price again "due to item demands." I caught several research components dropped to half of what a merchant would buy them for!

(off topic - the dumpsterdive mac doesn't catch these, so I can't dive against my own characters). lol This script did help me find several items that were way underpriced from other people, though. Should see a nice profit from those items soon. *grin*

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Post by Zacaria » Mon Jan 05, 2004 6:57 pm

well to tell you about that, it'll never price an item below its value :) so i checked that. But it wil inform you when someone else has that. I am working on a way to check to see if more then 70% of the people's prices are above that one guy who mess's up and then averaging them.. Just been working too much :) if anyone has any ideas feel free to change it and post it back here.

blackk9t
decaying skeleton
decaying skeleton
Posts: 1
Joined: Mon Jan 12, 2004 10:11 am

Post by blackk9t » Mon Jan 12, 2004 10:29 am

I'm kinda new to MacroQuest but have some programming experience. Currently I am getting an error on the second run of this script. The echo's are as follows:

bazaarupdate.mac@255 (ConvertPlat(CashAmt)): /varset platAmt $int($calc(@CashAmt(1000))
bazaarupdate.mac@133 (Add_Item(ItemName,Verbose)): /call ConvertPlat"@ini_Price"
bazaarupdate.mac@72 (Main(Verbose)): /call Add_Item "$item(@$item(@l2,@l11,name)" @Verbose

I threw in some echo's to determin where the macro is stopping. It seams to stop in the "Sub ConvertPlat(Castamt)" at the line "/varset platAmt $int($calc(@CashAmt\1000))" after the "/call Convertplat "@ini_Price" from Main". It runs the "Sub ConvertPlat(Castamt)" fine from the "/call ConvertPlat @OutSellPrice"

Anyone have any suggestions on what I am doing wrong?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Jan 12, 2004 12:00 pm

I don't know if the parser accepts this as being the correct symbol for division or not:

Code: Select all

$int($calc(@CashAmt\1000))
I always use this:

Code: Select all

$int($calc(@CashAmt/1000))

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Mon Jan 12, 2004 12:01 pm

bazaarupdate.mac@133 (Add_Item(ItemName,Verbose)): /call ConvertPlat"@ini_Price"
Should be bazaarupdate.mac@133 (Add_Item(ItemName,Verbose)): /call ConvertPlat"@Ini_Price"
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Mon Jan 12, 2004 8:52 pm

Once again, we must point to that Search feature which seems to be way beyond the comprehension of the average newb around here lately.

Try reading *this* thread to fix your problem.
Opinions are like assholes, everyone has one, but most of them stink.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Tue Jan 13, 2004 1:04 am

ml2517 wrote:I don't know if the parser accepts this as being the correct symbol for division or not:

Code: Select all

$int($calc(@CashAmt\1000))
I always use this:

Code: Select all

$int($calc(@CashAmt/1000))
\ is for integer division, in other words the decimal value is dropped

/ is for 'normal' division

The way you show it the same result should be shown, but I am not sure how both handle rounding.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Tue Jan 13, 2004 1:26 am

Cool good to know.

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Post by Zacaria » Tue Jan 13, 2004 4:04 pm

weird... i never had problems with it parsing that maybe it was changed.. but you are right should be / my bad :)