ID:149691
 
Heres the code snippit:
                    Choice = input("Avaiable Weapons:","Writhall's Weapon Shop") in list("Newbie Sword for 50GOLD","Paper Blade for 500GOLD","Duo Sword for 1100GOLD","Gleaming Sword for 1900GOLD","Exit")
usr << "testing"


When that is ran, I get an output like so:
untime error: type mismatch
proc name: Entered (/area/Towns/Writhall/WeaponShop_1_Counter/Entered)
source file: RZShops.dm,200
usr: Dreq (/mob/player)
src: WeaponShop 1 Counter (/area/Towns/Writhall/WeaponShop_1_Counter)
call stack:
WeaponShop 1 Counter (/area/Towns/Writhall/WeaponShop_1_Counter): Entered(Dreq (/mob/player), Wooden2b (4,40,2) (/turf/TownSets/Wooden2b))
testing


Any idea at all?

Edit:
btw, that error pops up after select an item from the list.
Dreq wrote:
Heres the code snippit:
                    Choice = input("Avaiable Weapons:","Writhall's Weapon Shop") in list("Newbie Sword for 50GOLD","Paper Blade for 500GOLD","Duo Sword for 1100GOLD","Gleaming Sword for 1900GOLD","Exit")
> usr << "testing"
>


I am pretty sure when you have an input list you need a switch like this:

                    var/Choice = input("Avaiable Weapons:","Writhall's Weapon Shop") in list("Newbie Sword for 50GOLD","Paper Blade for 500GOLD","Duo Sword for 1100GOLD","Gleaming Sword for 1900GOLD","Exit")
switch(Choice)
usr << "testing"


that should work...
In response to Canar
Canar wrote:
I am pretty sure when you have an input list you need a switch like this:

No, it's not necessary, and an empty switch() statement will do nothing.

Lummox JR
You didn't show enough of the code to diagnose the error; the lines you posted appear to be clean. The full proc would be helpful in determining what's wrong.

My best guess offhand is that Choice is declared as a var of some other type, like var/obj/Choice, and your assignment from the result of input() is messing it up. However, for all I know the error is occurring later (you didn't actually say which line is line 200, where the error occurs).

Lummox JR
Dreq wrote:
Heres the code snippit:
Choice = input("Avaiable Weapons:","Writhall's Weapon Shop") in list("Newbie Sword for 50GOLD","Paper Blade for 500GOLD","Duo Sword for 1100GOLD","Gleaming Sword for 1900GOLD","Exit")
>usr << "testing"
>

When that is ran, I get an output like so:
untime error: type mismatch
> proc name: Entered (/area/Towns/Writhall/WeaponShop_1_Counter/Entered)
> source file: RZShops.dm,200
> usr: Dreq (/mob/player)
> src: WeaponShop 1 Counter (/area/Towns/Writhall/WeaponShop_1_Counter)
> call stack:
> WeaponShop 1 Counter (/area/Towns/Writhall/WeaponShop_1_Counter): Entered(Dreq (/mob/player), Wooden2b (4,40,2) (/turf/TownSets/Wooden2b))
> testing

Any idea at all?

Edit:
btw, that error pops up after select an item from the list.

From the reference:
If no default value is specified and null is allowed by the input type, that will be returned. Otherwise, an error will result, crashing the proc that called input().


How did you define the variable "choice?" For safety, you may want to supply a default value in your input. "Exit" might make sense.
In response to Lummox JR
oh yeah but he was just testing if he defined it like he was going too thats basically all you need right?
In response to Canar
The answer is no.

A switch statement is not required after an input statement.
In response to Skysaw
ok, there must be millions of ways to do everything in byond. but for the shop code he was trying to make he CAN use a switch().
In response to Canar
Canar wrote:
ok, there must be millions of ways to do everything in byond. but for the shop code he was trying to make he CAN use a switch().

He can, and later in his code probably did (the usr << "Testing" was obviously a debug message) because of the way he set up the input() list. But still, an empty switch() will do no good, nor is it necessary. switch() is just a convenient way of doing various things based on the value of a variable.

Lummox JR
In response to Canar
Canar wrote:
ok, there must be millions of ways to do everything in byond. but for the shop code he was trying to make he CAN use a switch().

Of course he can.

I was responding to your statement:
"I am pretty sure when you have an input list you need a switch..."
In response to Skysaw
Well the funny thing is, that code, like much of my other code, has worked until a few betas ago... And nothing is seeming to work, yes choice is a var. And no, it will not be an object because the input is a list of strings, not objects. This is what I get for using a pre-done system... I guess I'll find another, much slower and tedious way of making a shop... (mental note: Don't use list inputs, they don't work worth a crap)
In response to Dreq
Dreq wrote:
Well the funny thing is, that code, like much of my other code, has worked until a few betas ago... And nothing is seeming to work, yes choice is a var.

Unless you have left your code unedited and suddenly a new bug pops up, I doubt your trouble is a BYOND bug. If you truly think that is the case, you can always go back to an earlier version to see if it is a beta bug. If you have made changes in your code and get errors, you can not assume it is a beta error.

And no, it will not be an object because the input is a list of strings, not objects. This is what I get for using a pre-done system... I guess I'll find another, much slower and tedious way of making a shop... (mental note: Don't use list inputs, they don't work worth a crap)

I have never had a problem with input lists. You should change your mental note to "Read Lummox JR's posts carefully until I understand them." His posts are very insightful.

Obviously Choice is going to recieve a text string from the input in your snippet. Lummox JR said nothing to dispute that. The trouble is likely that you declared Choice as a particular type of variable that is not a text string. If you try to stick text from your input in a var that is not configured to recieve text, you get a type mismatch error.

Examine your code and find where you declare Choice. It should be a basic var (var/Choice), but you have probably defined it as a particular type just as Lummox JR already noted.

In response to Shadowdarke
Nah choice is a var, not assigned as a mob var or anything, just a plain var. And I haven't messed with the shops for a few betas at all, then all of a sudden, when i went back to RZ (After upgrading), nothing worked! Gah BYOND makes me want to touch the thingy in the back of my throat most of the time...
In response to Dreq
In that case, could you show us a little more code around that block and emphasize which one is line 200?

If your code breaks after a BYOND update and you haven't edited the file, you should report it immediately so that Dantom can fix it.
In response to Shadowdarke
Nah aparently everything I send them ends up being something I did, so I won't waist their time :) (FYI that part about me touching the thingy in the back of my throat IS a joke, not an insult ;P)
In response to Dreq
Dreq wrote:
(FYI that part about me touching the thingy in the back of my throat IS a joke, not an insult ;P)

Good. :) That wasn't clear when I read it.