Home   Help Search Login Register  

Author Topic: Scripting break though thingy  (Read 1602 times)

0 Members and 1 Guest are viewing this topic.

DBR_ONIX

  • Guest
Scripting break though thingy
« on: 12 May 2005, 22:53:07 »
Thought you lot should know :)
This

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

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Scripting break though thingy
« Reply #1 on: 13 May 2005, 02:15:17 »
Can you explain some more please? What exactly does it do? cheers ;)

DBR_ONIX

  • Guest
Re:Scripting break though thingy
« Reply #2 on: 13 May 2005, 13:37:14 »
Quote

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

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Scripting break though thingy
« Reply #3 on: 13 May 2005, 14:45:22 »
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 :'(
« Last Edit: 13 May 2005, 14:47:27 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

DBR_ONIX

  • Guest
Re:Scripting break though thingy
« Reply #4 on: 13 May 2005, 15:20:30 »
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

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Scripting break though thingy
« Reply #5 on: 14 May 2005, 01:36:46 »
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.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Scripting break though thingy
« Reply #6 on: 14 May 2005, 10:35:38 »
Quote
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 ;)

Quote
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 ::)
« Last Edit: 14 May 2005, 15:22:08 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.