ID:270155
 
how do i make a verb that makes it so you can sell things?that also gives a icon.like this?

mob
verb
Merchant()
icon = 'icon.dmi'
statpanel("Market")



mob
verb
Add_Item()



//i dont know how to do the rest.
......help.....
In response to Dragon_fire6653
Be a _bit_ more informative plewase, such as: You want the icon to show up in a browser, stat panel , etc.
In response to GhostAnime
i wanted it to change the players icon..but now that i rethink it i want it to be a verb only if you by a Merchant Stand and when the verb is clicked it brings up a list on the browser that has two verbs:to add an item to market or to take an idea off the market.Also when clicking the verb the player cannot move because the player must stay in the stand unless the player clicks the Merchant verb again taking the player out of the stand and back on to land where he can walk and take down whatever was in browser giving all items in the stand back to the player.i dont know how to do this and when a player enters a stand it would say to the world:[usr.name] has set up a shop!
and when leaving stand it would say to the world:[usr.name] has closed his shop!
i dont know how to add browser so this is what i know.



or a merchant system like the one above except you can create your own stand and your icon changes to the stand when clicked and when clicked again it changes back to players former icon.







In response to Dragon_fire6653
:(
In response to Dragon_fire6653
i only know bits and pieces of how to do it.

1.the first way.
obj
Stand
icon = 'stand.dmi'
verb
Merchant()
set src in oview(1)
//then the browser and taking players movement away and putting player as a under lay on Stand which i dunno how to do.



//2.the second way


mob
verb
Merchant()
icon = 'Stand.dmi'//makes the players icon this
//then the rest is the browser
In response to Dragon_fire6653
c'mon!please help me!
In response to Dragon_fire6653
Quit begging and look up some demos on how selling works. Then edit them at your leisure.

DO NOT COPY AND PASTE THEM OR ANY OTHER CODE YOU SEE!!! THAT IS THE MOST NOOBIEST MISTAKE YOU CAN DO!!!!!
In response to Pyro_dragons
yea i know :|
In response to Dragon_fire6653
Actually, the reason you hear most people say "Do not copy and paste" is not because it's the "noobiest" thing you can do, which makes no sense, but because it won't work. That is, copied straight from the forum anyway. But by no means does that justify copy and paste.

Demos are for study, to realize how you can do something, or to simply learn. Libraries are there for out-of-the-box use. Just include them and they should work.

This is another thing, Pyro. He has no clue how to do this, and their aren't any demos on statpanel selling. You'll want this like Seika, I suppose? You stand next to a merchant and receive a statpanel full of items for sale that you can click to buy? (I think)

If that be the case, you'll want to make a statpanel() that is filtered out until you reach the distance of a merchant.

mob/Stat()
..()
if(locate(/mob/Merchant) in oview(1))
var/mob/Merchant/M=locate(/mob/Merchant) in oview(1)
statpanel("Selling")
stat(M.contents)


The Merchant must have items in his inventory, and you have to make a Click() procedure based on a variable for the objects. Or make an entirely new set of objects, but why do that? Really makes no difference. Actually, to make an entire new set of objects based on existing ones would be stupid. lololbbq sauce. It makes you use more DMB space, maybe even RSC space, I dunno how RSC works. If it stores one file for all, or a seperate file for every object.

Anyway, the Click() procedure could be something based on client, type, or variable. The variable would change to null if it is not within a merchant, and if the variable is true when clicked, execute the selling procedure.
obj/Cherry
Click()
if(!ismob(locate("\ref[src.loc]")) return 0
//execute selling


That one checks for type. Now, we try the client thing. Merchants won't have clients, will they? If so, this won't work. Of coarse, it's based on the previous post. O.loc will return as a mob if it is within a mob's contents, but a turf if it's not. Or null if it's not on the map. Using locate(srclocreference) will give use a mob or turf.

obj/Cherry
Click()
var/mob/M=src.loc
if(!ismob(M) || !M.client) return 0
//execute selling


And of coarse, variable based. Very easy. Just a little extra work.

obj/Cherry
var/inStore //When placing objects in a merchant, please set this variable to true
Click()
if(!inStore) return 0
//execute selling
//if sold, place this
inStore=null


If you don't know how to sell items, though, I suggest that you read up on some demos. It's very simply, but often long.

In response to CaptFalcon33035
what you have helped me with is not exactly what i was asking for.I wanted to know how to make it so when going by a Merchant Stand i get the verb to set up a shop and display something in the browser that shows the items that have been added to the players shop with two verbs on the browser:Add Item and Remove item that adds or removes items that the player wants to sell.Or a verb like that except it changes players icon and a merchant stand isnt needed.I did look at a few browser demos and i know a little more of how to do this.But i dont know how to add the verbs to the browser that add and remove items from the browser and when closing shop all items added that had not been bought by another player return to the player who had opened the shop.
obj
Merchant_Stand
icon = 'Stand.dmi'
verb
Set_Up_Shop()
set src in oview(1)
display("Items for Sell")//for the browser
//what do i put here for the verbs to add or remove items to sell and the coding that allows players nearby the Stand that the player is selling at to look at the things being sold through the browser and the verb to buy it for the certain amount of money that the player who is selling it wants to sell at.Or this.

mob
verb
Set_Up_Shop()
display("Items For Sell")
//but where do i put the browser verbs and the input that should come up to ask the player how much he wants to put sell value at for something he adds to shop when clicking the Browser verb for adding items.






In response to Dragon_fire6653
You need to use browse() and links for Add and Remove item. Then intercept them with client/Topic().
In response to CaptFalcon33035
Aside from checking for that in the mob's statpanel you could use area/Entered().
In response to Artemio
I think this may be a bit advance for you to be doing at the moment. You should create lesser games. I would give you the code for this system if it weren't so long. Oh and if anyone else wants to give code I will tell you what he wants in english.

Basically he wants it so if you click on a empty shop stall you start operating that stall, so other players can buy your items exc. You also have some verbs which you can do to add things and remove things too and from the store respectivly. Also all buying and selling will take place in a popup browser window.

If I have missed anything please tell me or if im incorrect do likewise.
In response to CaptFalcon33035
but i dont know how to make links.And if i did i still wouldnt know what to put for the verb.
In response to Dragon_fire6653
ADT_CLONE wrote> I think this may be a bit advance for you to be doing at the moment.

I agree with ADT_CLONE. If you dont know how to do a Topic(), you should stay away from the browser() proc completely. You may want to just do all of this in a verb panel.
In response to Dark Krow
I think he should stray this way, actually. He can do it with our help. Whatever helps him most.

If this is what he wants, he should be able to do it. We can start by teaching him how to use atom.Topic() and client.Topic(). It's very simple. I will build on a Whisper verb to help teach you.

atom.Topic() will be called when client.Topic() sends it there. It recognizes which atom to send it to by it's third argument, hsrc. hrsc is always src in a text link, though. Here's an example link.

mob/verb/Whisper(mob/M in view())
var/i=input("What would you like to say?)as null|text
if(!i) return
M<<"<a href=?src=\ref[M];action=whisper;whisper=\ref[src]>[src.name]</a>: [i]"


Because src is a mob, and I'm using a text macro to send the reference number of a mob (\ref[M]) to client.Topic(), this will be handled by atom.Topic() or more specifically, mob.Topic().

I use ? in the link so that BYOND knows to handle it, rather than sending a link to some website. This can also be accomplished by using or any of the others that I don't use much. I don't even know the reasons behind which one to use, but I've been told.

Finally, I made 2 arguments within the link. One states that the variable action is whsiper, and the variable whisper is a reference to the person that is whispering. I'll show you how to handle this next.

mob/Topic(href,list[])
switch(list["action"])
if("whisper")
var/mob/M=locate(list["whisper"]) //dereference the mob
if(!M) return
var/i=input("What would you like to say?")as null|text
if(!i) return
M<<"<a href=?src=\ref[M];action=whsiper;whisper=ref[usr]>[usr.name]</a>: [i]"
else ..()


However, that was just to show that you can send two arguments, or even more, at once by link, and of coarse, to dereference mobs. You can simply remove the whisper argument and replace anywhere you see M in mob.Topic() with src. And then remove var/mob/M=locate(list["whisper"]) //dereference the mob.