Players
parent_type = /mob
var
list
Inventory = list()
Equipment = list()
verb
//verbs defined in type /Players
//////////////////////////////////
Obtainable_Item
parent_type = /obj
var
Equipped = 0
DblClick(location, src_control, over_control)
if(src_control == "Inventory_Grid")
Equip()
proc
Equip()
if(!Equipped)
Equipped = 1
usr.Inventory.Remove(src)
usr.Equipment.Add(src)
else if(Equipped)
Equipped = 0
usr.Inventory.Add(src)
usr.Equipment.Remove(src)
Problem description:
Alright, so I'm trying to have list of items that are in Inventory and list of items in Equipment, and place them in two separate grids. But when I try to compile the code, I get the following error:
Code\Mouse.dm:67:error: usr.Inventory.Add: undefined var
Code\Mouse.dm:67:error: usr.Equipment.Add: undefined var
I obviously have it defined. But apparently it only looks into /mob 's var instead of what I want it to look at. How would I fix this? Surely I can just add the var to /mob, but that'll defeat the purpose of making /Player. loc:Inventory.Add(src) doesn't work that well either. If someone knows a better way to coding this, can you explain the why it does such thing and what I can do to fix this?
P.S. I don't want a code for this, I just want to understand this whole var thingie mingiy.
var/Player/p = usr
Then call it:
On a side note, use tabs instead of spaces. Your code is horrible in terms of readability.