Common scripting errors

ArmA editing, missions, modeling, textures, terrains

Moderators: Lone Wolf, Snake Man

Post Reply
Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Common scripting errors

Post by Snake Man » 2009-05-10 15:54:26

Few basic scripting errors which are somewhat difficult to understand, at least for us newbies.

Code: Select all

Error in expression <-10>
  Error position: <-10>
  Error -: Type , expected Expression
I have absolutely no idea what this error is, difficult to find this "-10" and so on.

Does anyone have any idea what this error is?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

User avatar
Vigilante
Recruit
Posts: 33
Joined: 2008-12-03 11:41:58
Gaming Interests: Armed Assault (ArmA)
Editing Interests: All, I (try) to edit everything.
Contact:

Re: Common scripting errors

Post by Vigilante » 2009-05-10 16:49:52

how do you call the script? Via execVM?

I would rather call or spawn it with previous preProcess.. like so

Code: Select all

VIG_WP_new = compile preprocessFileLineNumbers "VIG_WP_new.sqf";
this way you get much better errormsg PLUS the line of code where it came from, well most of the time since it seems to ignore commentlines, so sometimes you have to deduct the previous commentslines from the linenr it puts out. I myself just started using that command instead of just preProcessFile ... ;)

And honestly, i never saw such errormsg like you posted before... and i had many of them :roll:
a.k.a. PhilippRauch
Check out my Addons Wiki @ http://vigilante-systems.webs.com (WIP but already contains lots of infos)

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Re: Common scripting errors

Post by T_Rex » 2009-05-11 03:55:21

The "error: type, expected expression" to me means that you've given it a variable that it has no idea what it is. Maybe undefined, not in a "private"? Or, something you've assigned as nul/nil then tried to use? Maybe as part of a math command. I've never seen that particular error, though.

The most common error I do is to use a variable inside a loop, then expect that variable to have a value outside the loop. Commonly known as "scope" issues. :)
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Common scripting errors

Post by Snake Man » 2009-05-11 06:54:39

That error comes from our dedicated linux server when playing VTE missions. I see that error A LOT in there.

While we're talking about it, can you confirm how to use the preprocess thing, does it work like this:

Code: Select all

// set the script up
VIG_WP_new = compile preprocessFileLineNumbers "VIG_WP_new.sqf";
// run the script
VIG_WP_new;
And if I have a small script that is run once, do I have to make that VIG_WP_new thing if I understood correctly that its like the uhm compiled script "function" sort of?

What I mean is can I run small script used in a mission only once like:

Code: Select all

compile preprocessFileLineNumbers "VIG_WP_new.sqf";
And nothing more? (sorry I never done these before).
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Re: Common scripting errors

Post by T_Rex » 2009-05-11 12:22:00

Close, but here's how I use it - this is from the OFPEC ComRef.
http://www.ofpec.com/COMREF/index.php?a ... ils&id=685

Code: Select all

// Pre-compile a function, with file name and line-number information stored within it.
myFunction = compile preprocessFileLineNumbers "myFunction.sqf";

// Call the function later.
_result = [_param1, _param2, _param3] call myFunction;
So, you compile the function into a "variable-name." Then the return value is held in the second variable.

If you aren't going to get a return variable, I think you still need the "call" command, or I believe you can use "spawn" for it to run sorta parallel.
Sic Semper tyrannosauro.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests