ID:143534
 
Basically I have a list that suppose to hold nothing but the following object (class? Not sure on correct term with BYOND).

AggroObj
var
mob/player = null
aggro = 0
proc
ChangePlayer(var/mob/M)
player = M
AddAggro(var/num)
aggro += num
getName()
if(player)
return player.name
else
return "null"
getPlayer()
return player
getAggro()
return aggro
New(var/mob/M)
player = M


Now I want to be able to access these procs directly from the list, like so...

src.EnemyList[1].getPlayer()


The code above gives me an error and I assume it's because of type casting issues, it doesn't know the list can access those procs.

Well, I've defined EnemyList as so,

mob
enemies
var
AggroObj/list/EnemyList = list()


I've tried doing other combinations as well.

Thanks ahead of time.


*EDIT*

I'd still like to know if I can do it from the list directly but something along the lines seems to work.

var/AggroObj/A = src.EnemyList[1]
A.getPlayer()


Again, would still like to know if the list is defined correctly, if I can skip the middle man and make the call directly from the list.
The way DM syntax works, you can't get procedures 'directly' from a list like that, I'm afraid.

You have to do the get-thing-into-typecasted-variable thing.
In response to Jp
That's what I was afraid of, thanks.