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."
ID:261393
Feb 18 2002, 8:51 pm
|
|
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.
|
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() Mobs.dm:236:error::expected "if" or "else" |
In response to Little Sally
|
|
Little Sally wrote:
IT works ok but, Buy() 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() 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 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! ;)
|
mob/bartender
verb/Buy()
set src in view()
//continue with verb