pope_leo wrote...
Lightfoot8 wrote...
The recursion level level is 0x100 or 256, It applies to all recersive function calls not just scripts. Extending it is a little more difficult then increasing the instruction count counter because its limit is based on the size of the buffer originally allocated for the storage of the return pointers.
I went back and double checked... there is a separate script execution recursion level that has a hard coded limit of 8.
Script a:
void main()
{
object mod = GetModule();
int recurse_lvl = GetLocalInt(mod, "RECURSION_LEVEL");
SpeakString("Recursion Level: " + IntToString(recurse_lvl), TALKVOLUME_SHOUT);
SetLocalInt(mod, "RECURSION_LEVEL", ++recurse_lvl);
ExecuteScript("b", mod);
}
Script b:
void main()
{
object mod = GetModule();
int recurse_lvl = GetLocalInt(mod, "RECURSION_LEVEL");
SpeakString("Recursion Level: " + IntToString(recurse_lvl), TALKVOLUME_SHOUT);
SetLocalInt(mod, "RECURSION_LEVEL", ++recurse_lvl);
ExecuteScript("a", mod);
}
The final print would be "Recursion Level: 7". There will be no feedback if it throws an error.
I found this interesting indeed, Though I do hate being the one proven wrong. I was planning on tracing the script through to learn a little more about how this is handled in the VM. I just have not found the time yet and do not know when I will, So I setteled for a different test for the moment. Unlike the TMI error that just stops every thing from running, This limit still allows the scripts that where ran to finish running, It just blocks the 9 script from running. I modified your script just a tad for the test.
void main()
{
object mod = GetModule();
int recurse_lvl = GetLocalInt(mod, "RECURSION_LEVEL");
SpeakString("Recursion Level: " + IntToString(recurse_lvl), TALKVOLUME_SHOUT);
SetLocalInt(mod, "RECURSION_LEVEL", ++recurse_lvl);
ExecuteScript("b", mod);
SetLocalInt(mod, "RECURSION_LEVEL", --recurse_lvl);
SpeakString("Recursion Level: " + IntToString(recurse_lvl), TALKVOLUME_SHOUT);
}
The final print was "Recursion Level: 0".
EDIT: Due to request, here is the full Log Report.
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 0
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 1
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 2
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 3
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 4
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 5
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 6
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 7
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 7
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 6
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 5
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 4
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 3
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 2
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 1
[CHAT WINDOW TEXT] [Sat Feb 09 01:44:46] SERVER : [Shout] Recursion Level: 0
Modifié par Lightfoot8, 09 février 2013 - 02:59 .