Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-11-2008, 11:47 PM
DarkReaper0 DarkReaper0 is offline
No.
DarkReaper0's Avatar
Join Date: May 2005
Location: Texas,USA
Posts: 344
DarkReaper0 will become famous soon enough
Send a message via MSN to DarkReaper0
[Help] Clearing a ton of arrays

Edit: Resolved


Right so, I'm having an issue.
Each time a player touches an NPC specified for dialogue it loads a text file, first resets the variables, organizes it all, then displays it in the checkbox text.

My only problem is that after i talk to one NPC and go up to another, it doesn't seem to reset, and if the new NPC has blank options where the first NPC actually had something written, it shows the data from the first npc's variables....

I only posted snippets for convenience (for you and me).

PHP Code:
//Portion that supposedly resets all the variables
for(temp.y=1;temp.y<=5;temp.y++) {
  
temp.file=
{
"choice"@i@"options","choice"@i@"sub"@i@"options","choice"@i@"sub"@i@"sub"@i@"options",
        
"choice"@i@"sub"@i@"sub"@i@"sub"@i@"options","choice"@i@"sub"@i@"sub"@i@"sub"@i@"sub"@i@"options"};
  for(
temp.q=0;temp.q<5;temp.q++) {
    
this.("file"@lowercase(temp.file[q])).clear();
    echo(
"Array:" SPC this.("file"@lowercase(temp.file[q])));
  }
}
//******************//

//Portion that organizes all the data into the variables (This part works)
function OrganizeData() {
  for (
temp.i=0;temp.i<this.file.size();temp.i++) {
    if (
this.file[temp.i].starts("CHOICE")) { //Stuff like "CHOICE1SUB2SUB1OPTIONS"
      
temp.s=temp.i+1;
      while(!
this.file[temp.s].starts("ENDCHOICE"))
      {
       
this.("file"@lowercase(this.file[temp.i])).add(this.file[temp.s]);
       
temp.s+=1;
      }
    }
  }
}
//********************//

//Where all the information is used

this.speechplacement@="sub"@input//input would be "sub2sub1" or "sub2sub1sub1" and etc.

if (temp.t.size()>0dialogue_CheckBox1.text=this.("file"@this.speechplacement@"options")[0];
if (
temp.t.size()>1dialogue_CheckBox2.text=this.("file"@this.speechplacement@"options")[1];
if (
temp.t.size()>2dialogue_CheckBox3.text=this.("file"@this.speechplacement@"options")[2];
if (
temp.t.size()>3dialogue_CheckBox4.text=this.("file"@this.speechplacement@"options")[3];
if (
temp.t.size()>4dialogue_CheckBox5.text=this.("file"@this.speechplacement@"options")[4];
//****************// 
All help is appreciated, I'm sorry if the styling hurts your eye's.

If anything is unclear or I left something out just ask for it.

Last edited by DarkReaper0; 10-12-2008 at 12:14 AM.. Reason: Issue resolved
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:09 AM.


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