OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: DBR_ONIX on 12 May 2005, 22:53:07
-
Thought you lot should know :)
This (http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=d1d43597bbc105fbf26d6a661e849102;act=ST;f=7;t=46245;st=60)
Basicly lets you do
loadFile ":command", and it can do stuff like write to a file, read from a file (If not now, it will be added, thats about second version of it so far)
"Lots of uses" is understatement :)
Urgh, to tired to promote this better :P
- Ben
-
Can you explain some more please? What exactly does it do? cheers ;)
-
Functions reference:
"\:version:" returns version string
"\:time:" returns your local time
"\<sometext" appends "sometext" to log.txt in the OFP directory
"\|test.txt:sometext" appends "sometext" to test.txt in the OFP directory
"\|test.txt?sometext" clears test.txt and writes "sometext"
"\*hello" returns a string containing an array of chars
Ex.:
stringarray = call loadfile "\*hello"
stringarray will be ["h","e","l","l","o"]
Basicly you can write to a file, which can do stuff like saving MP (Similar to Sinews of War), you can trigger an external program form flashpoint, to, for example, take a screenshot by using a command in a script or trigger, even things like missionStart command not working in Single Player has been overcome with the :time: function. I could go on for hours, but...
Like I said, it's still early version, even still the uses for it are great
- ben
-
Yeah, I've been following that thread...
When you say write/read from a file does this mean you can write say config 'on the fly' (like via init eventHandler) and then read that written config and have the configged stuff to be camCreatable/createVehicleable in-game without re-booting OFP?
(afaik VBS has readFromFile and writeToFile type of functions...)
Man it would be great if that lot could figure out a way to detect which pbo and which file in it OFP accesses etc...
Could make new 'real' custom functions possible ;)
This also makes me wish I could actually code some 'real' code instead of this OFP sqs/sqf :'(
-
You can't change PBO files on the fly, sadly.. But.. it seems some stuff (Scripts I know for sure, textures with setobjecttexture, models I assume, not got round to trying yet) all can be used outside of PBOs.
Configs are all read on startup, so theres no way to change them without restarting OFP:(
But, scripts can be changed on fly, as my "I was bored and wanted to make something"-project will demostrate when I fix it up (Nearly done), it lets you chat from a Visual Basic client to Flashpoint, using a dynamicly changed script
Also, you can access scripts in root of OFP folder, by using this exec "../../../TheScript.sqs"
Detecting when a file is accessed isn't possible, as OFP doesn't update the Last Accessed meta tag, or load it into memory (Make it un-writable, which you can check easily enough in Visual Basic, and less easily in C :P)
As for programming, I suggest you learn Visual Basic, www.planet-source-code.com is good, try and make something, like a simple chat program, you can learn most of what you need to make stuff from that, the rest just search google for.
If you want help with VB, contact me on MSN if you have it :)
- Ben
- Ben
-
The :time: part has got me excited. What script has always lacked is an accurate way to measure how much time has passed (as I have discussed in other threads), since the time which passes when you execute the sleep function is in no way related to the number you put after the ~.
Does this script provide a solution? Does it get deltaTime values from your computer's clock, or something like that?
All the other implications sound most exellent too.
@HateR_kint
If you can write .sqf files you have a good grounding for understanding programming in other languages. If you want some help learning C++ or Java PM me ;). Of course, there are lots of things about these languages that scripting for flashpoint doesn't even touch on, but they're generally easy enough to learn as you go.
-
The :time: part has got me excited.
Quite, and if you check out the thread now, Kegetys has added some more features into his version, like detecting mouse state, detecting if a certain key is pressed etc....
Opens up some great new features...
If you guys could add a couple of features more to the 'thingy' (you better come up with a name for it.. ::) ), like checking on which key is binded to which action we could finally get the damned getUnitStance function... ;)
Yeah well, scratch that idea ;)
As for programming, I suggest you learn Visual Basic, www.planet-source-code.com is good, try and make something, like a simple chat program, you can learn most of what you need to make stuff from that, the rest just search google for.
"..."
If you can write .sqf files you have a good grounding for understanding programming in other languages. If you want some help learning C++ or Java PM me . Of course, there are lots of things about these languages that scripting for flashpoint doesn't even touch on, but they're generally easy enough to learn as you go.
I have learned C basics some time ago, but if someone would come up to me now and ask me to write a 'program' that would print that "hello world" it would not happen ::)...
The only thing I can remember from C is the one #include you put in the beginning of the code (when you only need any thos 'n00b' functions)... ;D ::)