I am trying to create a shop ingame that players can buy and sell between themselves.
Function to allow players to choose items from their inventory and to set a price for it.
The shop to be open to all players to view and buy from it.
once sold/bought,,, the seller gains the money and the buyer gains the item.
any thoughts or direction on where to look would be helpful thanks.
ID:156291
Nov 17 2010, 4:02 pm
|
|
Nov 17 2010, 4:13 pm
|
|
I would definitely make use of lists: http://www.byond.com/ members/?command=reference&path=list#comment_1
|
In response to OrangeWeapons
|
|
Already started coding using list.
but this is a new area of coding for me so am not quite with it. this is what i have so far for a shop: var/shop = list() mob/verb Sell_Item() var/obj/equippable/what = input("Which item would you like to put up for sale?") in usr.contents var/price = input("How much would you like to sale this for?") as num if(price >= 1) what.saleprice = price else usr << "You must sell the item for at least one gold!" return usr.contents -= what shop += what the above code works as far as putting the item into another statpanel called shop.. My problem is that i cant test this by myself and i dont know how to make it so all players access the same shop panel,, so all items for sale appear in same panel and whichever item you click on will show the item in detail along with cost and option to buy,, then obviously the harder part of actually making the swap between players involved????? |
In response to Realitycheck
|
|
Realitycheck wrote:
Already started coding using list. Please enclose code in <DM></DM> tags. :) |
In response to Realitycheck
|
|
The most obvious problem I see in your code is the fact that you are using usr in proc. Ungh.
Here's a helpful article that explains where it is acceptable to use usr and where it is not. [Article] |