OFPEC Forum

OFPEC The Editing Center => General Announcements => Topic started by: snYpir on 07 Jan 2003, 23:19:02

Title: OFPEC Function Library Launched!
Post by: snYpir on 07 Jan 2003, 23:19:02
Functions were introduced in version 1.85 of OFP. These are essentially new commands (eg like getpos) that editors can write themselves.

I have put together the OFPEC Function Library, at:

http://www.ofpec.com/editors/funcref.php

As a way of building a library of funtions for people to use in their missions.

The idea is that if you write a function that other people might find useful, perhaps an ejection function called 'DoEject' or something, then you can submit it to the Function Library.

Functions are faster and more efficent than scripts, and that is why we should be using more of them in our missions.

Functions are similar to script snippets, except they are smaller and only utilise one .sqf file (instead of multiple .sqs files).

See the second post down on the next page for a short tutorial and an example mission on using functions.

Also, the following tutorials will make you a function guru:

Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 07 Jan 2003, 23:32:02
i like it  ;D

i wil send u som functions dat i use in my misions (i wil also uplaod da sqs file i use em 4 ;))

wat bout sqf files dat use oder sqf files ? (nd i have dat kind ;D) wat i do wid em ?

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: Gastovski on 07 Jan 2003, 23:35:35
Brilliant idea... How will people download it, zip files? Maybe there should be a large PBO "MOD" for OFP which contains all these scripts...
Title: Re:BETA: OPFEC Function Reference
Post by: Messiah on 07 Jan 2003, 23:37:19
wtf? i voted confused - i have no idea what these things are - jeeze louise...

ive noticed LCD has used them (thanx for the script etc) and didnt know what they were... how do u make them? im not even sure how even go about understasnding them.... i tried to read the info section, but that confuses me...

is it just like placing 6 scripts (like i have used in a mission) which all link to one single script, but place them into 1 file which just cuts down on stuff?
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 07 Jan 2003, 23:40:36
Quote
wat bout sqf files dat use oder sqf files ? (nd i have dat kind ) wat i do wid em ?

Huh? :-\

Quote
How will people download it, zip files?

At the moment people can only download the single .sqf files (which are attached for every function)

Once we get a buildup, it would be super easy to distribute the entire function reference in a single pbo file - using Backoff and Sefe's PHP PBO code we could almost compile a pbo file in real time any time a user wanted it!

I have to be honest - it was actually uiox's idea (in this (http://www.ofpec.com/yabbse/index.php?board=28;action=display;threadid=5039) thread) :-[
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 07 Jan 2003, 23:44:52
wtf? i voted confused - i have no idea what these things are - jeeze louise...

ive noticed LCD has used them (thanx for the script etc) and didnt know what they were... how do u make them? im not even sure how even go about understasnding them.... i tried to read the info section, but that confuses me...

is it just like placing 6 scripts (like i have used in a mission) which all link to one single script, but place them into 1 file which just cuts down on stuff?

I see a tutorial is required.... 8)

They are very, very simple - LCD probaly made it confusing due to poor english ;D

Think 'custom command' - these are essentialy commands that you make yourself.

You define in the 'custom command' (ie the function) in the init.sqs file.

You write what the custom command does in an .sqf file and save it in your mission directory.

You can then use that 'custom command' anywhere in your mission (just like you would a script, except 'custom commands' run faster).

clear as mud? ???
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 07 Jan 2003, 23:45:03
wat i meen 2 say - i have functions dat use oder functions in em (so da 2 functions need 2 b in da pbo 2 work) wat i do ? iput in da description -

functions required ?

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 07 Jan 2003, 23:47:59
You define in the 'custom command' (ie the function) in the init.sqs file.

You write what the custom command does in an .sqf file and save it in your mission directory.

just wanna note dat u dont have 2 name custom command u can use em W/O makin da custom command @ all :P

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 07 Jan 2003, 23:51:14
Quote
wat i meen 2 say - i have functions dat use oder functions in em (so da 2 functions need 2 b in da pbo 2 work) wat i do ? iput in da description -

damn. didn't think of that. I wanted to keep everything seperate - ie one function per sqf file.

If you use other functions - can you put them in seperately, and then put:

requires these functions: blah blah

in the description?

