Author Topic: Getting Enabled Weapons.  (Read 723 times)

Code: [Select]
function GetItems(){
for(%i=0;%i<=DataBlockGroup.getCount()-1;%i++){
%obj=DataBlockGroup.getObject(%i);
if(%obj.getClassName() $= "ItemData"){
return %obj;
}
}
}

I tried that but it only returns the first item.

I'm aware that this return's the datablocks.

You can only return once from a function.

You could add each datablock to a string but this has been deemed slow by Badspot.
Quote
First, you're putting things together into a string, sending a copy of that string back from a function, then taking the string apart to get the objects again.  That is a lot of useless string operations that are slow.

You could just include that small part of code each time you use it, because the loop to go through a global array would be almost as big itself.

You could just include that small part of code each time you use it, because the loop to go through a global array would be almost as big itself.

Ok, thanks.