ID:167855
 
mob
Ramen_Guy
key = null
density = 1
icon = 'Assassin.dmi'
icon_state="Assassin"
verb
Buy()
set src. in view(1)
switch(alert("Hello! Would you like some ramen? It's only 50 gold!",,"Yes!!","No.(Mmm... Sounds good...)"))
if("Yes!!")
if(usr.Gold >= 50)
usr.Gold -= 50
src.R += 1
src.R = /obj/Ramen
usr.contents += src.R
src.R -= 1
else
usr << "You don't have enough gold."
if("No.(Mmm... Sounds good...)")
usr << "Ramen Guy: Okay, suit yourself."

this for some reaon says it works but it wont give me the item. It instead gives me an error.
It's acting just how it should be.
You just programed it wrong. =)

For one thing, I need to see the error to be able to pinpoint the error, but I believe I see it.

            Buy()
set src. in view(1)
switch(alert("Hello! Would you like some ramen? It's only 50 gold!",,"Yes!!","No.(Mmm... Sounds good...)"))
if("Yes!!")
if(usr.Gold >= 50)
usr.Gold -= 50
src.R += 1
src.R = /obj/Ramen
usr.contents += src.R
src.R -= 1

What is R?
The reason it is bringing back an error, is because there is only a PATH to /obj/Ramen, it has not yet been created.

To create it, change
src.R = /obj/Ramen
to
src.R=new/obj/Ramen


If you could tell me what R is, I could optomize (sp) this code for you too.

[EDIT: Now I see another problem.]
Why are you subtracting R-1 if R=/obj/Ramen?
It doesn't seem to serve any purpose.
If you want just to add the ramen to the contents just use:
usr.contents+=new/obj/Ramen
In response to Flame Sage
this is the error when i added what you told me.

runtime error: type mismatch
proc name: Buy (/mob/Ramen_Guy/verb/Buy)
usr: Xkirby2 (/mob)
src: Ramen Guy (/mob/Ramen_Guy)
call stack:
Ramen Guy (/mob/Ramen_Guy): Buy()

what does it mean?
In response to Xkirby2
It means you're attempting to subtract 1 from a type path, and that's pretty much senseless. So the program chokes - it doesn't know what to do. It's equivalent to, say, multiplying text strings:

a="b"*"c"


What's that supposed to mean? It means as much as

a=/obj/Ramen - 1
In response to Jp
I got it to work!!! Thanks!!
In response to Xkirby2
The R variable looks pointless to me. =/
Why add one and then subtract one?
In response to Flame Sage
it doesn't do that anymore. thats the messed up old code.
In response to Xkirby2
The code, itself, is not wrong. It is what programmers like to refer to as "logic error". The code is sytactically correct, but it produces an undesired or unexpected result.

Now you know.
In response to Arcanedragon_2004
I'm fairly sure adding a number to a type path and attempting to add a type path to a mob's contents couldn't be considered syntactically correct.