Jump to content
Sign in to follow this  
Easy_tiger

preproceess file- Please can i have some help

Recommended Posts

Hi,

can someone please post some code snippets for using preproccess file in ArmA.

I have tried everything possible but cannot get the damn function to execute!!!!!

heres what im doing below, can anyone help please this is driving me up the wall!

init.sqs:

ReArmOpfor = preprocessfile "ReArmOpFor.sqf"

-------------------------------------------

ReArmOpfor.sqf:

hint "executing";

return true

----------------------------------------

player init: [player] call ReArmOpfor

Share this post


Link to post
Share on other sites

Try to use preprocessFile in connection with compile, because call command needs code instead of strings.

For example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fMyFunction = compile preprocessFile "myFunc.sqf";

[parameter] call fMyFunction

Share this post


Link to post
Share on other sites

Thanks for the info T_D i will try this later on this evening.

have you got your example to work in ArmA?

Share this post


Link to post
Share on other sites

Hi,

Thanks again for the info, the function now compiles however i still cant get it to execute! sad_o.gif

heres what ive got:

init.sqs

-------

ReArmEast = compile preprocessFile "ReArmOpfor.sqf"

ReArmOpfor.sqf

---------------

/* take arg[0] */

_OPFORunit = (_this select 0);

/* remove default weapon

(_OPFORunit) removeWeapon "AK74";

Init field for player R1

---------------------

[R1] call ReArmEast

Are you restricted to a subset of functions with sqf files? i.e unable to call removeWeapon() etc...

Help crazy_o.gif

Share this post


Link to post
Share on other sites

Should be correct besides the fact that an ending of the second comment is missing, so the removeWeapon command isn't interpreted.

Share this post


Link to post
Share on other sites

Yeah I asked the same problem here.

Some suggested that the Initialization fields of units possibly get executed before the init.sqs script. Not sure if it's true, but the way you did it won't work.

Just change your initialization field to:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ReArmEast = compile preprocessFile "ReArmOpfor.sqf"; [R1] call ReArmEast

Or if you have too many of those sort of calls, you can move all the code into your init.sqf file.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ReArmEast = compile preprocessFile "ReArmOpfor.sqf";

{

[_x] call call ReArmEast;

} forEach [R1, R2, R3, R4];

Share this post


Link to post
Share on other sites

oops sorry T_D forgot to end the comment in the example, however the real code is commented correctly.

Thanks for the info Dr_Eyeball i will try your suggestion this weekend. I dont remeber seeing a init.sqf only init.sqs is it just a case of creating the file and adding code and is its compilation automatic or something i have to perform?

Share this post


Link to post
Share on other sites

Yes it's that simple, there's nothing special about using an init.sqf file except that it allows you to use the new sqf syntax (great for multi line statements).

It seems to get automatically called at the same time as init.sqs, not sure what order though, but I don't use init.sqs anymore, when possible.

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  

×