ID:261792
 
lol never been that good at codin but on all my switch input's I get no warnings or errors, but it says:

runtime error: type mismatch
proc name: Talk (/mob/Receptionist/verb/Talk)
usr: Platinum Goku (/mob)
src: Receptionist (/mob/Receptionist)
call stack:
Receptionist (/mob/Receptionist): Talk()

Same with any switch input; same error each char, need help :/

Snippet:
    ShopKeeper
icon = 'icons/mobs.dmi'
icon_state = "male"
name = "Shopkeeper"
verb
Purchase()
set src in oview(3)
set category="Communication"
switch(input("Hello! What do you wish to buy?", "Shopkeeper",text) in list ("Glasses","Trench Coat","Contact Lenses", "Cape", "Hat", "Pants", "Scouter", "Shoes", "Shorts", "Top", "Boots"))
if("Glasses")
if(usr.zenni<=149)
usr<<"<b>You need 150 zenni!"
if(usr.zenni>=150)
usr<<"<b>You get a pair of Sunglasses!"
var/obj/O=new/obj/glasses
usr.contents+=O
var/new_rgb = F_Color_Selector.Get_Color(src)
var/icon/T = new('icons/glasses.dmi')
T.Blend(new_rgb)
usr.zenni-=150
Well the problem is in the mob Receptionist not in your shopkeeper maybe showing that coding would help.
That is also a ridiculously long-winded way of doing it.

I think you can do them with associative lists, and having a 'price' var on the items.
In response to Koolguy900095
lol it is also in my shopkeeper:

runtime error: type mismatch
proc name: Purchase (/mob/ShopKeeper/verb/Purchase)
usr: Platinum Goku (/mob)
src: Shopkeeper (/mob/ShopKeeper)
call stack:
Shopkeeper (/mob/ShopKeeper): Purchase()

Whenever I try to buy something.
In response to Platinum Goku
In the 'Preferences' menu, check the debug box and try to get that error message again. Then post the error, it'll contain a line number which is more useful than guesswork.
In response to Hazman
mob/shopkeeper/Shopkeeper
var/list/selling

New()
..()
selling=list((new /obj/glasses)=150,(new /obj/trench)=150,(new /obj/boots)=800,(new /obj/scouter)=2000,(new /obj/cape)=1500,(new /obj/contacts)=50,(new /obj/hat)=240,(new /obj/shorts)=400,(new /obj/pants)=750,(new /obj/top)=750,(new /obj/shoes)=300,(new /obj/trench)=8000,(new /obj/bikini)=300,(new /obj/skirt)=500,(new /obj/dress)=2000)

verb/buy()
set src in oview(1)
var/list/choices=new
var/obj/O
for(O in selling)
choices["\A [O]: [selling[O]]"]=O
var/item=input(usr,"What do you want to buy?","Buy","Nothing Thanks") in choices+"Nothing Thanks"
if(item=="Nothing Thanks") return
O=choices[item]
var/price=selling[O]
if(usr.zenni < price)
usr << "You don't have enough to pay for \a [O]!"
return
usr.zenni-=price
O=new O.type
O.loc=usr
usr << "You pay [price] Zenni for \a [O]."


Tried that, gives me an illiegal operation error when trying to compile -,-'

Any other ways I could use the original code? EVERY list I do gives me an error in DS
In response to Hazman
Where's the debug box? I can't see no debug box o.o
In response to Platinum Goku
Ah , Meh can see the debuggy box now, here's da error:

runtime error: type mismatch
proc name: Purchase (/mob/ShopKeeper/verb/Purchase)
source file: Mobs.dm,75
usr: Platinum Goku (/mob)
src: Shopkeeper (/mob/ShopKeeper)
call stack:
Shopkeeper (/mob/ShopKeeper): Purchase()

Here's lines 73-76:
                    if("Glasses")
if(usr.zenni<=149)
usr<<"<b>You need 150 zenni!"
if(usr.zenni>=150)
In response to Platinum Goku
Also my little Receptionist:
    Receptionist
icon = 'icons/mobs.dmi'
icon_state = "female"
verb
Talk()
set src in oview(3)
set category = "Social & Communicative"
switch(input("Hello, we are currently recruiting for Capsule Corp, do you want to join us?","Join?", text) in list ("Yes Please.", "No Thankyou."))
if("Yes Please.")
usr.joinedcc = "1"
usr.zenni += 5000
usr.contents += new/obj/cclogo
usr << "<b><font color=red> There you go, An official Patch and 5000 Zenni, Thanks for joining capsule corps."

else
usr << "<b><font color=red> Ooooh That's OK *Smiles at you* See You Later *Continues with her paperwork*"


Gives me the error:

runtime error: type mismatch
proc name: Talk (/mob/Receptionist/verb/Talk)
source file: Mobs.dm,53
usr: Platinum Goku (/mob)
src: Receptionist (/mob/Receptionist)
call stack:
Receptionist (/mob/Receptionist): Talk()

If I say "Yes Please" when she asks me.

Ill tell you line 52-54 is:

                    if("Yes Please.")
usr.joinedcc = "1"
usr.zenni += 5000
In response to Platinum Goku
well i dont know how to fix your bugs but heres an alternate code.. it might help.

mob/Shopkeeper
verb/Purchase()
switch(input("","Purchase",text) in list ("Sunglasses","Cancel"))
if("Sunglasses")

if(usr.zenni <= 24)
usr<< "not enough!"


else

usr.contents += new /obj/Sunglasses
usr.zenni -= 25
usr<< "thank you!"
if("Cancel")
return..()
//define sunglasses somewhere else like this

obj/Sunglasses
//code for sunglasses
i hope that helps :)
In response to Siefer
heh well I fixed it now :P I defined zenni as text somewhere stupidly lol