ID:179469
 
i made a var called contents2, but when i have an item and i try to add another one i get:

runtime error: type mismatch
proc name: Get (/obj/Cards/Speed/verb/Get)
source file: world.dm,561
usr: Pillsverry (/mob/davis)
src: Speed (/obj/Cards/Speed)
call stack:
Speed (/obj/Cards/Speed): Get()

I have my get card like this:

obj/Cards/Speed
icon = 'black25.dmi'
icon_state = "Speed"
verb/Get()//This adds the get
set src in oview(0)
usr.contents2 += new/obj/Cards/Speed //This adds a speed card to usr.
del(src)


I`m guessing its because i made it a plain var, but is there a way to make a "list" var?
Pillsverry wrote:
I`m guessing its because i made it a plain var, but is there a way to make a "list" var?

Of course:
mob
var/list/contents2

New()
..()
contents2=list() // make sure you initialize the list

Lummox JR
In response to Lummox JR
Wow, I didnt know there was a such thing as list vars

this is the first time i`ve actualy known what i was doing worng, just not how to fix it.
Usualy i dont know what i`m doing wrong, next time I`ll dig deeper into the helpfile.

Thanks Lummox JR!

In response to Pillsverry
I have:

Lis()
var/card = input("Select a Modify Card to Slash.","DigiModify") in src.Cards
usr << "you used [card]!"

it never asks me what item i want to select, and tells the usr:
you used Speed!(or what ever is first in my list)

when i have this:

Lis()
var/card = input("Select a Modify Card to Slash.","DigiModify") in list(src.Cards)
usr << "you used [card]!"

it just tells the usr:
you used /list!

I dont know why i have so much trouble with lists
In response to Pillsverry
If you don't have more than one thing in a list it automaticly selects the one thing that's in it.
In response to Nadrew
I have 4 things in the list:
Speed
Speed
Speed
Wings
In response to Pillsverry
Pillsverry wrote:
I have 4 things in the list:
Speed
Speed
Speed
Wings

If you have all identically-named things in the list, even if you have more than one, the choice is made automatically. If Wings is in your list, then the input box should ask you to select from the two choices of Speed or Wings.
One possible reason this isn't working might be if Wings has the same name as Speed; a simple coding error could cause this. However, you should make sure that the list contains what you think it does.

Lummox JR
In response to Lummox JR
Typo was whats wrong

I`m worse than a newbie
In response to Pillsverry
Now I`m having trouble with it!

var/Card = input("Select a Card.","Card Select") in usr.Cards
switch(Card)
if ("Speed")
usr << "Speed"
if ("Wings")
usr << "Wings"

the things in the usr's list are objs, like /obj/cards/Speed
and it for some reason wont switch right, I`ve tried Replacing "Speed" with /obj/Cards/Speed and "[/obj/Cards/Speed]" but that doesnt work. I`m stumped