if not, i'll have to allow zips...


Quote
just wanna note dat u dont have 2 name custom command u can use em W/O makin da custom command @ all

can i have an example plz?
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 07 Jan 2003, 23:54:30
I have to go to work - i'll be back at lunch.

The biggest thing i am concerned about is this:

should we allow multiple commands in the one sqf file?

i personally think that we should allow one custom command (function) per entry, and if multiple custom commands are used, then in the description the author needs to put:

requires - this, this, this etc

I can make it automatic - a drop down box on the upload page where you select other custom commands that are required.

thoughts?
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 07 Jan 2003, 23:59:37
Quote
can i have an example plz?

_bodyang = [_guard,_deadguard] call loadfile "getang.sqf"

as Tomb says - work like magic  ::)  ;D

Quote
should we allow multiple commands in the one sqf file?

i personally think that we should allow one custom command (function) per entry, and if multiple custom commands are used, then in the description the author needs to put:

requires - this, this, this etc

I can make it automatic - a drop down box on the upload page where you select other custom commands that are required.

thoughts?

i want it automatic - i have som math functions dat i use function in function (based on each other  ;D)  so if i cantel dat it requires other 1s it wil b totaly kool ;D

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: KTottE on 08 Jan 2003, 00:12:12
I'd say that you allow .zips, because that would be dandy ;D

Maybe force people to make short example missions on "desert island", and have them submit that?

Especially when you're using several .sqfs.

I'm gonna get more aquainted with .sqfs, and then I'm gonna see about implementation areas for them, as they would be sweet and stuff. And also simplify some things.
Title: Re:BETA: OPFEC Function Reference
Post by: Arctic on 08 Jan 2003, 00:16:34
*wow! I'm actually posting on this forum instead of reading it! ;D*

I'd upload the functions. But I dont get what you would use them (the functions) for. Also, if someone made a tutorial for this, i'd be a happy man :D

I'll go over to that official scripting site next.  

***Just wanted to clear up that first thing. I know it is like a mini-script and loads faster. Just what exactly makes a funciton more usefull? Can you perform some script-controlled action quicker with a function?
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 00:19:08
da best thing wid functions (me thinks) is dat instead of typing da same part of script 2 do somthing (like finiding da nearest enemy soldier) in lot of scripts - u can use da same function lot of times ;D

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: Messiah on 08 Jan 2003, 01:19:58
its kinda clearer - but one question

Quote
You define in the 'custom command' (ie the function) in the init.sqs file.

You write what the custom command does in an .sqf file and save it in your mission directory.

You can then use that 'custom command' anywhere in your mission (just like you would a script, except 'custom commands' run faster).

ok, ummm, so these commands - do they like come up in the action menu for the player to use? or do they execute exactly like .sqs? - just makes things more simple.

so, umm, how do u make a sqf file? just save from notepad as an sqf?
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 01:23:22
dey r like scripts  ;D

nd yes just save da file as sqf nd it wil b function (if u write it right ;))

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 01:31:50
I'd say that you allow .zips, because that would be dandy ;D

Maybe force people to make short example missions on "desert island", and have them submit that?

Especially when you're using several .sqfs.

I want the function reference to be distinctly different from script snippets - it is a reference for custom commands. I will put in a place to upload zips containing example missions in addition to the single .sqf file.

Quote
_bodyang = [_guard,_deadguard] call loadfile "getang.sqf"

This defeats the purpose of having custom commands (functions) doesn't it? This is the same as:

Code: [Select]
GetAng = preprocessFile  "getang.sqf"
_bodyang = [_guard,_deadguard] call GetAng

Except you could use the GetAng function multiple times. I think that all functions loaded to the function reference should have a name, and people should be encouraged to instantiate them via the preprocessFile command, rather than loadFile.

Quote
i want it automatic - i have som math functions dat i use function in function (based on each other  )  so if i cantel dat it requires other 1s it wil b totaly kool

I will add it.

Quote
Just wanted to clear up that first thing. I know it is like a mini-script and loads faster. Just what exactly makes a funciton more usefull? Can you perform some script-controlled action quicker with a function?

OFP will work with functions (custom commands) much, much faster than it works with scripts.

