Jump to content
Sign in to follow this  
JacobJ

Preprocessor ERROR 7 with rating/points-system?

Recommended Posts

Hello all

I have made my own points/rating-system and I get an error when I load the mission. It says Preprocessor Error 7 with the point.sqs file.

Here is my rating-system:

#label
_menW = count units group cmd1;
_menE = count units group warlord;
_tower = 0;
_hummerdes = 0;
_hummerres = 0;
_cnt = 1000;

if !(alive tower) then {_tower = 250};
if !(alive hummer) then {_hummerdes = 100};
if (triggerActivated humrescue) then {_hummerres = 250};

_mst = (_cnt - ((10-_menW) * 100)) + ((10-_menE) * 50) + _hummerdes + _hummerres + _tower;

hint str _mst;
~5;
goto "label";

What could be the problem? I can't see what could be wrong with my newbie-eyes...

PS. The script works as it should in the preview in the editor.

Share this post


Link to post
Share on other sites

Okay ill try that.

ANother question. Can I make loops in sqf files and how would I do that?

---------- Post added at 07:10 PM ---------- Previous post was at 07:05 PM ----------

I still get the same error. What could else be wrong, can you see something else that looks newbish?

Share this post


Link to post
Share on other sites

while {alive player} do {
  hint "is player alive";
  if (!alive player) then {hint "no he is not"} else {hint "yes player is alive"};
  sleep 1;
  hint "starting loop again from top";
};

_mst = (_cnt - ((10-_menW) * 100)) + ((10-_menE) * 50) + _hummerdes + _hummerres + _tower;

i would have changed this line maybe to:

_mst = ((((_cnt - ((10-_menW) * 100)) + ((10-_menE) * 50) + _hummerdes) + _hummerres) + _tower)

added 3 ( front and 1 behind last 3 elements total 6 new.

Maybe better to do it in steps instead of complicated long line.

Edit: ah yes shuko is right use ? instead of if and : instead of then

Edited by Demonized

Share this post


Link to post
Share on other sites

Semicolons don't hurt in sqs if they are at the end of the line. Semicolon just starts a comment.

However, I might be more worried about using IF in it. SQS equilavent is question mark syntax:

SQF

if !(alive tower) then {doSomething};

SQS

? !(alive tower) : doSomething

SQF loop:

while {condition} do {
dosomething;
};

Share this post


Link to post
Share on other sites

1) Do yourself a favour and start using sqf as soon as you can - it is far superior to sqs.

2) You don't say how you are calling this script. The most likely explanation for the preprocessor error is that you are using one of the functions such as execVm which expects an sqf script. Your label (#label) will then be interpreted as a preprocessor token, giving the error you see.

Share this post


Link to post
Share on other sites

I surely did have the execVM to call the script. After removing VM it worked like it should! Thank you all for the help.

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  

×