Jump to content
Sign in to follow this  
Lucence

Comments and line breaks in !init.sqf files are throwing script errors.

Recommended Posts

Howdy brothers, thanks in advance for your assistance! I'm eager to be in company with such brilliant minds...

The beef of it: I can code in init.sqf adding comments and line breaks without a problem... when I create an sqf script file to be executed from init.sqf, it will throw script errors if I add comments or line breaks([Enter]) inside of that created script file...

For example, if I call a {...}forEach anArray;... I need to put the entire call on one line for the script to work...

{

...

}forEach anArray //croaked... <-- that comment makes it croak too

That goes with all other control structures... Any line break or comment kills it.

Even though this isn't a show stopper, my years of programming and scripting has put this little voice in the back of my head telling me "COMMENT!, Make things clean and readable so YOU and other people know where your logic was...". This problem has made that much more difficult, if not about impossible.

Any ideas? Is this intended design? :confused:

---------- Post added at 01:24 ---------- Previous post was at 00:37 ----------

It seems as if, even though I'm calling the scripts as .sqf and they are named .sqf... they are being ran in .sqs context. Is there a toggle of some sort I've missed?

---------- Post added at 01:29 ---------- Previous post was at 01:24 ----------

Alright... I figured it out. I was using exec instead of execVM this entire time. lol I can now say goodbye to my hundred character lines of code >.<. Geez... I always feel like a derp every time I pull something like this.

Share this post


Link to post
Share on other sites
Howdy brothers, thanks in advance for your assistance! I'm eager to be in company with such brilliant minds...

The beef of it: I can code in init.sqf adding comments and line breaks without a problem... when I create an sqf script file to be executed from init.sqf, it will throw script errors if I add comments or line breaks([Enter]) inside of that created script file...

For example, if I call a {...}forEach anArray;... I need to put the entire call on one line for the script to work...

{

...

}forEach anArray //croaked... <-- that comment makes it croak too

That goes with all other control structures... Any line break or comment kills it.

Even though this isn't a show stopper, my years of programming and scripting has put this little voice in the back of my head telling me "COMMENT!, Make things clean and readable so YOU and other people know where your logic was...". This problem has made that much more difficult, if not about impossible.

Any ideas? Is this intended design? :confused:

---------- Post added at 01:24 ---------- Previous post was at 00:37 ----------

It seems as if, even though I'm calling the scripts as .sqf and they are named .sqf... they are being ran in .sqs context. Is there a toggle of some sort I've missed?

---------- Post added at 01:29 ---------- Previous post was at 01:24 ----------

Alright... I figured it out. I was using exec instead of execVM this entire time. lol I can now say goodbye to my hundred character lines of code >.<. Geez... I always feel like a derp every time I pull something like this.

So for example.

_null = [] execvm "car_horns\sedan_horns_init2.sqf";

could not look like ?

_null = []

execvm "car_horns\sedan_horns_init2.sqf";

Share this post


Link to post
Share on other sites

You could try to adapt to call/spawn instead of execVM.

works like a charm for me :)

Share this post


Link to post
Share on other sites

For example, if I call a {...}forEach anArray;... I need to put the entire call on one line for the script to work...

{

...

}forEach anArray //croaked... <-- that comment makes it croak too

In the above example the missing semi-colon will stop some scripts from working. Not sure maybe it was a typing mistake in the post but:

{

...

}forEach anArray; //croaked

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  

×