When you execute a script, it must be read from the hard disk (maybe), loaded into memory and interpreted by the OFP engine every time it is called.

When you preprocessFile a function (which is essentially a script written in a slightly different syntax) it will always be in memory, so the function acts as quicly as any other command.

So, if I made a function called GetPos2, that was similar to the command GetPos, my GetPos2 function would run at a speed similar to normal GetPos function.

If I made a script called GetPos2, when executed it would run much slower than the normal GetPos function.

When you are running a loop that executes a script on every unit in the game, for example, you are looking at a HUGE processor load. If you used preprocessed function (.sqf) files, the processor load is much, much smaller.

So, to summarise ->



Scripts and functions are very similar - but they differ in terms of:



Many of the existing commands could be done better as functions - for example if you want a dude to get out of a jeep you'd have to use:

Code: [Select]
dude action["GETOUT",jeep]
unassignvehicle dude

you could make a function called 'GetDudeOut' by putting the following into a .sqf file:

Code: [Select]
(_this select 0) action["GETOUT",jeep];
unassignvehicle (_this select 0);

(_this select 0);

preprocess the file in init.sqs with:

Code: [Select]
GetDudeOut = preprocessfile "GetDudeOut.sqf"
then call the function wherever you want with:

Code: [Select]
[dude] call GetDudeOut
THE BEST THING ABOUT FUNCTIONS, THAT MAKE THEM TOTALLY DIFFERENT FROM SCRIPTS!

Functions can return values.

In a script, the only way you could return something is by using global variables.

However, using functions you can do this:

dudewhojustgotout = [dude] call GetDudeOut

 ::)

[url removed]func_test.zip]EXAMPLE MISSION[/url]
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 01:36:30
its kinda clearer - but one questionok, ummm, so these commands - do they like come up in the action menu for the player to use? or do they execute exactly like .sqs? - just makes things more simple.

so, umm, how do u make a sqf file? just save from notepad as an sqf?

They don't come up in the action menu - but they could, if you wanted them to (just like you make an action menu item to launch a script)

To make them - yeah, write them and save in notepad. But remember the syntax is slightly different (see the command reference: scripting topics: functions - SQF).

I think i answered your question about how they execute in my previous post.

They are very similar, yeah.

Gotto go back to work, i will return...
Title: Re:BETA: OPFEC Function Reference
Post by: Messiah on 08 Jan 2003, 01:37:08
so - i have a shouting script which makes west units call for a medic when they are injured (just voice calling, doesnt actually make a medic come to them)

now this is used lots of times since it can be called whenever... so i could make this into a function which would make it quicker? so no lag etc?
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 01:46:08
Quote
Except you could use the GetAng function multiple times. I think that all functions loaded to the function reference should have a name, and people should be encouraged to instantiate them via the preprocessFile command, rather than loadFile.

u wil have 2 explain lil more watu meen by dis ;) - i can use da getang function as much as i want in da way i do it now - just write loadfile "functionname"

as i c it da only difrence is dat da procces file is C-Like language while da loadfile is 4 calling files generaly  ;D

from da command referance

Quote
loadFile filename

Operand types:
filename: String
Type of returned value:
String
Description:
Return content of given file.

Example:
loadFile "myFunction.sqf"

Quote
preprocessFile filename

Operand types:
filename: String
Type of returned value:
String
Description:
Return preprocessed content of given file. Preprocessor is C-like, supports comments using // or /* and */ and macros defined with #define

Example:
preprocessFile "myFunction.sqf"

and i think u can define somthin like

Code: [Select]
GetAng = loadfile "getang.sqf"
_bodyang = [_guard,_deadguard] call GetAng

i didnt try but im prety sure ;)

so can  i keep ny things @ loadfile ? ;)

btw snYpir did u write any function?

LCD OUT

 

Title: Re:BETA: OPFEC Function Reference
Post by: Arctic on 08 Jan 2003, 02:21:59
I think I understand it a bit better. Thanks.
I need to try this out now...
Title: Re:BETA: OPFEC Function Reference
Post by: Liquid_Silence on 08 Jan 2003, 02:41:52
Quote
u wil have 2 explain lil more watu meen by dis  - i can use da getang function as much as i want in da way i do it now - just write loadfile "functionname"

