ID:178612
 
What I'm trying to do is make an equip verb that is in a pop up instead of attaching the verb to the individual items. Here is what I have, but I'm lost on how to call the specific attributes to the equip. Thank you for any help in advance.
---------
obj
weapons
icon = 'weapons.dmi'
//STICKS
cypressstick
icon_state = "cypressstick"
name = "Cypress Stick"
value = 5
strbonus = 2
defbonus = 0
aglbonus = 0
intbonus = 0
luckbonus = 0
saleable = 1
dropable = 1
classallow = list("Hero","Soldier","Fighter","Wizard","Pilgrim","Thief"," Merchant","Goof-Off","Sage","God")
genderallow = list("Male","Female")
itemtype = "Weapon"
mob
verb
masterequip()
var
o
inputequip
list/equipable = new()
inputequip = input("What would you like to equip?") in list ("Weapon","Armor","Helmet","Shield","Accessory","Cancel")
switch(inputequip)
if ("Cancel")
return ..()
if("Weapon")
for(o in usr.contents)
if(istype(o,/obj/weapons))
equipable += o
var/itemchoice = input("What would you like to equip?") in equipable
usr.strequip -= usr.wstr
usr.aglequip -= usr.wagl
usr.intequip -= usr.wint
usr.vitequip -= usr.wvit
usr.defequip -= usr.wdef
usr.luckequip -= usr.wluck


/* This is where I'm lost. I would like to assign the usr.wstr, usr.wagl...etc with the strbonus, aglbonus...etc from the object. Again, thank you for any help */
What if you made itemchoice an obj var? That is...
if("Weapon")
for(var/O in usr)
equipable += O
var/obj/weapon/itemchoice = input("What would you like to equip?")in equipable
usr.str += O.strbonus
usr.agi += O.agibonus
etc...

Since you definded itemchoice as the type /obj/weapon, it will have all the vars that an /obj/weapon should have. I also find it much more conveinient to use args instead of input boxes, because you can cancel it automatically and type it right in on the command line.
In response to WizDragon
Okay, I'm getting there, but now I'm getting a runtime error. I know where the problem is occuring, but I can't figure out how to fix it. I get a runtime error when I'm equipping and there isn't anything equipped (at the moment, haven't been able to test it on equipped). Here is the code and error.

-----------

mob
verb
masterequip()
var
inputequip
var/obj/o
var/obj/p
inputequip = input("What would you like to equip?") in list ("Weapon","Armor","Helmet","Shield","Accessory","Cancel")
switch(inputequip)
if ("Cancel")
return ..()
if("Weapon")
usr << "IN weapon"
var/list/weaponslist = new()
for(o in usr.contents)
usr << "in for"
if(istype(o,/obj/weapons))
weaponslist += o
weaponslist += "Cancel"
if(weaponslist.len == 1)
return ..()
else
var/obj/newweapon = input("What would you like to equip?") in weaponslist
var/obj/oldweapon
for(p in usr.contents)
if(istype(p,/obj/weapons))
if(p.suffix == "Equipped")
oldweapon = p
if(oldweapon == null)
oldweapon = /obj/weapons/none // <----- THIS IS WHERE THE ERROR IS OCCURING
usr.strequip -= oldweapon.strbonus
usr.aglequip -= oldweapon.aglbonus
usr.intequip -= oldweapon.intbonus
usr.vitequip -= oldweapon.vitbonus
usr.defequip -= oldweapon.defbonus
usr.luckequip -= oldweapon.luckbonus
p.suffix = null
usr << "To new"
usr.strequip -= newweapon.strbonus
usr.aglequip -= newweapon.aglbonus
usr.intequip -= newweapon.intbonus
usr.vitequip -= newweapon.vitbonus
usr.defequip -= newweapon.defbonus
usr.luckequip -= newweapon.luckbonus
newweapon.suffix = "Equipped"
obj
weapons
icon = 'weapons.dmi'
//STICKS
none
strbonus = 0
defbonus = 0
aglbonus = 0
intbonus = 0
vitbonus = 0
luckbonus = 0
cypressstick
icon_state = "cypressstick"
name = "Cypress Stick"
value = 5
strbonus = 2
defbonus = 0
aglbonus = 0
intbonus = 0
vitbonus = 0
luckbonus = 0
saleable = 1
dropable = 1
classallow = list("Hero","Soldier","Fighter","Wizard","Pilgrim","Thief"," Merchant","Goof-Off","Sage","God")
genderallow = list("Male","Female")
itemtype = "Weapon"
club
icon_state = "club"
name = "Club"
value = 30
strbonus = 7
defbonus = 0
aglbonus = 0
vitbonus = 0
luckbonus = 0
intbonus = 0
saleable = 1
dropable = 1
classallow = list("Hero","Soldier","Pilgrim","Merchant","Goof-Off","Sage" ,"God")
genderallow = list("Male","Female")
itemtype = "Weapon"
---------
IN weapon
in for
runtime error: Cannot read /obj/weapons/none (/obj/weapons/none).strbonus
verb name: masterequip (/mob/verb/masterequip)
usr: the newequip (/mob/god)
src: the newequip (/mob/god)
call stack:
the newequip (/mob/god): masterequip()
the newequip (/mob/god): VerbList()
In response to Rubius
Rubius wrote:
[snip]
oldweapon = /obj/weapons/none // <----- THIS IS WHERE THE ERROR IS OCCURING
[snip]
runtime error: Cannot read /obj/weapons/none (/obj/weapons/none).strbonus
[snip]

You are assigning oldweapon a type instead of an instance of the object you want. Assign oldweapon a new obj/weapons/none instead.
In response to ACWraith
Thank you. That helped a ton. It's working now.