ID:412096
 
(See the best response by DarkCampainger.)
Code:
mob/Admin
verb
Give_Jutsu(mob/M in world)
var/list/JutsuList
var/obj/Z = new/obj/SkillCards
Z+=JutsuList
var/A = input("Select a jutsu to give to [M]?") in JutsuList + list("Cancel")
usr<<"You gave [M], [A]"
M.contents+=A


Problem description:
the code works when compiled but when used in game on anything even mobs this is the responce.

runtime error: type mismatch: SkillCards (/obj/SkillCards) += null
proc name: Give Jutsu (/mob/Admin/verb/Give_Jutsu)
source file: Admin.dm,21
usr: Uchiha, Jbreezy (/mob/player)
src: Uchiha, Jbreezy (/mob/player)
call stack:
Uchiha, Jbreezy (/mob/player): Give Jutsu(Uchiha, Jbreezy (/mob/player))

Best response
You didn't initialize your list, so it's null. You're then trying to add that [null] list to Z, which is a /obj/SkillCards. Hence the SkillCards (/obj/SkillCards) += null mismatch error. It's basically saying it doesn't know how to add those two things (an object instance and null).

You need to initialize your list, and you want to add the object to the list, not add the list to the object.

If you have a lot of skills you want to list, the typesof() process may be useful to you.

Further, you can give an actual "cancel" button to your input by using input() as null|anything in JutsuList. If the user then presses the cancel button, the input will return null.
Thank you. Haha I'm feeling kind of slow right now because I woke up early to do this and I'm thinking to myself thats obvious. :D