as i c it da only difrence is dat da procces file is C-Like language while da loadfile is 4 calling files generaly

Um, basically, the way you are doing it doesn't take advantage of the fact that functions can be run faster, as you run it like a script...

by loading the function into a string with loadFile (which is inefficient as it reads from the HD) you load it into memory, which is then called faster with the call command...

it really doesn't matter if you are only using it once, but any more than once, and you speed up your script by loading it up first (it may not be noticable in some cases, but it's good programming to be as efficient as possible...)

so you are converting the file every single time, whereas with loadfile you convert once...
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 02:53:10
@ liquid silence : - arghhh  ::)

*feels st00pid  ;)

dat meens dat -

if i use

Code: [Select]
GetAng = preprocessFile  "getang.sqf"

or use

Code: [Select]
GetAng = loadfile  "getang.sqf"
in da init.sqs

nd den use it in ny scripts like

Code: [Select]
_bodyang = [_guard,_deadguard] call GetAng
it wil b runing faster right ?

but it didnt exlplain da difrence between

loadfile and preprocessFile right ?

or im just totaly misiong da point ?

 ::)

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 03:27:19
Quote
but it didnt exlplain da difrence between

loadfile and preprocessFile right ?

or im just totaly misiong da point ?

You are right :o

LoadFile appears to do the same thing as preprocessFile.

but they both use the C-like syntax, when used to load a function.

This means that you need semicolons at the end of each line etc...

I proved this by trying normal syntax and C-like syntax in the DudeGetOut.sqf file (in the attached zip)

Quote
btw snYpir did u write any function?

yes :P

the example for my little mini-tutorial up above is attached.

Quote
so can  i keep ny things @ loadfile ?

um, yeah, guess so. but your functions need to use the C like syntax please
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 03:32:43
chek ur IM snYpir  ;) ;D

nd i write all my functions using C like syntax :P - and u can ask messiah how meny functions i have in my script ;)  :P

i just feel beter using loadfile (cuz i know exactly how 2 write it unlike preprocessFile (i copy it from ur posts ;) ;D)

so if u reply 2 my IM it wil b kool  ;D

nd i have som functions 4 u - once u reply 2 it ;D

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 04:55:21
After a little more testing, I think that preprocessFile is the way to go.

preprocessFile -> Compiles the file (most probaly into machine code in memory)

loadFile -> copies the content of the file line-by-line into memory

i will allow people to use loadFile within functions, but i will encourage people to use preprocessFile because it will be faster.

This is fairly advanced stuff i suppose, so i apologise if i am confusing people.  ::)
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 05:03:54
its ok  ;D

i just change da loadfiles to preprocessFile nywere its not a prob  ;)

nd i do understand dat - just need 2 write it plain  ;)  ;D

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: Pandoz on 08 Jan 2003, 06:50:51
hmm i think if some1 knowledgable on this subject *cough*snypir*end cough*:) should write a tutorial that explains the basics and stuff like that...even though the func ref page kinda already explains that...well just write a short one please and maybe give some examples of things u could  do or something...i believe i get it but i am always thinking that and many-a-times i am really wrong.

Pandoz
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 10:23:58
Ok, i hope this is basic enough:

http://www.ofpec.com/editors/tutorial_view.php?id=149

It is not complete, but it is a start. Let me know if any part is not clear, ok?

 ;D
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 13:30:04
LCD: You can now link functions via the submit function screen, and they will be visible in the display view.

KTottE: You can now upload an optional example mission zip in addition to the sqf file.

I think we are getting close to final, once i write up the rules...  ;D

Thanks for all the help dudes - if there are any more suggestions, please send them my way!
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 08 Jan 2003, 13:54:57
Kool  ;D

:thumbsup:

@ snYpir - check ur mail ;) 3 functions are in dere  ;) (used in a script - so u may dont wanna post som of em  :-\)  

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: Spinor on 08 Jan 2003, 19:10:29
Quote
preprocessFile -> Compiles the file (most probaly into machine code in memory)

loadFile -> copies the content of the file line-by-line into memory
I'm not sure about this. According to the ComRef, preprocessFile only preprocesses i.e. you can use
#define aaa BBBBB
to make substitutions
and \\ to make comments.
When executing the function, there should be no difference in speed.
preprocessFile is still the way to go for precaching functions because of the two above advantages.
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 08 Jan 2003, 20:32:12
Yeah, i was wrong (sort of) :-\

