ID:156541
 
This feels like an embarrassingly obvious question, but how would I go about getting direct references to an object in a specific position in an array? To give you an idea of what I'm doing;
for(var/i=0, i <= 5, i++)
numbersomething += Objlist[i].something // this adds a global or just a mob's variable by the object's "something" var. The object is #i in the array.



I apologize if this is too vague, but hopefully the basic question gets through.
Duelmaster409 wrote:
This feels like an embarrassingly obvious question, but how would I go about getting direct references to an object in a specific position in an array? To give you an idea of what I'm doing;
> for(var/i=0, i<=5, i++)
> numbersomething += Objlist[i].something // this adds a global or just a mob's variable by the object's "something" var. The object is #i in the array.
>

I apologize if this is too vague, but hopefully the basic question gets through.

    for(var/i=0,i<=5,i++)
var/obj/O=Objlist[i]
if(isobj(O))
numbersomething+=O.something //this adds a global or just a mob's variable by the object's "something" var. The object is #i in the array.
In response to Teh Governator
Thanks a ton for the quick reply! I KNEW it was that simple!
In response to Duelmaster409
Basically typecast. It would be nice to be able to use at least the : operator after list[], but lists are too versatile I suppose. Because : isn't or anything.