Jump to content
Sign in to follow this  
BeerHunter

Poor scripting and no checking. Language or coder?

Recommended Posts

I've been noticing a few little "quirks" (bugs some call them) in the canned missions that came with the game.

I'm not literate in the scripting language used for ArmA but am reasonably proficient with C++. One thing I was taught is that you NEVER create a returning function call (non VOID type) without an error code and you NEVER ignore that error code.

It seems to me that a lot of the scripts don't:

Check to see if they should even fire or not.(ie are the parameters it needs even valid? )

If they fire and an error occurs , usually nothing is done to prevent that error from performing some undesirable action or even possibly crashing the game.

I'm wondering if this problem is simply sloppy coding on the part of the "scriptor" or a major fault with the BIS scripting language.

Share this post


Link to post
Share on other sites

A script is not a program. Its meant to be simple. Error checking is done in the engine itself, putting the error into the .rpt file. If they fire and fail, it will log it and the game will continue functioning like normal (although the mission obviously may not).

Share this post


Link to post
Share on other sites
A script is not a program. Its meant to be simple. Error checking is done in the engine itself, putting the error into the .rpt file. If they fire and fail, it will log it and the game will continue functioning like normal (although the mission obviously may not).

so what you are basically saying then that's it's a major fault of the scripting language then (even NWN API's have error codes returned you can check).

Share this post


Link to post
Share on other sites
so what you are basically saying then that's it's a major fault of the scripting language then (even NWN API's have error codes returned you can check).

Did you not read what I was saying? It is a SCRIPT that is error checked at RUNTIME. You do not need to have error codes returned because the damn .rpt will TELL YOU it went wrong, at WHAT LINE the error occured and WHY it happened. If there is an error the script will break. You can always check whether objects/stuff is valid if you want.

Share this post


Link to post
Share on other sites

Depends on what you define as error checking. I mean you could potentially check if parameters are valid, but because of the nature of scripting you often don't know what valid parameters are, other than the fact that they must be of a certain type (sometimes even the type doesn't matter).

You are right though that most people when writing scripts always assume the parameters will be correct. However as others pointed out the game engine does its own error checking on runtime, so as long as you test your mission/addon the errors will be shown to you instantly. Afterall there really aren't many situations where a script could potentially recieve invalid parameters (other than stupidity/ignorance of the person using it), in in such cases they are usually checked before calling the script.

Share this post


Link to post
Share on other sites

AhAAA!! Just found this again...

So the program writes an error log. That's fine for finding errors created BY the script (ie debugging) but I'm thinking more in terms of an error check for a players input WHILE the script is running.

ie: Script in a trigger wants a player to acquire a certain item to complete a task but the player doesn't and moves out of the trigger area.

On exiting the trigger area , if certain conditions aren't met , an error would be generated that would trigger another script to remind the player that he can't continue unless he completes the original scripting requirement.

Now maybe this can be done but most scriptwriters don't think of it..and that's what I wanted to know.

Poor scripting (forgetting to check if all the conditions have been met) or inability of the language to check and return a code indicating all conditions had not been met.

Share this post


Link to post
Share on other sites

Yes, that is not error-checking....

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×