(fn_selfactions) Help Needed

I've constantly had problems with scripts breaking each other when they need codes put in the fn_selfactions.sqf when another script has a piece of code in there as well. Some scripts work well together, but Single Coin Currency made and script that had code in that .sqf not work. How can I work around this, I've heard custom fn_selfactions.sqf and reseting your init.sqf's "call compile preprocessFileLineNumbers=" back to default, blabla, but wouldn't I need to reinstall all of my scripts to that custom fn_selfactions.sqf and with all of those back in there, wouldn't that cause the same problem? Sorry, if my question is unclear.

Running:
DayZ Epoch Chernarus 1.0.5.1
 
The answer is that if you have any custom actions, you need them in a custom fn_selfactions.sqf file .. so you are correct, if you point to the original seflactions then you lose all the customizations.
You just have to be careful when editing the selfactions .. its almost always user error as the code doesnt affect any variables.
To help understand how it works:
Every frame, the game reads the fn_selfactions from the top to the bottom. It checks what you are looking at (cursortarget), if you are on a ladder or in a car etc etc. Then it goes through a series of checks to see if it should display a menu or not.
To take an example for the self_bloodbag.
check is player in combat?
check does player have a bloodbag?
check if player is in combat?
Do we show the "Self-Bloodbag" menu action based on all those checks?

So each 'action' is a separate block of code and its checking the current state of your game and inventory. If the code changes any of the variables then it is written incorrectly. If it breaks the server, then you put it inside of some other code block. You have to use the notepad++ ability to show opening and closing braces to help you put it in the correct place.
 
The answer is that if you have any custom actions, you need them in a custom fn_selfactions.sqf file .. so you are correct, if you point to the original seflactions then you lose all the customizations.
You just have to be careful when editing the selfactions .. its almost always user error as the code doesnt affect any variables.
To help understand how it works:
Every frame, the game reads the fn_selfactions from the top to the bottom. It checks what you are looking at (cursortarget), if you are on a ladder or in a car etc etc. Then it goes through a series of checks to see if it should display a menu or not.
To take an example for the self_bloodbag.
check is player in combat?
check does player have a bloodbag?
check if player is in combat?
Do we show the "Self-Bloodbag" menu action based on all those checks?

So each 'action' is a separate block of code and its checking the current state of your game and inventory. If the code changes any of the variables then it is written incorrectly. If it breaks the server, then you put it inside of some other code block. You have to use the notepad++ ability to show opening and closing braces to help you put it in the correct place.

I've got a few scripts working in my default compile>fn_selfactions.sqf, so could I just make a custom fn_selfactions.sqf in a custom folder in the root of my mission folder, for my new scripts? There for keeping my scripts in my original fn_selfactions.sqf and not having to re-install them all. Then, just adding a new fn_selfaction.sqf for the new scripts.

Also, would I have to make a new fn_selfactions.sqf for each script?

Again, thank you very much for the response! :D
 
To make this easier.. What I'm trying to do is install this:
http://epochmod.com/forum/index.php...cy-30-storage-default-hive-no-global-banking/

It's the SingleCoinCurrency. I installed it, it worked, but all my other scripts using fn_selfactions didn't as I added the fn_selfactions.sqf code to my original fn_selfactions.sqf.
He gave an overwrite fn_selfactions.sqf, which is located with other things in; ZCS>compiles>fn_selfactions.sqf, in the root of my mission.pbo. Could I leave it there and it would work? Nothing is calling to it from my compiles I think.

I went ahead and did this, as I didn't want it to stop calling my original, but I wanted it to also call my new one.

Code:
fnc_usec_selfActions =            compile preprocessFileLineNumbers "compile\fn_selfActions.sqf";        //Checks which actions for self
    fnc_usec_selfActions =            compile preprocessFileLineNumbers "ZSC\compiles\fn_selfActions.sqf";

The top one is my original one and the bottom is my new one. (This is in my compiles.sqf)derrrr..
(Which didn't work)
I also tried:
Code:
fnc_usec_selfActions =            compile preprocessFileLineNumbers "compile\fn_selfActions.sqf,ZSC_selfActions.sqf";        //Checks which actions for self
(Which didn't work)

http://opendayz.net/threads/general-problems-with-all-scripts-using-fn_selfactions-sqf.14683/
This link helped me get a little bit of an idea of what to do, but it doesn't explain what to do for multiple scripts.
Would I make more fn_selfActions.sqf's under different names, or?..
 
you use a SINGLE fn_selfactions (thats my preference). It is possible to add other fn_selfactions that only contain the changes, but IMHO that makes it confusing because you have multiple files. Keep everything in a single file that you can refer to as the single entity that it is meant to be.

So take your fn_selfactions.sqf that you import from dayz_code.pbo into your mission folder and just add the actions that you want (or alter existing ones)
What you show above
Code:
fnc_usec_selfActions =            compile preprocessFileLineNumbers "compile\fn_selfActions.sqf";        //Checks which actions for self
    fnc_usec_selfActions =            compile preprocessFileLineNumbers "ZSC\compiles\fn_selfActions.sqf";
When the game calls the fnc_usec_selfactions to execute the code that checks if menus should be loaded every frame .. which bit of code is being loaded? Not the original actions! its loading the sqf file with whatever you put in the second file.
Simple example ... those lines in the compiles.sqf are 'variables' that are equal to code instead of numbers. So if we had a variable named
fnc_usec_selfactions = 2 and then right below it is
fnc_used_selfactions = 4
... what is fnc_usec_selfactions equal to? Obviously 4. Same thing in your compiles.sqf, you have changed the code that is exectued. You wanted to add your code to the existing code but instead you overwrote it. And that is why your new action worked but none of the original actions.

SOLUTION: take the original fn_selfactions.sqf and insert your new code into it. So you are adding new actions to the existing actions.
 
Back
Top