var/list/WeaponNames
AAA=/obj/Weapons/Bronze_Dagger
AAB=/obj/Weapons/Bronze_Sword
AAC=/obj/Weapons/Bronze_Scimitar
mob/verb
Select_Weapon(msg as text)
if((msg) in list(WeaponNames))
usr.contents+=new(msg)
else
usr<<"That was not a valid weaponry code."
obj/Weapons
Bronze_Dagger
icon='Bronze_Dagger.dmi'
Bronze_Sword
icon='Bronze_Sword.dmi'
Bronze_Scimitar
icon='Bronze_Scimitar.dmi'
Problem description:
I am trying to make a system where if a certain text string is achieved/entered, then it runs through a list (in this case WeaponNames) and if the text string matches a variable in said list- then that item is created. I have attempted this, but it doesn't seem to be working in any way that I've tried it and was wondering if anyone could help with a possible solution?
new /obj/Weapons/Bronze_Sword(loc)
But since your type is a variable, we just replace the /obj/Weapons/Bronze_Sword bit with the variable of the path, which is WeaponNames[msg]. Try
new WeaponNames[msg](usr)