ID:261393
 
Ill post the code of how I have is set up and see if anyone kind find the problem. It has no errors but will not work in world.

Bartender
icon = 'Bartender.dmi'
name = "Bartender"
verb //Testing
Buy(mob/M as mob in oview(2))
usr << "[src] says: Welcome to my bar. How may I help you?"
usr = input ("Choose one") in list ("Wine","Nevermind")
Gossip()
usr << "[src] says: I just recently opened this bar and business has been slow.<p>Your one of my few customers."
You need to 'set src', for example:

mob/bartender
verb/Buy()
set src in view()
//continue with verb
I'll assume you want the player to Buy from the bartender. The way you have it the Bartender is the src and the usr of the verb, the player doesn't have access to it. In order to give access to the player you have to use this:
Bartender
verb
Buy()
set src in oview(2)

This will give the verb to the player when its within two spaces of the bartender. Then when it is clicked the Bartender will become the src and the player will become the usr.
In response to Foomer
Thanks guys it worked ;) Now could anyone hlep me with buy verb?
In response to Little Sally
It just depends on how you want to handle it. Here's a simple way to do it:

Buy()
var/item = input("What would you like to buy?","Buy") in list("Wine","Nevermind")
switch(item)
if("Wine") new /obj/Wine(usr)
if("Nevermind") usr << "Whatever"

This will create a wine object in the usr's contents. You might want to add money in somewhere but that's one way to do it.
In response to English
IT works ok but,

Buy()
set src in oview(2)
var/item = input("What would you like to buy?") in list ("Wine","Soup","Nevermind")
switch(item)
if("Wine") new /obj/Drink/Wine(usr)
if("Soup") new /obj/Food/Soup(usr)
usr << "You buy [src]."


Mobs.dm:236:error::expected "if" or "else"
In response to Little Sally
Little Sally wrote:
IT works ok but,

Buy()
> set src in oview(2)
> var/item = input("What would you like to buy?") in list ("Wine","Soup","Nevermind")
> switch(item)
> if("Wine") new /obj/Drink/Wine(usr)
> if("Soup") new /obj/Food/Soup(usr)
> usr << "You buy [src]."

Mobs.dm:236:error::expected "if" or "else"


You didn't move the stuff handled by the first if() under the actual if() and indent it too.
In response to Nadrew
I did it like this but still doesn't work.


Buy()
set src in oview(2)
var/item = input("What would you like to buy?") in list ("Wine","Soup","Nevermind")
switch(item)
if("Wine") new /obj/Drink/Wine(usr)
usr << "You buy [src]."
if("Soup") new /obj/Food/Soup(usr)
usr << "You buy [src]."


Mobs.dm:235:error::expected "if" or "else"
Mobs.dm:236:error:if :expected code block
Mobs.dm:236:error::expected "if" or "else"
Mobs.dm:236:"Soup":warning: statement has no effect
Mobs.dm:237::warning: unused label

In response to Little Sally
Ok, I can't figure out what you are trying to say. I tryed indenting but it didnt work, here is the whole of my buy code.

verb //Testing
Buy()
set src in oview(2)
var/item = input("What would you like to buy?") in list ("Wine","Soup","Nevermind")
if(usr.gold >= 1)
switch(item)
if("Wine") new /obj/Drink/Wine(usr)
usr.gold -= 1
usr << "You buy [src]."
if("Soup") new /obj/Food/Soup(usr)
usr.gold -= 1
usr << "You buy [src]."
else
usr << "You do not have enough gold."


Mobs.dm:236:error::expected "if" or "else"
Mobs.dm:238:error:if :expected code block
Mobs.dm:238:error::expected "if" or "else"
Mobs.dm:238:"Soup":warning: statement has no effect
Mobs.dm:239::warning: unused label
In response to Little Sally
You need to treat those if statments like you would any other if statments. You can only put the statment to be executed to the left of the if, if there is only one statment to execute. Change it to this:

if(something)
new /obj/something(usr)
usr << "you bought something"
In response to Little Sally
I would highly recommend taking a look at Spuzzum's shopkeeper demo.

-James
In response to English
Thank you if worked! I even figured out how to make it cost money! ;)