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.
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?
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
I don't quite get it.Ã, What do I do to 'buffer' to get it to work?
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
And you could use a for loop a bunch of these, it would simplify your code