Suma made a comment on my tutorial, and yeah both loadFile and preprocessFile do the same thing (except for the preprocessing)

I will encourage people to use preprocessFile.
Title: Re:BETA: OPFEC Function Reference
Post by: Messiah on 09 Jan 2003, 02:07:59
Code: [Select]
_unitarray= _this select 0
_hurt = []
_say = ["eng22","eng23","eng29","eng30","eng31","eng32","eng33","eng34"]

#start
_tmp= (count _unitarray) - 1
?_tmp < 0 : exit

#loop1
_unit = _unitarray select _tmp
? vehicle _unit != _unit : goto "cycle"
? "man" CountType [_unit] == 0 : goto "cycle"
? _unit in _hurt : goto "check"
? getdammage _unit > 0: _hurt = _hurt + [_unit]; goto "speak"

#cycle
~0.05
_tmp = _tmp - 1
?_tmp < 0 : goto "start"
goto "loop1"

#check
? getdammage _unit == 0: _hurt = _hurt - [_unit]
goto "cycle"

#speak
_rand = random 8
_rand = _rand - _rand % 1
_unit say (_say select _rand)
~5
goto "cycle"

so, could i convert that script into a function? its just a pain script - using a list trigger as the array it see's who is hurt and makes them say one of the editor voices, like 'MEDIC!' etc... can that be made into a function?
Title: Re:BETA: OPFEC Function Reference
Post by: LCD on 09 Jan 2003, 02:26:28
no - u cant use delays in functions and u dont wanna make big loops in function cuz it wil b like big loops in scripts only faster  :o

LCD OUT
Title: Re:BETA: OPFEC Function Reference
Post by: Messiah on 09 Jan 2003, 10:44:50
hmmm, well, could some1 post up and example of what you would write? I would like to work this function thing out, as my mission does require many, high end scripts and lag isnt an option.
Title: Re:BETA: OPFEC Function Reference
Post by: toadlife on 09 Jan 2003, 13:12:21
Messiah

Skim through snYpir's tute and visit the section with the few function examples.
http://www.ofpec.com/editors/funcref.php

I just added one, which shuffles an array.  Here is the code for that function for you to look at, only with comments that say what is happening.

Code: [Select]
//****************************************************
//
// Shuffle array function by toadlife
//
// http://toadlife.net
//
// Function: Shuffles an array's contents into random order
//
// Returns: array
//
// Initialize this fuction in your init.sqs file with this line: shuffle = preprocessFile "shuffle.sqf"
//
// Call this function like so:  myarray call shuffle -- (Example: [1,2,3,4,5] call shuffle)
//
//***************************************

// Keeps these variables from being snookered if they're used in other scripts? (not sure about that one)
private ["_this","_newarray","_acount","_rand","_moveitem"];

// Initialize the new array that will be returned after processing
_newarray = [];

// Shuffle code - takes "_this", shuffles the contents and put the contents into "_newarray"
while "count _this > 0" do {_acount = (count _this);_rand = random _acount;_rand = _rand - (_rand mod 1);_moveitem = _this select _rand;_newarray = _newarray + [_moveitem];_this = _this - [_moveitem]};

//This is  the new "shuffled" array. This is what is returned by the function.
_newarray;

Here would be an example:

