Ok, A few other coders who name remain unsaid and I have been trying to figure out just what the problem is with this code. We have come up with so many versions of it and none work. Some versions have no errors at all but dont subtract the gold, others have b=no errors but come up with a runtime during the buying. Heres the latest code, oh yah. And for every single version of it, the object does not appear in the users inventory. That has been our main problem. Currently the gold is subtracted, and all goes as planned, but no object appears. By the way, I am using an on_screen inventory code, if this code is needed please just ask. I am desperet to figure this out.
//The code
mob
Bartender
icon = 'bartender.dmi'
density = 1
verb
Talk_to_Bartender()
set src in oview(3)
switch(input("Hi, plz buy something","shopkeeper",text)in list("Boxy","Ball"))
if("Boxy")
usr.contents+=new/obj/boxy()
alert("You pay 50 gold for a boxy")
usr.gold-=50
if("Ball")
alert("You pay 20 gold for a ball")
usr.gold-=20
usr.contents+= new/obj/ball
..()
obj/boxy
icon = 'boxy.dmi'
obj/ball
icon = 'ball.dmi'
///////////////////////////////////////////////////////////
Other versions have used new/obj/"obj" (usr), none work, pleasehelp me. Any help at all is appretiated so much.
The Conjuror.
ID:261778
Jun 12 2003, 11:09 am (Edited on Jun 12 2003, 11:19 am)
|
|
Jun 12 2003, 3:21 pm
|
|
Nobody can help??? If you can't understand the question ill try to retype it in an easier way to read it, but really, nobody has any ideas???
|
In response to The Conjuror
|
|
Maybe you should wait a little more than 4 hours... Some people have lives you know.
|
In response to Foomer
|
|
i think that was rude, foomer
|
In response to Nave
|
|
And I think its rude when people bump their posts every few hours.
|
I agree with Foomer. Be quiet, Nave. =P
The correct way to create an object straight into the usr's inventory is, for example: <code>new/obj/ball(usr)</code> I'm guessing that the object is in the inventory; it's just not showing up because of the onscreen inventory thing. You need to trigger it to display the object. Try Move()ing it into the inventory, so that the inventory code picks it up and displays it. So instead of the usr.contents+=blahblah line: <code>var/obj/ball/B=new() B.Move(usr)</code> |
In response to Foomer
|
|
OMG, the only reason I bumped so soon is because I was in a rush, I was going away for a while and wanted to fix this before i left. Anyways, it was called off so ill try not to annoy anybody any longer, just forget it if you dont want to offer help. Thanks to you Crispy though, you have been a help, ill try it out, and see what shows up.
|