Home   Help Search Login Register  

Author Topic: What OFP Does With Your Script File  (Read 4336 times)

0 Members and 1 Guest are viewing this topic.

Bluelikeu

  • Guest
What OFP Does With Your Script File
« on: 13 Jul 2005, 23:23:07 »
Hey all,

I'm starting this thread so that people understand what OFP does with your script file during the game. Through experience and testing, it can be concluded that the script file that you place in your mission directory is not loaded into the memory for later use. This means that the script file is read/re-read upon its execution. You may think that this quite possibly would slow down the initialization/proccesses within the script. However, this has not been concluded yet. The speed difference might be quite minimal had the entire script been put into memory considering the size of the script.

Since OFP does not load the script into memory, it it possible to edit the script externally outside OFP while the game is running. I know that many people have tried to edit it and it says that the 'file is already in use by another program.' This is because OFP reserves the file for its own usage. However, this can be exploited through the use of other programs that can 'steal' access to the file and force the system to refuse OFP access.

These are some reasons why this is good for us:
    1. This allows us to edit script during gameplay through the use of an external program that runs with OFP

    2. New programs/methods of changing one's scripts during gameplay may sprout up. This will allow mission designers/scripters to experience a new field in the scripting realm that allows for dynamic editing/swapping of script files during gameplay.

    3. Needs for such people who can edit/create these programs will now be useful to OFP Mod/Mission design teams.

So far, it appears that the proccess that loops go through within a script is still not fully understood. With more testing, I believe that we can find the answer to that question.
The file is not closed after one loop is completed, OFP simply goes back to the beginning of the loop and starts from there again, therefore, no editing can occur during loops.

Thanks for reading,
Bluelikeu
« Last Edit: 14 Jul 2005, 18:35:10 by Bluelikeu »

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:What OFP Does With Your Script File
« Reply #1 on: 14 Jul 2005, 17:47:48 »
Bluelikeu,

Yes U can change scripts in the editor,while OFP is running.OFP will simply execute the edited version when asked.But this is not working with PBO versions like u mentioned.And the reason is simple:MULTIPLAYER!

If U find a way to change scripts while the game is running,like u describe in your openingspost,it would simply mean the end of MP games...

Once a game is started the map is loaded into MPMissionCache,having the ability to change this folder/scripts while OFP is running would give clients a wildcard to edit the settings in any way they like ..Viewdistance,dammage player,etc could be changed on a clients machine without being able to notice anything.

No need to go in detail any further,and I also have no doubts about the good intentions of your post,but I think this is tricky and might lead to abuse.

I would like to ask to be careful when U investigate this subject further.


PP
http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #2 on: 14 Jul 2005, 17:54:54 »
Even if clients change the scripts in the cache, it will not change the game. It might change things for them during the game, but since the game is run off someone's server, the game itself it not affected. The OFP client simply recieves information, and only sends key/mouse input, and maybe a few other pieces, but nothing that can affect multiplayer. If scripts are too be changed, it must be done on the server's computer, and that is the only way that can be done.

Edit: Just to stress what I already said....The server handles everything, no abuse can occur from clients.
« Last Edit: 14 Jul 2005, 17:58:09 by Bluelikeu »

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #3 on: 14 Jul 2005, 18:05:53 »
My test version is ready, but if people feel like it would cause problems, then please specify this...i'll be posting it in 1 hour, unless someone says no.

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:What OFP Does With Your Script File
« Reply #4 on: 14 Jul 2005, 18:14:24 »

Edit: Just to stress what I already said....The server handles everything, no abuse can occur from clients.

This is unfortunately not true m8.

Many scripts only run local (?(local player):[] exec "script.sqs").

It is possible to run the game while everybody has different lightsettings (daytime),as I found out when I
screwed the implementation of the random command in MP.Every client runs his own OFP,the server is just there to syncronise.
http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #5 on: 14 Jul 2005, 18:29:38 »
Yes, but this only occurs on the clients computer and does not affect the others. But ofcourse it is handly to be able to change the daylight. If your mission is pbod, i don't think that one can open it, without first decrypting it, which i don't know how to do.

I'll find a way to edit the prog so that there is some sort of security

Btw, for some reason before using my program i couldn't open the script files during the game. Thats why i made it, but now it seems that this change is permanent, maybe it was only by computer. Did anyone get the "cannot open this file because it is already in use" error when opening and editing your script file during the game?
« Last Edit: 14 Jul 2005, 18:30:35 by Bluelikeu »

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #6 on: 14 Jul 2005, 18:47:17 »
I believe that people could access a script and change a script while playing in a mission. Right?

Just want to make sure that its just not me who could not open a script while I was in a mission. Please try this:

Open Operation Flashpoint

Load a mission from your mission editor(make sure that it has some scripts)

alt-tab, and try to open one one of the script files.

Tell me what happens after that

Thanks
« Last Edit: 14 Jul 2005, 19:09:22 by Bluelikeu »

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:What OFP Does With Your Script File
« Reply #7 on: 14 Jul 2005, 19:46:24 »
You can open and edit scripts in the editor,in the MP editor means the file is in Yellow.In SP U talk about a "custom mission".

-->Load a mission,alt-tab,U can now open\edit .sqs files.
If U execute the edited script OFP will just read the edited version.

