Jump to content
  • 0

Scripting my first Epoch Addon - Experienced Advice Needed


Redbeard Actual

Question

I've spent about a year and a half learning whatever I can about ARMA 3 scripting. Mostly to help improve game play on the Epoch servers I have helped Admin. Mostly pretty basic stuff, like adding code to improve existing mods and scripts. That's how I learn.

For example, I have written one addon already to add markers around the protected traders in Altis for the server I currently Admin. But it was so simple, I don't really consider it an addon. I have written and refined several missions from several of the popular mission systems as well.

Here is what I want to do:

Combine the code I have written for the Protected Trader Markers, Static Missions and Static Loot Crates into one, self starting addon.

Here is what I have so far:

$PBOPREFIX$ File:

RAGE

config.cpp File:

class CfgPatches {
	class RAGE {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
	};
};

class CfgFunctions {
	class RAGE {
		class RAGEmain {
			file = "RAGE";
			class init {
				postInit = 1;
			};
		};
	};
};

fn_init.sqf File:

This is the part of which I am unsure. From this fn_init.sqf, I am attempting to load my map markers file and wait for it to load. Then, load my functions and wait for them to be loaded. Of course reporting each step to the RPT.

// INITIALIZE SOME GLOBALS.
RAGE_Debug = true;
RAGE_PTMARKERS_LOADED = false;
RAGE_FUNCTIONS_LOADED = false;

// LOAD PROTECTED TRADER AND REPORT.
if (RAGE_Debug) then {
	diag_log text format ["[RAGE]: Loading RAGE_PT_Markers.sqf."];
};
RAGE_PTMARKERS_LOADED = [] execVM "RAGE\ptmarkers\RAGE_PT_Markers.sqf";
waitUntil {RAGE_PTMARKERS_LOADED};
if (RAGE_Debug) then {
	diag_log text format ["[RAGE]: RAGE_PT_Markers.sqf Loaded."];
};
// LOAD FUNCTIONS AND REPORT.
if (RAGE_Debug) then {
	diag_log text format ["[RAGE]: Loading RAGE_Functions.sqf."];
};
RAGE_FUNCTIONS_LOADED = [] execVM "RAGE\RAGE_Functions.sqf";
// WAIT UNTIL FUNCTIONS ARE LOADED TO CONTINUE.
waitUntil {RAGE_FUNCTIONS_LOADED};
if (RAGE_Debug) then {
	diag_log text format ["[RAGE]: RAGE_Functions.sqf Loaded."];
};

Am I on the right track here? The idea was to load each file and when RAGE_PTMARKERS_LOADED and RAGE_FUNCTIONS_LOADED report true, to move on to starting up the missions. Since the missions and crates rely on functions in RAGE_Functions.sqf and markers in RAGE_PT_Markers.sqf.

Thank you to whoever reads and responds.

Link to comment
Share on other sites

25 answers to this question

Recommended Posts

  • 0

I'm not that experienced but I am the first to reply!!
I am on the same path with you, did a bit of "customization" left and right in the past. Finally started my own script, took a 9 month break now back to Epoch, trying to complete this first project.

What I can offer you is a working 'package' - you can take my mod, remove all image files, all extra script files and start working with ONE config file, ONE function file and so on (you get the idea).
Again it's not great, probably full of things that can be improved but it is working. If interested google for 'transport for arma' and download it from the public GitLab page. use the stable tree.

if you don't know/use/want Git, I can give you PBO file if you like. Let me know. I practically live on the forums this week so expect an answer in 15 minutes!!

Edited by raymix
please don't quote whole OP post if it's long
Link to comment
Share on other sites

  • 0

Thanks for the reply. What I need to understand is if:

RAGE_PTMARKERS_LOADED = [] execVM "RAGE\ptmarkers\RAGE_PT_Markers.sqf";

Will return true to RAGE_PTMARKERS_LOADED when the sciript is loaded.

And if:

waitUntil {RAGE_PTMARKERS_LOADED};

