This time I'm trying to use alerts for my shopkeepers, cutting some 10+- pages woth of code into less than 2. But I'm not really sure if this is the best way to do it or not.
If you would be so kind as to help me turn this.
Trading_Post
icon_state = "item"
DblClick()
var
weapons = input("What can i get for you today?","Items",) in list("Tonic","Fish Oil","Nothing")
switch(weapons)
if("Tonic")
var
confirm = input("Tonic, thats 30 gil please.","Confirmation",) in list("Yes","No")
switch(confirm)
if("Yes")
if(usr.gil<30)
usr << "Not enough gil."
else
usr.gil -= 30
usr.contents += new/obj/Item/Healing/Tonic
usr << "Enjoy your Tonic."
if("No")
usr << "Sorry thank you anyway."
if("Fish Oil")
var
confirm = input("Fish Oil, thats 60 gil please.","Confirmation",) in list("Yes","No")
switch(confirm)
if("Yes")
if(usr.gil<60)
usr << "Not enough gil."
else
usr.gil -= 60
usr.contents += new/obj/Item/Healing/Fish_Oil
usr << "Enjoy your Fish Oil."
if("No")
usr << "Sorry thank you anyway."
if("Nothing")
return
..()
Into something close to this.
verb
Talk(mob/npc/n as mob in oview(2))
if(istype(n,/mob/npc/shop))
switch(alert("[n.shop]",,"buy","sell"))
if("buy")
var
a = input("What would you like?","Buying",) in n.stock
number = input("How many?","Buying") as num
var
value = a.value
var
total = (value*number)
alert("you want [number] [name](s) for [total] gil?",,"yes","no")
if("sell")
var
item = input("What would you like to sell?","Selling",) in usr.contents
if(istype(n,/mob/npc/town))
usr << n.speech
Or you could point out another way entirly. (How you spell that?) Or just call me a stupid n00b. But I sure would appriciate your help and so would the players.
Thank you.