Just for the record, this is posted. In case someone in future needs this.
I had a client side script main.nut which was not working. Client side scripts not show errors in game.
If there is an error, download this program sq.exe (https://dl.dropboxusercontent.com/s/p89zs13ybr6gz0t/sq.exe?dl=0)
Result
(https://i.imgur.com/xz89nN5.png)
Note: You need to copy this sq.exe to your main.nut folder
The error is also generated in debuglog.txt, or you can use a different error handler to display the error as local chat.
Quote from: habi on Nov 24, 2022, 12:58 PMJust for the record, this is posted. In case someone in future needs this.
I had a client side script main.nut which was not working. Client side scripts not show errors in game.
If there is an error, download this program sq.exe (https://dl.dropboxusercontent.com/s/p89zs13ybr6gz0t/sq.exe?dl=0)
Result
(https://i.imgur.com/xz89nN5.png)
Note: You need to copy this sq.exe to your main.nut folder
Set error handling, u can make error info to game console it. Find more: www.squirrel-lang.org (http://www.squirrel-lang.org)
it's e.m
function errorHandling(err) {
local stackInfos = getstackinfos(2);
if (stackInfos) {
local locals = "";
foreach (index, value in stackInfos.locals) {
locals = locals + "[" + index + ": " + type(value) + "] " + value + "\n";
}
local callStacks = "";
local level = 2;
do {
callStacks += "*FUNCTION [" + stackInfos.func + "()] " + stackInfos.src + " line [" + stackInfos.line + "]\n";
level++;
} while ((stackInfos = getstackinfos(level)));
local errorMsg = "AN ERROR HAS OCCURRED [" + err + "]\n";
errorMsg += "\nCALLSTACK\n";
errorMsg += callStacks;
errorMsg += "\nLOCALS\n";
errorMsg += locals;
foreach (i, msg in split(errorMsg, "\n")) print(msg)
}
}
seterrorhandler(errorHandling);
Quote from: habi on Nov 24, 2022, 12:58 PMdownload this program sq.exe (https://dl.dropboxusercontent.com/s/p89zs13ybr6gz0t/sq.exe?dl=0)
Hey
@habi, i have download it, and i have place it in store/script folder but when i run it, it says that i have some missing files like squirrel.dll, sqstdlib.dll, etc...
hi Mohamed Boubekri,
i have updated it as zip file here (https://dl.dropboxusercontent.com/scl/fi/jogsalisq0ty5np113b5c/squirrel.zip?rlkey=974ta6twgte9md54zj625bojm&dl=0). Unzip all of them.
Also add that location to PATH for easily accessing from command line.
Okey, thank you :)
@habi, when i run my main.nut, the application told me that (
the index GUI dosen't exist )
Exactly that line:- (
sX <- GUI.GetScreenSize().X; ), but i'm sure the problem isn't here.
Actually i want something to catch all the errors on the client side like the original console on server side.
Quote from: 2b2ttianxiu on Feb 01, 2023, 08:00 AMfunction errorHandling(err) {
local stackInfos = getstackinfos(2);
if (stackInfos) {
local locals = "";
foreach (index, value in stackInfos.locals) {
locals = locals + "[" + index + ": " + type(value) + "] " + value + "\n";
}
local callStacks = "";
local level = 2;
do {
callStacks += "*FUNCTION [" + stackInfos.func + "()] " + stackInfos.src + " line [" + stackInfos.line + "]\n";
level++;
} while ((stackInfos = getstackinfos(level)));
local errorMsg = "AN ERROR HAS OCCURRED [" + err + "]\n";
errorMsg += "\nCALLSTACK\n";
errorMsg += callStacks;
errorMsg += "\nLOCALS\n";
errorMsg += locals;
foreach (i, msg in split(errorMsg, "\n")) print(msg)
}
}
seterrorhandler(errorHandling);[/quote]
Hey
@2b2ttianxiu, how i can use that function ? i don't understand where do i will place it, or how i will mention it.
That is client side code. Put it in store/script/main.nut
Then find
%APPDATA%\VCMPbeta\debuglog.txt
It might have result of those print statements.
Quote from: Mohamed Boubekri on Aug 14, 2023, 11:24 AMQuote from: 2b2ttianxiu on Feb 01, 2023, 08:00 AMfunction errorHandling(err) {
local stackInfos = getstackinfos(2);
if (stackInfos) {
local locals = "";
foreach (index, value in stackInfos.locals) {
locals = locals + "[" + index + ": " + type(value) + "] " + value + "\n";
}
local callStacks = "";
local level = 2;
do {
callStacks += "*FUNCTION [" + stackInfos.func + "()] " + stackInfos.src + " line [" + stackInfos.line + "]\n";
level++;
} while ((stackInfos = getstackinfos(level)));
local errorMsg = "AN ERROR HAS OCCURRED [" + err + "]\n";
errorMsg += "\nCALLSTACK\n";
errorMsg += callStacks;
errorMsg += "\nLOCALS\n";
errorMsg += locals;
foreach (i, msg in split(errorMsg, "\n")) print(msg)
}
}
seterrorhandler(errorHandling);[/quote]
Hey @2b2ttianxiu, how i can use that function ? i don't understand where do i will place it, or how i will mention it.
Put it in main script