Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-09-2009, 05:40 AM
thatdwarf thatdwarf is offline
Former UN Dev Admin
Join Date: Nov 2005
Posts: 42
thatdwarf is on a distinguished road
Nested for() functions duplicating output

Alright, the problem I am having is with a GUI control, I want to add a filtered list of the player's weapons.

The below code doesnt filter the desired content (and yes, there is an array defined already called this.bannedNPCs)

flip the for() loops around, and it filters nothing, but duplicates the output a couple times

for example: -wep, -wep, -wep, -wep, -anotherwep, and so on
PHP Code:
function LAucItem.onSelect(idtxtind) {
  
L_List.clearrows();
  if(
txt == "NPC") {
    for(
temp.weps this.bannedNPCs) {
      for(
temp.0temp.player.weapons.size(); temp.i++) {
        if(!
player.weapons[temp.i].name.starts(temp.weps))
          
L_List.addrow(temp.iplayer.weapons[temp.i].name);
      }
    }
  }

Any ideas on how to fix this?

Thanks!
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:32 PM.


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