Will make the script pause until RAGE_PTMARKERS_LOADED returns as true.

Link to comment
Share on other sites

  • 0
2 minutes ago, Redbeard Actual said:

Thanks for the reply. What I need to understand is if:


RAGE_PTMARKERS_LOADED = [] execVM "RAGE\ptmarkers\RAGE_PT_Markers.sqf";

Will return true to RAGE_PTMARKERS_LOADED when the sciript is loaded.

And if:


waitUntil {RAGE_PTMARKERS_LOADED};

Will make the script pause until RAGE_PTMARKERS_LOADED returns as true.

have you seen the example #2 on the BIKI? https://community.bistudio.com/wiki/execVM

 

edit: in short, yes. 

Link to comment
Share on other sites

  • 0

The best way for this is "call":

_script = call compile preprocessFileLineNumbers "RAGE\ptmarkers\RAGE_PT_Markers.sqf";

call waits for a pushback from the script to go on.

So add at the end of your script a true.

Example:

RAGE\ptmarkers\RAGE_PT_Markers.sqf

Spoiler

_player = player;

_name = name _player;

hint format ['My name is %1',_name];

true

Now call it with:

_script = call compile preprocessFileLineNumbers "RAGE\ptmarkers\RAGE_PT_Markers.sqf";

...

_script = call compile preprocessFileLineNumbers "xxx";

...

 

So every script will be "executed" in this order.

 

But....

Called scripts could not have a waituntil and should not have a while {true}. 

Quote

If the code is in non-scheduled scope and contains while-do statement, the code runs only 10000 times at the maximum, even if the statement makes infinite loop.

So if you need this, you must spawn (execvm) the script.

Link to comment
Share on other sites

  • 0