Code: [Select]
_say = ["eng22","eng23","eng29","eng30","eng31","eng32","eng33","eng34"]
_hurt = []
#loop
~0.05
_soldiers = list mytrigger call shuffle
if ((getdammage _x > 0) && ("man" counttype [_x] == 1) && (!_x in _hurt) then {_hurt = [_x] + _hurt;[_x,_say] call injured} foreach _soldiers
if ((_x in _hurt) && getdammage _x == 0)  then {_hurt = _hurt - [_x]} foreach _soldiers
goto "loop"

Code: [Select]
//****************************************************
//
// Injured function by toadlife
//
// http://toadlife.net
//
// Function: Caused an soldier to scream out a random saying
//
// Returns: nothing
//
// Initialize this fuction in your init.sqs file with this line: injured = preprocessFile "injured.sqf"
//
// Call this function like so:  [soldier,[sounds]] call injured -- (Example: [unit1,["bum",crap","shiznit"] call injured)
//
//***************************************
private ["_rand"];
_rand = random count (_this select 1);
_rand = _rand - _rand % 1;
(_this select 0) say ((_this select 1) select _rand);

NOTE THAT THE PRECEEDING EXAMPLE HAS NOT BEEN TESTED FOR SYNTAX ERRORS OR OTHER MISC. BRAIN FARTS!  ;D
Title: Re:BETA: OPFEC Function Reference
Post by: Messiah on 09 Jan 2003, 13:24:16
hmmm, ok, i'll have to work it out... cheers.
Title: Re:BETA: OPFEC Function Reference
Post by: toadlife on 09 Jan 2003, 13:28:08
Note:

Why you would want to shuffle the list of soldiers in your partucular script is beyond me :) -- I just inlcuded the function as an example. You could break your script down into more functions if you wanted to, though, I'm not sure what the benefits would be.

You could go function crazy, and make the line that removes soldiers from the "_hurt" array into a function.
Title: Re:BETA: OPFEC Function Reference
Post by: toadlife on 09 Jan 2003, 21:54:11
HOw would you include multiple scripts in a pbo file? I tried and can't seem to access them once they are pbo'd.
Title: Re:BETA: OPFEC Function Reference
Post by: KTottE on 09 Jan 2003, 22:58:27
Why would you want to .pbo only scripts anyway?

I suggest looking at the config.cpp for the entire game, and scripts.pbo
I'm sure those will tell you what to do.
Title: Re:BETA: OPFEC Function Reference
Post by: toadlife on 10 Jan 2003, 02:55:50
Why would you want to .pbo only scripts anyway?

I wouldn't. I would cause more problems than it would solve. At first I though it would be neat to include the functions in an addon, but when I envision the problems that addons allready cause, I think it would be a disaster. Nevermind :P
Title: Re:BETA: OPFEC Function Reference
Post by: snYpir on 10 Jan 2003, 03:05:37
The 'function library' is now officially open. Now, everyone please upload their functions! ;D

There is also a massive tutorial on how to write functions, accessable from the function library main page.
Title: Re:OFPEC Function Library Launched!
Post by: Turver on 01 Mar 2003, 18:41:11
i thought u guys needed cheering up  ;D
Title: Re:OFPEC Function Library Launched!
Post by: Sui on 02 Mar 2003, 05:06:33
Turver,

while that's good for a laugh, could you please refrain from posting off topic stuff in the Announcements forum... ;)

