Jump to content
Sign in to follow this  
Guest

V1.85 scripting reference

Recommended Posts

Guest

The updated v1.85 scripting reference is available for download here or for online browsing here.

Share this post


Link to post
Share on other sites

loadFile filename

Operand types:

filename: String

Compatibility:

Version 1.82 required.

Type of returned value:

String

Description:

Return content of given file.

Example:

loadFile "myFunction.sqf" , result is "if a>b then {a} else {b}"

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

Share this post


Link to post
Share on other sites

Nope...I don't get it.

He may be happy at the fact that there is a loadfile command, but just pasting what it says in the comref ain't much of an indication. tounge.gif

wow.gif PEACE

Share this post


Link to post
Share on other sites

I don't understand either, good work on the command ref BIS.

RED

Share this post


Link to post
Share on other sites

I think its to execute a sqf (2GL Flashpoint script) and fetch the variables into local sqs variables. In the example they just check witch of _a and _b ist the greater and fetch thisone. (excuse my english wink.gif I speak swissgerman

Share this post


Link to post
Share on other sites

I didn't mean I don't understand the script, I mean i didn't understand why he pasted it into this thread smile.gif

RED

Share this post


Link to post
Share on other sites

Question:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">friendly

Compatibility:

Version 1.78 required.

Type of returned value:

Side

Description:

Friendly side (friendly to all units).

<span id='postcolor'>

also enemy....

what is this? smile.gif I don't know, I don't understand how friendly and enemy is used. Also, for event handler, anyone here know a really good way of checking if a vehicle has been destroyed by using eventHandler? I have some stuff going but it's not 100% reliable.

Thanks in advance

Share this post


Link to post
Share on other sites

I'm guessing it's just checking the rating of a unit. You know, when a units rating goes below 0 he's a rebel.

Either that, or you could use it to check if one unit is friendly towards the other:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">Sovman friendly Westman<span id='postcolor'>

Dunno about that though, can't check cause i haven't D/L 1.87.

wow.gif PEACE

Share this post


Link to post
Share on other sites

Gameer maybe you are right, actually I never used rating before... all the 2 years of OFP and no rating. smile.gif

Anyway, if anyone knows for sure what friendly and enemy are used for, let us know. (probably simple)

The eventHandler question I should not have asked that way, let me ask one of the developers like Suma: If I install an eventHandler "hit" on (T72) and inside do </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(canMove _vehicle):_vehicle removeAllEventHandlers "getIn";_vehicle removeAllEventHandlers "Hit";[_vehType] exec "removeEastUnit.sqs";hint format ["VEHICLE DESTROYED\nvehicle %1\noffender %2\namount %3",_vehicle,_by,_amount];<span id='postcolor'>

Is there any chance of another "hit" event being triggered even if the vehicle can not move? I seem to have this problem, sometimes 2 hits are processed for the vehicle when the first hit already removes all Handlers.

Share this post


Link to post
Share on other sites

I have answered my question and I am posting the answer in hope people searching for this months from now will use the damn SEARCH feature. tounge.gif

To make sure your event Handler is removed promptly and not triggered again for handlers like "hit" or "dammaged" or multiple handlers on one vehicle use something like:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_handler = format ["[_this select 0,_this select 1,_this select 2, %1] call loadFile ""eastVehicleDammaged.sqf""", _tryUnit]

_newVehicle addEventHandler ["Dammaged", _handler]<span id='postcolor'>

for your handlers... what's different? use .sqf which is atomic and will prevent the event (any event) to be triggered again before you do removeHandler.

smile.gif It really works.

Share this post


Link to post
Share on other sites

I can NEVER get those comand references to download from the Flashpoint 1985 website. sad.gif

Share this post


Link to post
Share on other sites

Is it necessary to remove event handlers on objects that are no longer needed (they are dead)??

What if I added a "killed" event to each player as they respawn.  A game might have people spawning in maybe 500 times.  Will this cause problems?

If I delete an object does that remove it's event handler??  Or is the event still checked on some table?

As long as whomever is reading this, I am still wondering, even though I've seen discussions about this, which is "fastest", which is the CPU hog:

Trigger or

@

I assume @ is faster than Trigger and Trigger is about equal to a loop like

#loop

~0.01

goto "loop"

??  And @ is probably a loop with ~0.0001??

And what if I have a script that calls out other scripts that go into loops themselves (I see this as like running threads).  How crazy can we get with doing this???  What if I have something firing bullets & each bullet is running its own little script in a loop....I mean, how crazy can we get here?

Doolittle

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (placebo @ Oct. 21 2002,00:03)</td></tr><tr><td id="QUOTE">I've mirrored it on OFPN here, try that smile.gif<span id='postcolor'>

Thanks, that worked....I wonder why I can never download it from "Flashpoint 1985"...I have at one time or another, tried to download all of the different versions, and it NEVER worked.

I actually resorted to viewing the "online reference"...and printing the whole thing from there wow.gif ....that took quite a while confused.gif

Share this post


Link to post
Share on other sites

Hi all,

I'm not the best when it comes to scripting, so I'd like to ask the following question.

Can you add a new event to the event Handler, and if so how?

DragoFire

Share this post


Link to post
Share on other sites
How crazy can we get with doing this???  What if I have something firing bullets & each bullet is running its own little script in a loop....I mean, how crazy can we get here?

I don't get your point...

That's quite a normal thing to do - happens all the time. smile_o.gif

What's wrong with that?

Share this post


Link to post
Share on other sites

I appreciate this topic is pinned but there seemed no real point to reply to that post from nearly 3 years ago?

Share this post


Link to post
Share on other sites

I have an interesting reply biggrin_o.gif

LINK IS OFFLINE !!!!!!!!!!!!!!!!!!!!!!!!!!! smile_o.gif:):)

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  

×