OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Jh62 on 15 Aug 2012, 22:23:51

Title: Error debug
Post by: Jh62 on 15 Aug 2012, 22:23:51
Hi.

There a way to see errors from scripts or functions properly?

I mean, I have some errors sometimes off-screen and I can't see what's wrong.

Thanks.
Title: Re: Error debug
Post by: Gruntage on 15 Aug 2012, 22:30:46
It depends a lot on what scripts and commands you're using.

I'll put an example here:

Code: [Select]
if (not CreateDialog "SELECT_DIFFICULTY") then {hint"Problem opening Dialog";DifficultySelected = true}

Basically what this does is tell me if there is any problem in loading up the dialog that I have created. If a problem is detected, then a hint is made which tells me so. This is one example.

You could do something like this:

Code: [Select]
if DeBug then {player sidechat format["overcast level = %1; max. level = %2  rain level = %3",_overcast,_currentMax,RainLevel]}

Here, 'Debug' is a global variable, and if it is made true at point during the mission, I can make hints or in this case, sidechats appear which tell me what's going on in the script, and what data is being created, etc.

In this particular example, I've used the sidechat command to tell me the values of other global and local variables.

This is basically how you can error trap.

Hope this helps

Gruntage
Title: Re: Error debug
Post by: faguss on 18 Aug 2012, 02:15:45
Interesting problem.

On a widescreen you can see a bit more of the message but that may not be enough.

However, it's possible to retrieve it from the memory. Such option will be included in the next Fwatch version.

Edit:  On a 16:9 you can see 149 characters. I can extract 512 from memory. Don't know how to get more.
Title: Re: Error debug
Post by: Gruntage on 18 Aug 2012, 09:05:26
Oh, so you're having problems seeing errors that are so long you can't see them on the screen?

My mistake. I thought you meant something else. Sometimes a script won't work properly and no errors are given.

Post an example of a command that's giving you errors and perhaps we can see what's wrong...




Gruntage