We do some serious stuff in here! ;D
Title: Re:OFPEC Function Library Launched!
Post by: joltan on 18 Jul 2003, 11:34:22
Ok, one question remains after skiming trough the function tutorial and the library. The fact that a function effectively halts the script it is executed from until completion (else it couldn't possibly return a value) may not always be a good thing. The executed script may require some pauses without stopping the main script.

Is it possible to preload (with loadFile) a normal script, so the computer doesn't have to access the harddisk (reducing lag if the script is executed with a high frequency), but still having it run as a seperate, independent script (thus allowing for pauses, halts, loops, etc.)? Something like
Code: [Select]
MyScript=LoadFile "myscript.sqs"
...
[] exec  MyScript
No, from my testing the example doesn't work, but it would be nice if something similar would be possible.
Title: New team, PITA (Pilots In The Army)
Post by: joand_91 on 19 Sep 2003, 15:55:04
I've started a new team called PITA (Pilots In The Army) and if someone want to join call me at ICQ 311803819... We need scripters, modellers and texturers for the moment

Whit a please from Johan, Sweden
Title: Re:OFPEC Function Library Launched!
Post by: KTottE on 19 Sep 2003, 17:39:11
joand_91, if you are looking for people, please use the Recruitment depot (http://www.ofpec.com/training/index.php).
This thread is for discussing the OFPEC function library.
Title: Know
Post by: joand_91 on 21 Sep 2003, 19:13:40
I know it is for OFPEC Function Library, but I used it anyway.
I know I can find pepole in recueirments depot, but its taking long time to e-mail all of them
Title: Re:Know
Post by: Kaliyuga on 21 Sep 2003, 20:01:30
I know it is for OFPEC Function Library, but I used it anyway.
I know I can find pepole in recueirments depot, but its taking long time to e-mail all of them

Gee.. so you know what the rules are and yet you still break them, that says alot....

real nice
:thumbsup:
Title: Re:OFPEC Function Library Launched!
Post by: Captain Winters on 22 Sep 2003, 03:55:10
Seriously... U coulda started ur own thread to get locked instaed of.... oddly.... posting in this one.  :P

GO WITH THE LIBRARY!

Tanks! 8)
Title: Re:OFPEC Function Library Launched!
Post by: Raptorsaurus on 25 Apr 2004, 22:38:28
I have a bunch of new functions I wrote for the super guided missile script and also for the Tomahawk Cruise Missile project.  I would like to submit some of these, but it won't let me.  When I click on "Add Function" it just returns me to the same page.
Title: Re:OFPEC Function Library Launched!
Post by: toadlife on 26 Apr 2004, 01:19:36
I have a bunch of new functions I wrote for the super guided missile script and also for the Tomahawk Cruise Missile project.  I would like to submit some of these, but it won't let me.  When I click on "Add Function" it just returns me to the same page.

I've fixed the function submission page. You should now be able to submit your functions. :)

Let me know of any problems you have.
Title: Re:OFPEC Function Library Launched!
Post by: revellion on 27 Apr 2004, 11:15:10
Problem Found in the function page!, more precise the: Introduction to Functions

Error!:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/local/www/ofpec/editors/tutorial_view.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/ofpec/editors/tutorial_view.php:4) in /usr/local/www/ofpec/editors/tutorial_view.php on line 5

.....
Title: Re:OFPEC Function Library Launched!
Post by: toadlife on 27 Apr 2004, 18:52:13
Quote
Problem Found in the function page!, more precise the: Introduction to Functions

Error!:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/local/www/ofpec/editors/tutorial_view.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/ofpec/editors/tutorial_view.php:4) in /usr/local/www/ofpec/editors/tutorial_view.php on line

Fixed.
Title: Re:OFPEC Function Library Launched!
Post by: DBR_ONIX on 10 May 2004, 18:05:32
Yeah, I still (Today) get MySQL errors  >:(
I think it was in the misc scripts

Which is a shame, because some of the scripts look really useful :)
- Ben
Title: Re:OFPEC Function Library Launched!
Post by: toadlife on 12 May 2004, 00:56:11
Where exactly are you getting errors? "Misc Scripts" doesn't help me.
Title: Re:OFPEC Function Library Launched!
Post by: Microsoul V3 on 31 Dec 2004, 04:24:12
I assume that the ECP project is gone, right? I still have these files on my PC, and I used to use them, but without the flashpointbeta.exe, it dont install, which really sucks cuz I loved the sound mod....it totally ruled. I am a bit out of the loop, as i have been playing MOHAA and BFV for some time, but I wanted to come back to flashpoint, cuz I think its the best game ever.
Title: Re:OFPEC Function Library Launched!
Post by: MachoMan on 31 Dec 2004, 12:01:10
Uhummmm..... look on the fronpage (http://www.ofpec.com/) m8.

Also check the official forums thread on the new ECP version. (http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=d80819bb19bc5ae53da8ba9ce3a23e9f;act=ST;f=4;t=44012;st=0)
Title: Re:OFPEC Function Library Launched!
Post by: RichUK on 20 Jul 2005, 04:31:10
I love the the function reference and have downloaded all of the current functions that I can, but have found two problems with the download links:

1.  MySQL Errors (which someone tried to refer to previously).  All of the Functions listed with the funciton name (e.g. <whatever>.sqf download correctly, but there are a few (like GetPitch) that say "Click here to download.." where clicking "here" is the broken link giving:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/local/www/ofpec/editors/snippet_view.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/ofpec/editors/snippet_view.php:4) in /usr/local/www/ofpec/editors/snippet_view.php on line 5


2. Download example mission links, link to the function sqf files, the same as the <whatever>.sqf  links, so I am unable to download any of them (which makes understanding the functions more hard work...).

There is some extremely useful stuff in here, and I will definitely contribute, once I produce something worthwhile that could help others ...  :)