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 06-07-2011, 04:35 AM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Help with a for loop problem?

Okay so, I'm using a for loop to check through a multi-dimensional array, and everything is returning fine, the script is basically doing what I want it to do, no problem. But now within the for loop i'm trying to set an individual this.whatever flag everytime I mouse over an object in the array. (If this makes sense?) But for some reason, I can only set the flag for the last group of variables in the array.. ?

I dunno if what I just said makes any sense, but either way, check out the code and you'll probably see what I mean.. By the way, I am merely providing the pieces of the code that are needed in order for me to get help, the //Mouse Over part is being ran within a timeout loop just to clarify things a bit more..

Also, another clarification: I'm trying to set this.newDebug to true everytime the mouse enters the specified zone, but I can only set it for the "Rifle" array part. It won't set for any others. =/

Thanks in advance to anyone that helps.

PHP Code:
function onCreated()
{
  
this.equipSlots = { {"Hat"3658"necro_gui_equips-hat.png"},
                      {
"Mask"9658"necro_gui_equips-mask.png"},
                      {
"Armor"15658"necro_gui_equips-armor.png"},
                      {
"Back Piece"36118"necro_gui_equips-back.png"},
                      {
"Shirt"156118"necro_gui_equips-shirt.png"},
                      {
"Glove"36178"necro_gui_equips-glove.png"},
                      {
"Pants"156178"necro_gui_equips-pants.png"},
                      {
"Shoes"96209"necro_gui_equips-shoes.png"},
                      {
"Explosive"36233"necro_gui_equips-explosive.png"},
                      {
"Left Weapon"36288"necro_gui_equips-leftwep.png"},
                      {
"Right Weapon"156288"necro_gui_equips-rightwep.png"},
                      {
"Rifle"96264"necro_gui_equips-rifle.png"}
                   };
  
this.equipSlotCount 12;
}

    
//Mouse over for Slot
    
temp.mouse_xy = {mousescreenxmousescreeny};
    for ( 
i=0this.equipSlotCounti++; ) {
      
      
temp.chSlots this.equipSlots[i];
      if ( 
mouse_xy[0in |menu_xy[0] + chSlots[1], menu_xy[0] + chSlots[1] + 32| &&
           
mouse_xy[1in |menu_xy[1] + chSlots[2], menu_xy[1] + chSlots[2] + 32| ) {
        
this.newDebug true;
        
with findImg 203 ) ) {
        
          
image chSlots[3];
          
menu_xy[0] + chSlots[1];
          
menu_xy[1] + chSlots[2];
          
layer 5;
          
mode 0;
          
red green blue 1;
          
alpha .8;
        }
        
with findImg 223 ) ) {
        
          
text chSlots[0];
          
font "Tempus Sans ITC";
          
style "bc";
          
menu_xy[0] + chSlots[1] + 16;
          
menu_xy[1] + chSlots[2] - 5;
          
layer 5;
          
mode 0;
          
red green blue 1;
          
alpha .8;
          
textshadow true;
          
shadowcolor = {000};
          
zoom .6;
        }
      } else {       
        
hideImg203 ); 
        
hideImg223 ); 
        
this.newDebug false;
      }
    } 
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 04:17 AM.


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