Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Problem when drawing inventory with -IRC (https://forums.graalonline.com/forums/showthread.php?t=71131)

Lao_Su2 12-31-2006 04:20 PM

Problem when drawing inventory with -IRC
 
In the QMenu I was working on I cant seem to find a way around this problem.
Here are the strings:
NPC Code:

function CreateList() {
for(temp.i=0;temp.i<player.weapons.size();temp.i++ ) {
if(player.weapons[temp.i].name.starts("-")) {
addstring("this.systems",temp.i);
}
elseif(player.weapons[temp.i].name.starts("Weapons/")) {
addstring("this.weapons",temp.i);
}
elseif(player.weapons[temp.i].name.starts("Tools/")) {
addstring("this.tools",temp.i);
}
elseif(player.weapons[temp.i].name.starts("Toys/")) {
addstring("this.toys",temp.i);
}
else {
addstring("this.extra",temp.i);
}
}
}


Then when I go to draw the values that are in say this.weapons it will show the correct value if I have it echo clientside, but still draws -IRC
NPC Code:

function PopList() {
ItemList.clearrows();
for(temp.i=0;temp.i<thiso.currentbag.size();temp.i ++) {
ItemList.addrow(temp.i,player.weapons[temp.i].name);
}
ItemList.setselectedrow(0);
}



Am I doing something horribly wrong? Someone else said that they were having the same problem. Thanks

Chompy 12-31-2006 05:46 PM

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.weaponplayer.weapons)
  {
    if( 
temp.weapon.name.starts"-"))
      
this.systems.addtemp.weapon);
    else
      if( 
temp.weapon.name.starts"Weapons/"))
        
this.weapons.addtemp.weapon);
      else
        if( 
temp.weapon.name.starts"Tools/"))
          
this.tools.addtemp.weapon);
        else
          if( 
temp.weapon.name.starts("Toys/"))
            
this.toys.addtemp.weapon);
          else
            
this.extra.addplayer.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.viewthis.( @ temp.tab))
  {
    ( @ 
ItemList).addrow( ( this.this.0), temp.view);
    
this.++;
  }
  
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.0temp.player.weapons.size(); temp.i++)
  {
    if( 
player.weaponstemp.i].name.starts"-"))
      
this.systems.addtemp.i);
    else
      if( 
player.weaponstemp.i].name.starts"Weapons/"))
        
this.weapons.addtemp.i);
      else
        if( 
player.weaponstemp.i].name.starts"Tools/"))
          
this.tools.addtemp.i);
        else
          if( 
player.weaponstemp.i].name.starts("Toys/"))
            
this.toys.addtemp.i);
          else
            
this.extra.addtemp.i);
  }


PHP Code:

function PopList()
{
  ( @ 
ItemList).clearrows();
  for(
temp.j=0temp.j<thiso.currentbag.size();temp.++)
    ( @ 
ItemList).addrowtemp.iplayer.weaponstemp.j].name);
  
ItemList.setselectedrow( -1);


And I think that it would be better if you posted it in the NPC Scripting forum part tho


All times are GMT +2. The time now is 09:16 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.