Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
xathil
Beginner


Joined: 19 Feb 2007
Posts: 10

PostPosted: Mon Feb 19, 2007 9:59 am   

wanting to set up a shop.
 
basically.. i can handle all the triggers.. but i dont know how to link items and values with keywords.

so say i want to sell Nasr, Claymore of Sovereignty

nasr. (thats what most people call it) so i want to sell it for 70 million coins. and its keyed to nasr and claymore but how do i get it to match everything when i use a more generalized pattern so i can do other items with the same trigger?

cause after than i also want to sell another item say... Crown of the Ages
keyed to crown ages. and sell it for 5 million coins.

so i want to have a generalized trigger that takes someone giving me coins as a pattern, matched with color and all that.

Name gives you XXX,XXX,XXX coins.

so how do i get zmud to help me and match the amount of gold and the keyword together? what i want it to do is so that i dont need a trigger for each item. and have a trigger for all items. it checks which gold value it is, then gives the corresponding item by using the proper keywords.

then to advertise the items, i would like to put it in my bio. i would like to put the amount it costs in millions in a table kinda form along with the name. kinda like how xenapan has it

-------------------------------------------------------------
| Item name | Price (Millions) | Quantity remaining |
| Ring of Wizardary 15 7
| sash of the magi 1.4 0
| Cream colored sash 22 12
| Cream colored pants 8 13
| Crown of the Ravenells 16 11
| Bands of Power 5 0
| laundry basket 1.7 29
| blue glassy chain 35 11
-------------------------------------------------------------

how would one go about fixing the spacing and stuff? basically im not going to show how many there are left for sale. i just want it to show up if i have more than 1 of the item. but how do i get the item name and price to show up?

to help facilitate the selling i would also like to use auction to buy the items i intend to sell at a lower price. so say i would buy nasrs at 65mil.

so the pattern for a new item being put up on auction is

Auction: A new item is being auctioned: <fullname,> level <level> at <gold amount> gold

so preferably i would be able to link the buy/sell prices with the item name along with the keywords so i could bid/dispense the items.

is there any way to setup some sort of table the triggers would pull the info from?
Reply with quote
xathil
Beginner


Joined: 19 Feb 2007
Posts: 10

PostPosted: Tue Feb 20, 2007 9:37 am   
 
curious.. is no one helping because
a) its too involved
b) i havent really explained the problem very well
c) theres no way to do this?
cause theres been 26 views? prolly 3 or 4 are mine.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Feb 20, 2007 10:12 am   
 
Well, as long as there are unique prices for each it shouldn't be a problem to set up a system that works something like this:

#trig {^(%w) gives you (*) coins.$} {give %db(@ShopItems,%replace(%2,",")) to %1}

@ShopItems is a database variable - the keys are the prices without commas and the values are the unique names of the items associated with that price.

You can add complications like checking stock:

#trig {^(%w) gives you (*) coins.$} {#var CurrentItem %db(@ShopItems,%replace(%2,","));#if (%db(@ShopQuantity,@CurrentItem)) {give @CurrentItem to %1} {say Sorry, I'm out of stock of @CurrentItem. Try again later.;give %2 coins to %1}}

@ShopQuantity is another database variable - keys are the unique names used in @ShopItems, values are the number in stock.

You can use %format to create strings of a certain length, but I've had a bugger of a time getting it to work. My preferred method is to do a dynamic-length repeated space:

#alias display {#say "|"%repeat(" ",78-%len(%-1))%-1"|"}

for example will create right-aligned text that's 80 characters wide. Your example is more complicated since you'd have to have two or three repeats to fill out the columns.

#alias display {#say "| "%-3%repeat(" ",46-%len(%-3))%repeat(" ",5-%len(%1))%1%repeat(" ",5-%len(%2))%2" |"}

is an alias in the format

DISPLAY PRICE QUANTITY ITEMNAME

that allows 46 characters for the item name, 5 for the price and 5 for the quantity. Of course if you had strings that long, there'd be no spaces padding between them, so it'd probably be better to allow 40 characters for the name, and 4 each for price and quantity. The string should always be 60 characters wide. Here's some example output:

Code:
| robe of the magi                                2.6    6 |
| a much longer item woohoo                      2525 2522 |
| another generic item                             14    2 |


You can quite easily edit the alias to check proper variables instead of the parameters if you prefer, or use that code in a loop without an alias.

Hope that helps.

EDIT: Oh, and your auction trigger could look something like this:

#trig {^Auction: A new item is being auctioned: ({big massive sword o doom|hammer of wrath|toothpick of spiky death}), level (%d) at (%d) gold} {}

This assumes that the gold number doesn't have commas. You can edit the list of items to contain whatever you're interested in, and then have the script check the price and so on with #if before printing or buying or whatever.
Reply with quote
xathil
Beginner


Joined: 19 Feb 2007
Posts: 10

PostPosted: Sat Feb 24, 2007 2:02 am   
 
so basically for each database record i need the fields fullname/display name, sellprice, buyprice, quantity, keywords.

does anyone know anything about the zmud database feature that would facilitate finding values in one record.

eg. someone gives me gold. the triggers above are slightly too simple as
a) what happens when someone gives me an amount of money that isnt listed in the database?
b) how do i make the database?
c) i probably want to make an alias to format each of the lines automatically given the parameters
eg formatoutput {|%1 (spaces) %2 (spaces) %3 | }
cause right now just looking at the thing its kinda beyond me as to what it is doing exactly.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net