Home   Help Search Login Register  

Author Topic: OFPEC Function Library Launched!  (Read 14442 times)

0 Members and 1 Guest are viewing this topic.

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
OFPEC Function Library Launched!
« 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:

  • Intro to functions
  • Writing functions

    By the way - the upload part of the function library works. Use it ;)

    I think it might be worth letting some other sites know about this too, eh?
« Last Edit: 10 Jan 2003, 03:21:23 by snYpir »
Bohemia Interactive Simulations

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:BETA: OPFEC Function Reference
« Reply #1 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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Gastovski

  • Members
  • *
  • #loop; Gastovski setdammage 0; ~0.01; goto "loop";
    • Falklands Mod
Re:BETA: OPFEC Function Reference
« Reply #2 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...

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:BETA: OPFEC Function Reference
« Reply #3 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?
Proud Member of the Volunteer Commando Battalion

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:BETA: OPFEC Function Reference
« Reply #4 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 thread) :-[
Bohemia Interactive Simulations

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:BETA: OPFEC Function Reference
« Reply #5 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? ???
Bohemia Interactive Simulations

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:BETA: OPFEC Function Reference
« Reply #6 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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:BETA: OPFEC Function Reference
« Reply #7 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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:BETA: OPFEC Function Reference
« Reply #8 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?
Bohemia Interactive Simulations

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:BETA: OPFEC Function Reference
« Reply #9 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?
Bohemia Interactive Simulations

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:BETA: OPFEC Function Reference
« Reply #10 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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline KTottE

  • Former Staff
  • ****
Re:BETA: OPFEC Function Reference
« Reply #11 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.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline Arctic

  • Members
  • *
  • In Utero
Re:BETA: OPFEC Function Reference
« Reply #12 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?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:BETA: OPFEC Function Reference
« Reply #13 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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:BETA: OPFEC Function Reference
« Reply #14 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?
Proud Member of the Volunteer Commando Battalion