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
  #7  
Old 03-27-2012, 07:42 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Is this of the same problem?

I added more for loops because it use to be only this.tempStaff, and 20 strings in the array..

Then the original code only had this one else if for loop checking through the staff. :/

It would then say there was an error in the RC but the level editor still worked.. I didn't really know how to fix the problem but to split the work out into different else ifs...

It still doesn't work all that well but does work.
Sadly, I think the RC will state a lot of errors, but the people will not know...


Is there a way to fix this, or is it the same error as everyone else?
I tried to fix it, but I thought the problem was going through all the arrays..
It just says reached a loop limit at 0, 0.

Original (20 people / levels)
PHP Code:
this.tempStaff  = { //This will be deleted after the contest.
    
"Graal774127","lat-01.nw""Graal781370","lat-02.nw""Graal779529","lat-03.nw""acc","lat-04.nw""acc","lat-05.nw",
  }; 



else if (
player.account in this.tempStaff){
        for (
i=0this.tempStaff.size(); i++){
          if  (
player.account == this.tempStaff[i] && player.level == this.tempStaff[i+1]){
            for (
temp.i=0temp.params[1].size(); temp.++){
              
player.level.tiles[(temp.i%params[2])+params[3],int(temp.i/params[2])+params[4]] = params[1][temp.i];
              
player.level.updateboard2(params[3],params[4],params[2],params[1].size()/params[2]);
            }
          }
        }  
      } 




Code now.
PHP Code:
  this.tempStaff  = { //This will be deleted after the contest.
    
"Graal774127","lat-01.nw""Graal781370","lat-02.nw""Graal779529","lat-03.nw""acc","lat-04.nw""acc","lat-05.nw",
  };    
  
this.tempStaff2  = { //This will be deleted after the contest.
    
"acc","lat-06.nw""acc","lat-07.nw""acc","lat-08.nw""acc","lat-09.nw""acc","lat-10.nw",  
  };
  
this.tempStaff3  = {
    
"acc","lat-11.nw""acc","lat-12.nw""acc","lat-13.nw""acc","lat-14.nw""acc","lat-15.nw",
  };
  
this.tempStaff4  = {  
    
"acc","lat-16.nw""acc","lat-17.nw""acc","lat-18.nw""acc","lat-19.nw""acc","lat-20.nw"
  };                  
// Can only edit certain levels 
  
  
  
switch (action) {
    case 
"SaveLevel":
      if (
player.account in this.regStaff || player.account in this.trialStaff) {
        for (
temp.i=0temp.params[1].size(); temp.++)
          
player.level.tiles[(temp.i%params[2])+params[3],int(temp.i/params[2])+params[4]] = params[1][temp.i];
          
player.level.updateboard2(params[3],params[4],params[2],params[1].size()/params[2]);
      } 
      
      
      
//Deleting this after the contest
      
else if (player.account in this.tempStaff){
        for (
i=0this.tempStaff.size(); i++){
          if  (
player.account == this.tempStaff[i] && player.level == this.tempStaff[i+1]){
            for (
temp.i=0temp.params[1].size(); temp.++){
              
player.level.tiles[(temp.i%params[2])+params[3],int(temp.i/params[2])+params[4]] = params[1][temp.i];
              
player.level.updateboard2(params[3],params[4],params[2],params[1].size()/params[2]);
            }
          }
        }  
      }
      else if (
player.account in this.tempStaff2){
        for (
i=0this.tempStaff.size(); i++){
          if  (
player.account == this.tempStaff2[i] && player.level == this.tempStaff2[i+1]){
            for (
temp.i=0temp.params[1].size(); temp.++){
              
player.level.tiles[(temp.i%params[2])+params[3],int(temp.i/params[2])+params[4]] = params[1][temp.i];
              
player.level.updateboard2(params[3],params[4],params[2],params[1].size()/params[2]);
            }
          }
        }  
      }
      else if (
player.account in this.tempStaff3){
        for (
i=0this.tempStaff.size(); i++){
          if  (
player.account == this.tempStaff3[i] && player.level == this.tempStaff3[i+1]){
            for (
temp.i=0temp.params[1].size(); temp.++){
              
player.level.tiles[(temp.i%params[2])+params[3],int(temp.i/params[2])+params[4]] = params[1][temp.i];
              
player.level.updateboard2(params[3],params[4],params[2],params[1].size()/params[2]);
            }
          }
        }  
      }
      else if (
player.account in this.tempStaff4){
        for (
i=0this.tempStaff.size(); i++){
          if  (
player.account == this.tempStaff4[i] && player.level == this.tempStaff4[i+1]){
            for (
temp.i=0temp.params[1].size(); temp.++){
              
player.level.tiles[(temp.i%params[2])+params[3],int(temp.i/params[2])+params[4]] = params[1][temp.i];
              
player.level.updateboard2(params[3],params[4],params[2],params[1].size()/params[2]);
            }
          }
        }  
      } 
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



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:14 PM.


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