ID:262413
 
Code:
mob
Merchant
icon = 'Merchant.dmi'
verb
Sell(obj/O in usr.contents)
set src in oview(1)
switch(input("Are you sure you want to sell the [O] for [O.price]?")in list("Yes","No"))
if("Yes")
usr.money += O.price
del(O)
if("No")
usr<<"Ok"


Problem description:
Ok how do you traform sell into a click. And everthing must work the same.
mob/Merchant
Click()
//Since I don't want to 'give' the code away
//you can figure this part out on your own
In response to Crashed
lol i think you should give it away cause i'll never get it
In response to Sayian Hunter
mob
Merchant
icon = 'Merchant.dmi'
Click(obj/O in usr.contents)
switch(input("Are you sure you want to sell the [O] for [O.price]?")in list("Yes","No"))
if("Yes")
usr.money += O.price
del(O)
if("No")
usr<<"Ok"


Something of this nature.
To transfer this you have to know the differences between an object verb (that's wht I call verbs that don't belong to the players themselves) and atom.Click(). The first thing is that arguments in object verbs are specified by the player using it, while in atom.Click() the argument will be the location of the atom. To combat this we can just use an input inside Click(). The second thing is settings, most settings only work in verbs, and the src setting is one of them. We can use get_dist() to make this only accessible from players one tile away, though.

mob
Merchant
icon = 'Merchant.dmi'
Click()
if(get_dist(src, usr) == 1)
var/obj/O = input("Pick one") as null|anything in usr.contents
if(O)
switch(input("Are you sure you want to sell the [O] for [O.price]?")in list("Yes","No"))
if("Yes")
usr.money += O.price
del(O)
if("No")
usr<<"Ok"


Please note that I added a way for players to cancel out of it if they changed their mind. If you specifically didn't want this behavior, you can remove the null| from the input. You should leave the check for O, though, because anything could happen to one of the objects while waiting for a response from the player.
Be aware that most of the bits of code that have been passed to you around here only work if usr is the person doing the selling, and that will be true in the case of Click(), as long as you havn't messed too much with client.Click()