Home   Help Search Login Register  

Author Topic: Mod 'realtime' modification  (Read 2388 times)

0 Members and 1 Guest are viewing this topic.

Offline Gonso777

  • Members
  • *
Mod 'realtime' modification
« on: 10 Apr 2016, 17:52:57 »
Good afternoon,
I am trying to modify an existing mod in .pbo format. Trying out changes to script files takes long due to being forced to:

1- Stop ARMA 2
2- Modify the script
3- Compress it to .pbo format
4- Relaunch ARMA
5- Check changes.

- Is there any way to keep ARMA Running and modify mod's scripts in real time and forcing ARMA to reload them?

Thank you very much.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Mod 'realtime' modification
« Reply #1 on: 11 Apr 2016, 18:21:59 »
There is, goes something like this:
You have the mod pbo files AND the pbos as folders in the same addons folder (as in the mod's addons folder obviously) and the game should read the unpboed data so you should be able to make changes in scripts in runtime..
Now to think of it, sounds way too easy so there's probably something else needed too :P
Like you may need something called $PBOPREFIX$ in your unpboed folder (it's basically a file with path to your mod pbo: myMod\myAddon).

Functions obviously need to be recompiled before testing so if functions are config defined (CfgFunctions) this won't help and you still have to do that annoying re-pbo dance.
« Last Edit: 11 Apr 2016, 18:29:58 by h- »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Gonso777

  • Members
  • *
Re: Mod 'realtime' modification
« Reply #2 on: 14 Apr 2016, 11:46:31 »
As far as I understand, changes in scripts force a recompilation, so scripts are compiled instead of interpreted. Correct me if I am wrong, but this makes testing a pain in the neck.

Isn't it possible to convert a CfgFunction to a normal non-precompiled one? I am working on a .hpp and making changes to it and testing the results is resulting very slow. ARMA 2 seems to precompile the mod, so reloading the mission does not work and I would still be forced to get out of ARMA 2 and launch it again everytime I wanted to test a tiny change.

 Would converting the mod to a normal mission file be possible and, if so, would it solve the situation at all?

Thank you very much indeed.

« Last Edit: 14 Apr 2016, 11:56:41 by Gonso777 »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Mod 'realtime' modification
« Reply #3 on: 14 Apr 2016, 16:45:35 »
I'm really bad at explaining stuff, but I'll try:

Quote
As far as I understand, changes in scripts force a recompilation
I'm not sure if we're talking about the same things, but this is how it is as far as I know:

Scripts are the ones executed with execVM and run in scheduled environment and are interpreted (or whatever it's called) when executed.

Functions are the ones that are called and run in unscheduled environment, and are either precompiled code (compile preprocessfile) or inline functions when they're defined inside the running code (_func = {<code>}; call _func). These obviously require recompiling; I don't mean making a pbo, but compiling with compile preprocessfile) before code changes take effect. CfgFunction compiles the functions defined in it.

That precompiled/inline code can be run in scheduled environment with spawn, but that has nothing to do with this..


Here's a Biki article about the developement setup I tried to describe in my previous post:
https://community.bistudio.com/wiki/CMA:DevelopmentSetup

Anyway, all of the scrpts/functions can be edited while in-game with the setup described above if the functions are not defined by CfgFunctions.
Although, now to think of it (and to confuse more), IIRC Arma2 function viewer has the 'recompile' button on it so actually it could be possible to edit CfgFunctions defined functions with the above setup hassle as well  :hmmm:
Not entirely sure, haven't done anything with A2 for so long and in A3 the recompile button is disabled.

If function is defined in mission description.ext CfgFunctions then editing the code and reloading/saving the mission re-loads the description.ext and the functions get compiled again, edits and all.
If functions are 'initialized' in some separate script all you need to do is execute that script and functions get recompiled, even while previewing the mission.

So if you're editing config files (be it *.inc, *.h, *.hpp, *.cpp..) you always need to re-run the game, I think with the development setup you don't have to pbo the addon though but that doesn't help much I guess.

I'm very low tech when it comes to my modding so I only recently in Arma3 understood (sort of) how that pbo + unpacked pbo setup works but it doesn't help me much as I tend to fiddle with configs as well. Unless I'm completely misunderstanding how that setup works and if so getting angry at myself as we 'speak' :P

My modding usually involves a ton of scripting so I usually start all things I do on 'mission level', as in all the scripted stuff runs in a test mission to allow easy editing and once it starts to be in a good shape I move it into 'addon environment' hoping that developing far enough on 'mission level' shortens the period I have to to that start game/close game stuff.

Quote
Isn't it possible to convert a CfgFunction to a normal non-precompiled one?
Yes, you can copy the function .sqf file from the mod folder into some mission folder, compile preprocessFileLineNumbers it and call it in the mission the same way you would do for any normal function you might use in a mission.

But, if you are editing a config and not function/script you can't do that any other way than how you've been doing it.

Although, things can get a tad confusing here: if the scripts use for example #include "some.hpp" the .hpp file in questions is .sqf code too (they're just plaintext files) so what can and can not be edited while the game is running is not dependent on the filetype alone, it's what inside the file that counts.

Quote
Would converting the mod to a normal mission file be possible
Depends on the mod, unless the whole mod is only .sqf code and the CfgFunctions class in it's config the answer is 'no'.
« Last Edit: 14 Apr 2016, 17:52:32 by h- »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.