ID:144759
 
Code:
mob
proc
Box_Office2(mob/M in world)
var/list/L = new
L += "Ticket"
L += "Sign Up"
L += "Forget it"
var/answer = input("Hello what would you like to do? Just a note: Tickets cost 5$[M]?") in L
switch(answer)
if("Ticket")
M << "You have purchased a seating ticket, thank you"
if(usr.currency)
usr.currency=0
usr.currency=-0
M << "Sorry you do not have enough money"
if(usr.currency)
usr.currency=1
usr.currency=-5
M << "Thank You, heres your ticket"
usr.contents+=/obj/Ticket
if("Sign Up")
src << "You have chosen to participate in the budokai"
usr.contents+=/obj/Application
if("Forget it")
src << "You've changed your mind"
return


Ok here's the deal, the problem I have is now a runtime error, due to this part of the code I'm sure


 M << "You have purchased a seating ticket, thank you"
if(usr.currency)
usr.currency=0
usr.currency=-0
M << "Sorry you do not have enough money"
if(usr.currency)
usr.currency=1
usr.currency=-5
M << "Thank You, heres your ticket"
usr.contents+=/obj/Ticket


I need it to basicly deduct money from the currency stat, and also if the money is available which is 5$ , put it into the Inventory. I tried some If functions, like "If(usr.currency)" but I don't think it's going to work.

I basicly need it for just the ticket function . But I've also tried to make it so if I don't have the money it tells me I don't have anough, this also does not work, can somone help me?

What's the runtime error? Try replacing usr.contents+=/obj/Ticket with new/obj/Ticket(usr)
In response to Hazman
I don't think that's it, but if we forget the runtime error for now, I think It's just how it's set out, if we try focus on what I want the code to do if there's any errors then we can find out why..

But for now do you know if my code is wrong for what I want it to do??
I think the problem lies within these do snippets of code.

                       usr.currency=0
usr.currency=-0

and
                       usr.currency=1
usr.currency=-5

They both dont really make any sense...especially the last one.Why would you want it to make the users currency 0 and then subtract 5?
This should work.
mob
proc
Box_Office2(mob/M in world)
var/list/L = new
L += "Ticket"
L += "Sign Up"
L += "Forget it"
var/answer = input("Hello what would you like to do? Just a note: Tickets cost 5$[M]?") in L
switch(answer)
if("Ticket")
if(usr.currency<=5)
usr.currency-=5
usr.contents+=/obj/Ticket
else
usr<<"Not enough money to buy one!"
if("Sign Up")
src << "You have chosen to participate in the budokai"
usr.contents+=/obj/Application
if("Forget it")
src << "You've changed your mind"
return

But, why add to the list L everytime this proc is called, why not make the list consist of those things, and not add them every time.