hmm, You could of putted the code in PHP tags, and I don't think you should use addstring(), but obj.add().
you're making the this.weapons variables strings, so obj.size() won't work on them, since obj.size() counts the size of an array
and try this:
PHP Code:
function CreateList()
{
for( temp.weapon: player.weapons)
{
if( temp.weapon.name.starts( "-"))
this.systems.add( temp.weapon);
else
if( temp.weapon.name.starts( "Weapons/"))
this.weapons.add( temp.weapon);
else
if( temp.weapon.name.starts( "Tools/"))
this.tools.add( temp.weapon);
else
if( temp.weapon.name.starts("Toys/"))
this.toys.add( temp.weapon);
else
this.extra.add( player.weapons[temp.i].name);
}
}
// this would make arrays which contains each weapon name in each category,
// with this you could make tabs, like choosing what to view
You could make tabs with that, but if you want to show all items in one go,
and use the method you were going to use, just replace
player.weapons[temp.i].name inside the obj.add()'s into temp.i
PHP Code:
function PopList()
{
temp.tab = "weapons"; // current tab
( @ ItemList).clearrows();
for( temp.view: this.( @ temp.tab))
{
( @ ItemList).addrow( ( this.i > 0 ? this.i : 0), temp.view);
this.i ++;
}
ItemList.setselectedrow( -1); // sets row to default (no row is choosed)
}
That's how I would do it, but here is your method:
PHP Code:
function CreateList()
{
for( temp.i = 0; temp.i < player.weapons.size(); temp.i++)
{
if( player.weapons[ temp.i].name.starts( "-"))
this.systems.add( temp.i);
else
if( player.weapons[ temp.i].name.starts( "Weapons/"))
this.weapons.add( temp.i);
else
if( player.weapons[ temp.i].name.starts( "Tools/"))
this.tools.add( temp.i);
else
if( player.weapons[ temp.i].name.starts("Toys/"))
this.toys.add( temp.i);
else
this.extra.add( temp.i);
}
}
PHP Code:
function PopList()
{
( @ ItemList).clearrows();
for(temp.j=0; temp.j<thiso.currentbag.size();temp.j ++)
( @ ItemList).addrow( temp.i, player.weapons[ temp.j].name);
ItemList.setselectedrow( -1);
}
And I think that it would be better if you posted it in the NPC Scripting forum part tho