The problem (which you didn't actually mention lol) is actually execVM. I can never understand why people are so obsessed with it.

It's a spawned thread and asynchronous to your script. It runs on its own, while it's true it does save variable when done, however your script is long done its job before report comes in.

What you want - is to functionize all your inits and call them. Calling functions will suspend code while called functions is done. In which case you also don't have to use waitUntil{}, which you should also try to stay away as much as you can.
WaitUntil{} command is meant to be used with scheduled environments (spawned with [] spawn or [] execVM). 

Also protip - if your functions or script files does not return anything, end them with true; anyway. This will let the game know its done reading script and skip some built-in engine checks (if any), it's a good habit, trust me. You can also check its variable if you want, but kind of pointless.

CFG:

class CfgPatches {
	class RAGE {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
	};
};

class CfgFunctions {
	class RAGE {
		class RAGEinit {
			file = "RAGE";
			class init { postInit = 1; };
			class RAGE_functions {}; //add fn_ in front of your file
		};
		class RAGEmarkers {
			file = "RAGE\ptmarkers"
			class RAGE_PT_Markers{}; //add fn_ in front of your file
		};
	};
};

SQF:

// INITIALIZE SOME GLOBALS.
RAGE_Debug = true;
RAGE_PTMARKERS_LOADED = false;
RAGE_FUNCTIONS_LOADED = false;

// LOAD PROTECTED TRADER AND REPORT.
call RAGE_PT_Markers;
if (RAGE_Debug) then { diag_log "[RAGE]: RAGE_PT_Markers.sqf Loaded."; };

call RAGE_functions;
if (RAGE_Debug) then { diag_log "[RAGE]: RAGE_Functions.sqf Loaded."; };

true;

Also you don't need to convert strings to text and format them back to string just to output something to diag_log. Diag_log is hardcore enough and can take anything you throw at it

Edited by raymix
typos
Link to comment
Share on other sites

  • 0

nice one. the only thing I want to mention is the game runs in ... bit. the source you referenced above states the opposite... maybe a typo?

Edited by raymix
again.. please stop quoting large posts xD
Link to comment
Share on other sites

  • 0

 

47 minutes ago, Redbeard Actual said:

 This putting it all into one may be over my head. But how the hell else will I learn,

 

Only the first time you feel like that. Just go forward, you are on a very good way and if you need any support let us know. :smile:

 

Link to comment
Share on other sites

  • 0
2 hours ago, rvg?! said:

 

Only the first time you feel like that. Just go forward, you are on a very good way and if you need any support let us know. :smile:

 

Roger That! I literally got into this by being thrown in head first and told sink or swim. Your support is greatly appreciated. The explanations and links so far have been helpful.

Problem now is no more access to a server to develop on. Don't even know why. Had brought in about 30 regular players with a player count of about 20 when busy on weekends. Got up ready to do the update this morning to find out I no longer had access.

Link to comment
Share on other sites

  • 0
20 hours ago, raymix said:

CFG:


class CfgPatches {
	class RAGE {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
	};
};

class CfgFunctions {
	class RAGE {
		class RAGEinit {
			file = "RAGE";
			class init { postInit = 1; };
			class RAGE_functions {}; //add fn_ in front of your file
		};
		class RAGEmarkers {
			file = "RAGE\ptmarkers"
			class RAGE_PT_Markers{}; //add fn_ in front of your file
		};
	};
};


 

I'm not 100% sure I understand how this file works yet.  So I am going to try to see if I can explain what is going on. If you could be so kind as to tell me if I am full of it.

CfgPatches just gives the addon it base prefix for directory structure for the addon.

CfgFunctions then expands the RAGE class to include RAGEinit which is called post init from RAGE as it's base directory. Not exactly sure what the class RAGE_functions does. I think it tells it the file name to look for in the root folder.

Then you add class RAGEmarkers tell it to look for it in RAGE\ptmarkers for Rage_PT_Markers when it is called.

Not sure if I am getting any of this right.

20 hours ago, raymix said:

 

 

Link to comment
Share on other sites

  • 0

Okay, this is what I have so far.

config.cpp

Spoiler

class CfgPatches {
	class RAGE {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
	};
};
class CfgFunctions {
	class RAGE {
		class RAGEinit {
			file = "RAGE\scripts";
			class init {postInit = 1;};
			class RAGE_functions {}; //add fn_ in front of your file
		};
		class RAGEmarkers {
			file = "RAGE\ptmarkers"
			class RAGE_PT_Markers{}; //add fn_ in front of your file
		};
	};
};

 

fn_init.sqf

Spoiler

// MAKE SURE IT ONLY RUNS ON THE SERVER.
if (!isDedicated) exitWith {};
//RESERVED FOR ANAYTHING i NEED TO KEEP PRIVATE TO THIS SCRIPT.
//private [""];
// CHECK IF ANOTHER VERSION OF RAGE IS RUNNING.
if (!isNil("RAGEActive")) exitWith {};
// SET "RAGEActive" TO TRUE TO PREVENT THE SCRIPT FROM RUNNING TWICE.
RAGEActive = true;
publicVariable "RAGEActive";
/*
	############################################################
	Redbeard's Alpha Gamer Epoch
	by Redbeard Actual
	Dependent on A3EAI to populate Static Missions.
	FEATURES:
		PROTECTED TRADER ZONE MARKERS
		Gives Eastern, Central and Western Protected Traders,
		each a Named Zone Marker w/ a No PVP 500 Meters Around
		Traders label.
		RAGE FUNCTIONS
		Functions for spawning AI, filling loot crates, Para
		Dropping Troops Safely, and much more.
		RAGE MISSIONS
		Basic Framework for Included RAGE MISSIONS. Easy to expand
		on and create you own misions.	

	############################################################
*/

// INITIALIZE SOME GLOBALS.
RAGE_Debug = true;


// LOAD PROTECTED TRADER MARKERS AND REPORT.
if (RAGE_Debug) then { diag_log "[RAGE]: Loading fn_RAGE_PT_Markers.sqf."; };

call RAGE_PT_Markers;

if (RAGE_Debug) then { diag_log "[RAGE]: fn_RAGE_PT_Markers.sqf Loaded."; };

// CALL RAGE FUNCTIONS. UNCOMMENT WHEN READY TO IMPLIMENT.
if (RAGE_Debug) then { diag_log "[RAGE]: Loading fn_RAGE_Functions.sqf."; };

call RAGE_functions;

if (RAGE_Debug) then { diag_log "[RAGE]: fn_RAGE_Functions.sqf Loaded."; };

true;

 

I then changed the names of RAGE_PT_Markers to fn_RAGE_PT_Markers.sqf and RAGE_Functions.sqf to fn_RAGE_Functions.sqf. Correcting the drive path for each respectively as well.

Now I wait for whatever drama to pass so I can test this.

Link to comment
Share on other sites

  • 0
21 minutes ago, Redbeard Actual said:

Okay, this is what I have so far.

config.cpp

  Reveal hidden contents


class CfgPatches {
	class RAGE {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
	};
};
class CfgFunctions {
	class RAGE {
		class RAGEinit {
			file = "RAGE\scripts";
			class init {postInit = 1;};
			class RAGE_functions {}; //add fn_ in front of your file
		};
		class RAGEmarkers {
			file = "RAGE\ptmarkers"
			class RAGE_PT_Markers{}; //add fn_ in front of your file
		};
	};
};

 

fn_init.sqf

  Reveal hidden contents


// MAKE SURE IT ONLY RUNS ON THE SERVER.
if (!isDedicated) exitWith {};
//RESERVED FOR ANAYTHING i NEED TO KEEP PRIVATE TO THIS SCRIPT.
//private [""];
// CHECK IF ANOTHER VERSION OF RAGE IS RUNNING.
if (!isNil("RAGEActive")) exitWith {};
// SET "RAGEActive" TO TRUE TO PREVENT THE SCRIPT FROM RUNNING TWICE.
RAGEActive = true;
publicVariable "RAGEActive";
/*
	############################################################
	Redbeard's Alpha Gamer Epoch
	by Redbeard Actual
	Dependent on A3EAI to populate Static Missions.
	FEATURES:
		PROTECTED TRADER ZONE MARKERS
		Gives Eastern, Central and Western Protected Traders,
		each a Named Zone Marker w/ a No PVP 500 Meters Around
		Traders label.
		RAGE FUNCTIONS
		Functions for spawning AI, filling loot crates, Para
		Dropping Troops Safely, and much more.
		RAGE MISSIONS
		Basic Framework for Included RAGE MISSIONS. Easy to expand
		on and create you own misions.	

	############################################################
*/

// INITIALIZE SOME GLOBALS.
RAGE_Debug = true;


// LOAD PROTECTED TRADER MARKERS AND REPORT.
if (RAGE_Debug) then { diag_log "[RAGE]: Loading fn_RAGE_PT_Markers.sqf."; };

call RAGE_PT_Markers;

if (RAGE_Debug) then { diag_log "[RAGE]: fn_RAGE_PT_Markers.sqf Loaded."; };

// CALL RAGE FUNCTIONS. UNCOMMENT WHEN READY TO IMPLIMENT.
if (RAGE_Debug) then { diag_log "[RAGE]: Loading fn_RAGE_Functions.sqf."; };

call RAGE_functions;

if (RAGE_Debug) then { diag_log "[RAGE]: fn_RAGE_Functions.sqf Loaded."; };

true;

 

I then changed the names of RAGE_PT_Markers to fn_RAGE_PT_Markers.sqf and RAGE_Functions.sqf to fn_RAGE_Functions.sqf. Correcting the drive path for each respectively as well.

Now I wait for whatever drama to pass so I can test this.

Going good, hang in there :smile:


One suggestion if I may: perhaps better to use the established naming convention which is [YOUR_TAG]_fnc_whateverFunctionName.sqf     Example: EPOCH_fnc_playerFired.sqf
The idea is, you first create your own space with most left characters RAGE_
then you add the type fnc_
then you add the filename.

RAGE_fnc_playerFired.sqf
RAGE_fnc_playerAmmoCheck.sqf
RAGE_img_payButton.jpg
RAGE_dat_firstnamesDB.sqf
and so on...

Link to comment
Share on other sites

  • 0

You guys have been great. I think I am beginning to understand what goes on in these files.

I want to toss up some refined code from my config.cpp. And of course ask a quick question to see if I understand things correctly.

config.cpp:

Spoiler

class CfgPatches {
    class RAGE {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {"A3_server_settings"};
        fileName = "RAGE.pbo";
        author[]= {"Redbeard Actual"};
    };
};
class CfgFunctions {
    class RAGE_STARTUP {
        class RAGE_INITS {
            file = "RAGE\RAGE_INITS";
            class RAGE_init {postInit = 1;};
        };
        class RAGE_TRADE_MARKERS {
            file = "RAGE\RAGE_TRADE_MARKERS"
            class RAGE_PT_Markers{}; //add fn_ in front of your file
        };
        class RAGE_FNC {
            file = "RAGE\RAGE_FNC"
            class RAGE_Functions{}; //add fn_ in front of your file
        };
    };
};

In the class RAGE_INITS, I point it to the folder RAGE\RAGE_TRADE_MARKERS. Then make a sub class RAGE_PT_Markers, which is then assigned to run postinit. So once the server has loaded the file fn_RAGE_init.sqf will automatically be loaded.

Am I correct about this?

I have noticed in all addons, that whatever is labeled with the postinit = 1 in the class name is automatically loaded.

So if I change my config.cpp file to look like this:

Spoiler

class CfgPatches {
	class RAGE {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
		fileName = "RAGE.pbo";
		author[]= {"Redbeard Actual"};
	};
};
class CfgFunctions {
	class RAGE_STARTUP {
		class RAGE_INITS {
			file = "RAGE\RAGE_INITS";
			class RAGE_init {postInit = 1;};
		};
		class RAGE_TRADE_MARKERS {
			file = "RAGE\RAGE_TRADE_MARKERS"
			class RAGE_PT_Markers{postInit = 1;}; //add fn_ in front of your file
		};
		class RAGE_FNC {
			file = "RAGE\RAGE_FNC"
			class RAGE_Functions{}; //add fn_ in front of your file
		};
	};
};

 

Would adding the postInit = 1 to class RAGE_TRADE_MARKERS then make it not have to be called in the fn_RAGE_init.sqf? That file is just a set of markers to clearly outline the trader areas on Altis, that only runs on the server at start up. So I figure this might make calling it in the fn_RAGE_init.sqf a bit redundant and thus removable.

Link to comment
Share on other sites

  • 0
23 hours ago, rvg?! said:

Setup a local server with steamcmd.

https://developer.valvesoftware.com/wiki/SteamCMD

This is something I know how to do already. Only problem is not having a second computer to run a server on. Running a local server and the game on my laptop is not an option. I had this setup on my desktop, until my desktop took a dirt nap.

Link to comment
Share on other sites

  • 0
23 hours ago, Redbeard Actual said:

I'm not 100% sure I understand how this file works yet.  So I am going to try to see if I can explain what is going on. If you could be so kind as to tell me if I am full of it.

CfgPatches just gives the addon it base prefix for directory structure for the addon.

CfgFunctions then expands the RAGE class to include RAGEinit which is called post init from RAGE as it's base directory. Not exactly sure what the class RAGE_functions does. I think it tells it the file name to look for in the root folder.

Then you add class RAGEmarkers tell it to look for it in RAGE\ptmarkers for Rage_PT_Markers when it is called.

Not sure if I am getting any of this right.

 

Nope

Prefix is given by a PBO tool taken from either switch in cmd line or by reading string from $PREFIX or $PBOPREFIX$ file.
Prefix can be anything. Some people add stuff like x\addons\ in front of it, but it's not needed.
MPMissions prefix is always \
PBO prefix can be anything\You\Want\engine\does\not\care

Engine reads configs to understand structure of your addons
CfgPatches creates barebones structure of it - like a title

CFGfunctions is a class that is actually read by an SQF file - a compiler made by BI. I've even created my own compiler folowing their example to allow me to edit SQF in MP game, it's pretty cool concept.
Engine collects all config.cpp files (and includes within them) from all .pbo files to create massive binarized database on launch of the game.
Function compiler then goes through cfgfunctions to find all folders and files to compile into functions you tell it to.

CFG functions works by utilizing sub classes
main class (cfgFunctions) > your Tag (doesn't matter unless its A3) > category (continued later)
Category name does not matter unless you build a tool to read this stuff. What matters is file=""; variable. This variable can only lead to a FOLDER. When you add this line (which you dont have to), engine will now assume any sub classes will be function names and have fn_ prefix with .sqf or .fsm extension
(continued) > Function name + compiler options
If you didn't add file variable under category, this is where you have to give it full path to a file, the only thing what matters is extension - sqf or fsm, prefix is not checked.

Why?
If you've only handful of functions you want to define in random places, you only define file variable on each function not category
If all of your functions - 1 or 1000 are within same folder, you give category a file variable and only type in functions names as subclasses. If using default compiler - all scripts has to has fn_ prefix. (I removed this stupid rule on my own compiler lol)

Please grab a coffee and read this article to understand structure of CFGFunctions: https://community.bistudio.com/wiki/Functions_Library_(Arma_3) 
Trust me, it'll be worth your while, it's a powerful feature.

Basically, you use it to compile functions for you before missions are even created (or after if you want). You can even tell it to compile functions as soon as you launch .exe and are on main menu into uiNamespace ;)
Long story short, that's how it works.

If you want to understand engine a little better, I've made a private video of custom compiler that I'll be releasing to public at some point. It explains ins and outs of this kind of stuff.

Shit.. wall of text, enjoy, my pizza gettin cold...

Link to comment
Share on other sites

  • 0
6 minutes ago, Redbeard Actual said:

OMG, Raymix. I can see by the top description in that link that I am going to love this reading. I'm a freak.

 

Disregard bottom part of that wiki, it's a lie. You can't recompile for shit with their compiler, it's for their internal devs only, doesn't work on retail copy of the game. I'll be back in dev soon (summer) and will publish mine after few tests.

Link to comment
Share on other sites

  • 0
On 5/13/2016 at 1:23 PM, raymix said:

Disregard bottom part of that wiki, it's a lie. You can't recompile for shit with their compiler, it's for their internal devs only, doesn't work on retail copy of the game. I'll be back in dev soon (summer) and will publish mine after few tests.

I have done a lot of reading in the last couple of days. Not only in the links you provided, but throught about five other people's addons. In the end, I think I learned a thing or two.

Here is to thinking I learned something.

My Basic file Structure:

RAGE_ADDON.PBO <---- Root Addon Folder.

|

RAGE_INITS  <----  Folder with fn_Init.sqf and fn_Configs.sqf in it.

// MAKE SURE IT ONLY RUNS ON THE SERVER.
if (!isDedicated) exitWith {};
/*
	############################################################
	Redbeard's Alpha Gamer Epoch
	by Redbeard Actual
	Dependent on A3EAI to populate Static Missions.
	FEATURES:
		PROTECTED TRADER ZONE MARKERS
		Gives Eastern, Central and Western Protected Traders,
		each a Named Zone Marker w/ a No PVP 500 Meters Around
		Traders label.
		RAGE FUNCTIONS
		Functions for spawning AI, filling loot crates, Para
		Dropping Troops Safely, and much more.
		RAGE MISSIONS
		Basic Framework for Included RAGE MISSIONS. Easy to expand
		on and create you own misions.	

	############################################################
*/
// CHECK IF ANOTHER VERSION OF RAGE IS RUNNING.
if (!isNil("RAGEActive")) exitWith {};
// SET "RAGEActive" TO TRUE TO PREVENT THE SCRIPT FROM RUNNING TWICE.
RAGEActive = true;
publicVariable "RAGEActive";

// INITIALIZE SOME GLOBALS.
RAGE_Debug = true; // TRUE = RPT LOG REPORTS | FALSE = NO RPT LOG REPORTS.

if (RAGE_Debug) then {
	diag_log "[RAGE ADDON]: Giving server some time to boot.";
};
sleep 120;
if (RAGE_Debug) then {
	diag_log "[RAGE ADDON]: Loading Config.";
};
// CALL THE CONFIGS.
call RAGE_fnc_Configs;
if (RAGE_Debug) then {
	diag_log "[RAGE ADDON]: Config Loaded.";
};

|

RAGE_KAVALA_HOSPITAL <---- Folder with fn_RAGE_Kavala_Hospital.sqf in it.

|

RAGE_TRADE_MARKERS <---- Folder with fn_RAGE_PT_Markers.sqf in it.

|

$PBOPREFIX$

RAGE_ADDON

|

config.cpp

class CfgPatches {
	class RAGE_ADDON {
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_server_settings"};
		fileName = "RAGE_ADDON.pbo";
		author[]= {"Redbeard Actual"};
	};
};
class CfgFunctions {
	class RAGE_ADDON {
		tag = "RAGE"; // Establishes the tag that will be assigned to any functions I classify here so it can be called in other scripts. 
					  // Example: call RAGE_fnc_Configs; found in \RAGE_ADDON\RAGE_INITS\fn_Init.sqf
		class RAGE_TRADE_MARKERS {
			file = "RAGE_ADDON\RAGE_TRADE_MARKERS"
			class RAGE_PT_Markers{postInit = 1;}; // This is meant to load the file \RAGE_ADDON\RAGE_TRADE_MARKERS\fn_RAGE_PT_Markers.sqf
		};
		class RAGE_KAVALA_HOSPITAL {
			file = "RAGE_ADDON\RAGE_KAVALA_HOSPITAL"
			class RAGE_Kavala_Hospital{postInit = 1;}; // This is meant to load the file \RAGE_ADDON\RAGE_KAVALA_HOSPITAL\fn_RAGE_PT_Markers.sqf
		};
		class RAGE_INITS {
			file = "RAGE_ADDON\RAGE_INITS"
			class Init{postInit = 1;}; // This is meant to load the file \RAGE_ADDON\RAGE_INITS\fn_Init.sqf
			class Configs{}; // Prepares the file \RAGE_ADDON\RAGE_INITS\fn_Configs.sqf to be called as RAGE_fnc_Configs in \RAGE_ADDON\RAGE_INITS\fn_Init.sqf
		};
	};
};

I have other parts written. But this is an important part for me to understand as well as I can. It seems in the config.cpp like I am loading functions into macros to be used inside other code.

Am I getting this finally? Am I even close?

Link to comment
Share on other sites

  • 0

Is your main sqf called from configs? I don't think sleep will work with this, buddy.

If you want to delay launch of the function, I'd suggest that you spawn it instead and add sleep inside function you want to delay out of your init.

//RAGE_fnc_Configs start

diag_log "Pausing script tp Allow server to spawn loot";
uiSleep 120;
/*rest of the code*/

//RAGE_fnc_Configs end

//init
[] spawn RAGE_fnc_Configs;

 

Link to comment
Share on other sites

  • 0
9 hours ago, Redbeard Actual said:

Good news is that I have most of this working. No problem loading my functions, map addons are working and so are most of my functions.

Now to learn a bit about spawning and tracking AI.

Can't wait to read more about your adventures in Epochland. More details in future installments please. Gruesome Arma errors and horrors of troubleshooting that one missing comma in source code is what ticks me most in scripting sci-fi.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...