ASH Plural Typed Constants

StDoodle

Minion
PHP:
item [int] allitems;
foreach i in $items[] {
    allitems[count(allitems)] = i;
}
print("I have randomly chosen the item: " + allitems[random(count(allitems))].to_string());
Unfortunately, you can't just go by the item ID's, as KoL skips around pretty wonkily. That should work for other types as well.
 
Darn. I was hoping I wouldn't have to manipulate the entire item database, as the script is already starting to introduce noticeable lag under its own mass.
 

StDoodle

Minion
That particular part shouldn't add too much; it's the heavy text-processing that seems to carry the burden, in my experience.
 
This works (I think) as a fix for now, but I was wondering if there was a built in way to emulate this:
Code:
string[int] array(boolean[string] data){
 string[int] x;
 foreach y in data{
  x[count(x)]=y;
 }
 return x;
}

void main(){
 string[int] male=array($strings[he, him, himself, his, his]);
 string[int] female=array($strings[she, her, herself, hers, her]);
 for i from 1 to 5 print(male[i-1]+" "+female[i-1]);
}
Somewhere along the lines of
Code:
 string[int] male=$strings[he, him, himself, his, his];

Or am I stuck with a conversion for now?
 

StDoodle

Minion
Yeah, if you need to have a non "boolean [type]" map, and / or need to do something on two maps at once, you pretty much have to convert them in a similar manner to what you have there. As far as I can tell, anyway.
 
Top