You can open PBO-ed maps\missions (After U UNPBO it),when OFP is running (Green files in MP editor or Maps downloaded from a server),but you CANT edit them.(OFP will reply that the file is in use)

-->Join any server,vote yourself admin,choose a map,assign,click start,U recieve the map and U are ready to go.Now ALT-TAB,open OFP\MPMissionCache,UNPBO the map.

U can see all the UNPBO-ed info (READ only),but you cant change anything.(reasons why explained in previous posts)

Again my point:the ability to change these scripts while OFP is running would be horrible for MP gaming.
http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #8 on: 14 Jul 2005, 20:06:14 »
Ok, i see the problems, but the program couldn't affect anything even if it wanted to, at this stage.

"Again my point:the ability to change these scripts while OFP is running would be horrible for MP gaming. "

So you couldn't open script file from a mission while you are in the game playing a mission, while shooting tanks and stuff. Just want to make sure, because i might have been unable to do that all along, while others were. If you could already do that it defeats the purpose of the program

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:What OFP Does With Your Script File
« Reply #9 on: 14 Jul 2005, 20:15:15 »
Please try this:

Open Operation Flashpoint

Load a mission from your mission editor(make sure that it has some scripts)

alt-tab, and try to open one one of the script files.

Tell me what happens after that

Thanks
I started a looping sqs in OFP (with a radio trigger), tabbed out, opened the script, made changes and saved it without any probs (using Chris' OFP Script Editor)...
Then went back to OFP and it was still looping the original script without any problems...
Although, OFP pauses it's activities (incl. scripts) when tabbed out...

Then I re-executed the script with the radio trigger again (without stopping the original loop) and then OFP ran the original loop (which basicly doesn't physically exist anymore) and the same edited loop...
« Last Edit: 14 Jul 2005, 20:16:14 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #10 on: 14 Jul 2005, 20:29:56 »
hmm, for me its different, I start a script, start playing the mission, and the script is working and then ends(no loops). Then I alt-tab and edit the script and change a few things. Then call the script again and the script has changed, and does what i did to it.

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:What OFP Does With Your Script File
« Reply #11 on: 14 Jul 2005, 20:59:36 »
Unfortunately Blue, you've made the wrong leap. A script, any script, is retained in memory for the duration of that script. The file from whence the script came is locked during that time, but it, the file and it's contents are *never* re read.

When the script 'exits' it's lifetime is over, and any subsequent calls via exec to the script re-read the file contents.

The best example of this is a script that never exits, ie a slow housekeeping script. You can even, exit ofp and start again, the file is NEVER re-read. You can alter it to your hearts content, it makes no difference.

Instead, the script content that *was* in memory, is retained in one of the xyz. fps files that are loaded on a game/mission/campaign restart.

This should explain the apparent discrepencies between what you vs others are reporting. Between exec and exit, the content of a script is retained in memory.
Just say no to bugz

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:What OFP Does With Your Script File
« Reply #12 on: 14 Jul 2005, 21:14:36 »
Hi Bluelikeu,

are you sure the 'something what you want but I'm not exactly sure what it is' can't be achieved with Kegetys' fwatch utility?

http://ofp.gamezone.cz/index.php?showthis=8361

It's for Windows only so it can't be used on Linux servers. But it might be a tool that can do the job you want, in SP missions.

If I understood your posts correctly, you want to have a way to dynamically create and manipulate data that is being fed to OFP while playing. And as far as I'm concerned, fwatch can do that.

I haven't had the time to play around with it but it's for sure a very interesting tool.

Bluelikeu

  • Guest
Re:What OFP Does With Your Script File
« Reply #13 on: 14 Jul 2005, 22:53:58 »
@mikero
You are right, the script goes into memory for the time being, however, once the script is finished, or forced to exit(by an outside force), OFP trashes it and re-reads it once the script is executed. I've tested it in-game with a small example program. I have two scripts, one that is a loop and executes and empty script file once every couple of seconds. I used the program to hold script file and write data to it, such as a hint command. When the looping script repeats the execute command, the hint command pops up in the game. This shows that the scripts are not held in long-term memory.

Well, the idea was to create an easy java editor for this. You could "insert", so to speak, scripts at certain times in the game, or even block OFP from running certain scripts, and even parts within a script. The tool would be mainly meant for "during play" editing of scripts and such. In the case of a single play mission, the mission maker could create his own "programme" for which he has planned for the user. Certain options that could not be easily used in scripting can be easily manipulated from outside OFP.. From what I understand fwatch only allows you to do certain things from within the scripts, for example, the 30 or so commands provided with it.

Btw, if you want fwatch to work on linux servers, use a program known as "Wine" it can be easily found online, just search into google, "Wine Linux".
« Last Edit: 15 Jul 2005, 00:14:46 by Bluelikeu »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:What OFP Does With Your Script File
« Reply #14 on: 15 Jul 2005, 16:08:05 »
Btw, if you want fwatch to work on linux servers, use a program known as "Wine" it can be easily found online, just search into google, "Wine Linux".

Does OFP Linux dedicated server work in combination with fwatch running in Wine? Are you sure about that?

#Edit

...and I still think what you are trying to accomplish could be done with fwatch. You just would have to write the scripts so that they take advantage of fwatch's functions. You could pass data from an OFP script to fwatch, then modify it and bring it back and use in a script. Have I completely lost the track here...?
« Last Edit: 15 Jul 2005, 16:13:43 by Baddo »