Stack Overflow Error.. Odd... (RESOLVED)

Started by poc301, Fri 05/11/2004 19:18:42

Previous topic - Next topic

poc301

Hello all.Ã,  I added a few new strings to my repeately_execute function for my RPG's status screen (which all worked great until I added the last 2-3 strings), and now when I run the game, I get the following error as soon as it loads :

Error: run_text_script1: error -6(Error(line58): stack overflow) running function 'repeatedly_execute'

I have moved the variables around in the list to make sure it wasn't something I did by naming a string the name I gave it, but it didn't matter.Ã,  No matter what string is being listed on line 58 it crashes.Ã,  Is there a limit on what I can have/use in repeatedly_execute?

Code posted below :


--------------------------------------------------------------------------------------


#sectionstart repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE

function repeatedly_execute() {

string LVL;
string HP;
string MANA;
string STAMINA;
string STR;
string AGI;
string INT;
string VIT;
string LUC;
string MAG;
string WEA;
string PAR;
string DOD;
string STE;
string PIC;
string THR;
string CLI;
string NAM;
string CLASS;
string EXP;Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  // <==== THIS IS LINE 58 IN MY CODE
string EXPNEEDED;
StrFormat(HP,"%d", GetGlobalInt(14));Ã,  Ã, 
SetLabelText(4,1,HP);Ã,  Ã, 
StrFormat(MANA,"%d", GetGlobalInt(16));Ã, 
SetLabelText(4,0,MANA);
StrFormat(STAMINA,"%d", GetGlobalInt(15));
SetLabelText(4,2,STAMINA);Ã, 
StrFormat(STR,"%d", GetGlobalInt(1));Ã,  Ã, 
SetLabelText(4,3,STR);Ã, 
StrFormat(INT,"%d", GetGlobalInt(2));
SetLabelText(4,4,INT);Ã, 
StrFormat(AGI,"%d", GetGlobalInt(3));Ã, 
SetLabelText(4,5,AGI);Ã, 
StrFormat(VIT,"%d", GetGlobalInt(4));
SetLabelText(4,6,VIT);Ã, 
StrFormat(LUC,"%d", GetGlobalInt(5));
SetLabelText(4,7,LUC);
StrFormat(MAG,"%d", GetGlobalInt(6));
SetLabelText(4,8,MAG);Ã, 
StrFormat(WEA,"%d", GetGlobalInt(7));
SetLabelText(4,9,WEA);Ã, 
StrFormat(PAR,"%d", GetGlobalInt(8));
SetLabelText(4,10,PAR);Ã, 
StrFormat(DOD,"%d", GetGlobalInt(9));Ã, 
SetLabelText(4,11,DOD);
StrFormat(STE,"%d", GetGlobalInt(10));
SetLabelText(4,12,STE);Ã, 
StrFormat(PIC,"%d", GetGlobalInt(11));Ã,  Ã, 
SetLabelText(4,13,PIC);Ã, 
StrFormat(THR,"%d", GetGlobalInt(12));Ã,  Ã, 
SetLabelText(4,14,THR);Ã, 
StrFormat(CLI,"%d", GetGlobalInt(13));Ã, 
SetLabelText(4,15,CLI);
GetGlobalString(20, NAM);Ã, 
SetLabelText(4,16,NAM);Ã, 
GetGlobalString(17, CLASS);
SetLabelText(4,17,CLASS);
StrFormat(EXP,"%d", GetGlobalInt(18));Ã, 
SetLabelText(4,19,EXP);Ã,  Ã, //18 is the exit button
StrFormat(LVL,"%d", GetGlobalInt(19));Ã, 
SetLabelText(4,20,LVL);
StrFormat(EXPNEEDED,"%d", GetGlobalInt(21));Ã, 
SetLabelText(4,21,EXPNEEDED);

}
#sectionend repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE


Any help greatly appreciated.

poc301

By the way, if I // out the EXP and the EXPNEEDED lines the thing works fine.  EXP is 0 and EXPNEEDED is 100 also.

I think it may be that it is just trying to do too much in the repeatedly_execute...

If so, is there some way to get around it?

Pumaman

You'll get this if you define over 4 KB's worth of variables inside a function.

Since strings are 200 bytes in length, declaring 21 of them will be too much.

Basically, there's no need for so many strings, just do this:

string buffer;

StrFormat(buffer,"%d", GetGlobalInt(14));   
SetLabelText(4,1,buffer);   
StrFormat(buffer,"%d", GetGlobalInt(16)); 
SetLabelText(4,0,buffer);
StrFormat(buffer,"%d", GetGlobalInt(15));
SetLabelText(4,2,buffer); 

etc

poc301

I don't quite get it.Ã,  What do I do to 'buffer' to get it to work?

poc301

OH!!!  My appologies.  It has been a LONG day :)

I took a second and looked at exactly what it was doing.  Quite ingenious!  Simple, but ingenious :)

Thanks again!

Bill Garrett

Janik

And you could use a for loop a bunch of these, it would simplify your code
Play pen and paper D&D? Then try DM Genie - software for Dungeons and Dragons!

SMF spam blocked by CleanTalk