OFPEC tags: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
OFP Tags were originally introduced by OFPEC in 2002 as a way of avoiding conflicts between different addons. The system was so effective that it was officially adopted by BI as a requirement for their [http://www.flashpoint1985.com/addons/Editors.html Addons At Ease] initiative. Today, every respectable addon maker has their own individual tag. If an addon does not have a tag it could cause a conflict with another addon: this will cause your mission (or even your whole computer) to crash. It's good practice for mission makers to use tags for global variables, but at present it is not compulsory.
{{TOC|side}}
A Tag, also referred as an [[OFPEC]] tag, is a usually two to eight characters identifier that is individual to each designer, and allows for proper distinction between different authors' content.
{{Feature|informative|Before 2022 and {{armaR}} era, a tag was three to five characters long.}}


OFP Tags are used in the following:
If an addon does not have a tag it could cause a conflict with another addon: this can cause your mission, game (or even your whole computer depending on the game) to crash.


* Global variables


* Global function names
Tags are used in the following '''mod/addon''' contents:


* [[Identifier#Recommendations|Global variables]]
* [[Arma 3 Functions Library#Tag|Function names]]
* New classes (in config.cpp files)
* New classes (in config.cpp files)
* P3D names
* Addon PBO names - this is less true in {{arma3}} since mod management is made through Steam.<br>'''Note''': for [[Real Virtuality]] games ({{Name|ofp|short}} &rarr; {{Name|arma3|short}}) pbo names tags should be lower case for Linux server compatibility.
{{Feature|informative|It is [[Code Best Practices#Variable format|good practice]] for mission framework makers to use tags for global variables as well.}}


* P3D names
== Rules ==
 
{| class="wikitable valign-top float-right"
! Valid
! Invalid
|-
|
* '''ARM4'''_Variable
* '''ABC'''_Variable
* '''A2345678'''_Variable
|
* {{Color|red|1}}ST_Variable
* {{Color|red|A}}_Variable
* A2345678{{Color|red|90}}_Variable
* A{{Color|red|b}}C_Variable
* AB{{Color|red|CV}}ariable
|}
 
Tags must:
* be composed of letters and eventually numbers
* be 2 to 8 characters long
* be uppercase
* start with a letter
* followed by an '''underscore''' {{hl|_}}
 
{{Feature|informative|Following the regex {{hl|^[A-Z][A-Z0-9]{1,7}_}}.}}


* Addon PBO names


A 'tag' is simply a three to five letter identifier that is individual to each designer. Here at OFPEC we have created a listing of all these tags, so that people can see who 'owns' particular tags and we don't have multiple designers using the same tag.
== History ==


View the current OFPEC tag list and register your own tag [http://www.ofpec.com/index.php?option=com_tags here]. You must be a member of OFPEC to submit a tag (this takes about 30 seconds, go [http://www.ofpec.com/index.php?option=com_smf_registration here] to register).
Tags were originally introduced by [[OFPEC]] in 2002 as a way to avoid conflicts between different addons.
The system was so effective that it was officially adopted by {{Name|bi|short}} as a requirement for their [[Addons at Ease]] initiative.<br>
Today, every respectable addon maker has their own individual tag.


A locked [[OFPEC_tag_list|backup]] of the tag list is also kept on this wiki.
OFPEC have created a list of all these tags so that people can see who registered which tag in order to avoid a tag usage conflict.


==Tag Rules==
{{Feature|informative|
* See the {{Link|http://www.ofpec.com/tags/|OFPEC Tags page}} - {{Link|http://www.ofpec.com/forum/?action{{=}}register|an account}} is required in order to register a tag.
* A BIKI backup exists at [[OFPEC Tags List]].
}}


OFP Tags must:


* Be 3 to 5 letters long.
== Examples ==


* Contain only alphanumeric upper case characters. The first letter must be alphabetical.
=== Scripting ===


* Not be the same as pre-existing tags.
{{cc|considering {{Color|purple|MYTAG}} is the current tag}}
[[player]] [[setVariable]] ["{{Color|purple|MYTAG}}_hasDocuments", [[false]]];
[[waitUntil]] { [[sleep]] 1; [[player]] [[getVariable]] ["{{Color|purple|MYTAG}}_hasDocuments", [[false]]] };
{{Color|purple|MYTAG}}_DocumentsGrabbed = [[true]];
[[publicVariable]] "{{Color|purple|MYTAG}}_DocumentsGrabbed";


Four and five letter tags must be followed by an underscore, three letter tags may be be followed by an underscore, ie. SNY_MyVariable, SNYMyFunction or OFPEC_MyAddon.pbo. When you don't use an underscore after a three letter tag, you are not allowed to use any underscore in the following identifier, ie. SNYMyVariable or SNY_My_Variable, but not SNYMy_Variable.
=== Unit Config ===


==Examples ''(by SelectThis)''==
<syntaxhighlight lang="cpp">
class MYTAG_Ranger : B_Soldier_F
{
displayName = "MYTAG Ranger";
model="\mytag_rangers\MYTAG_Ranger";
}
</syntaxhighlight>


'''Example #1'''
this would use {{hl|{{Color|purple|mytag}}_rangers'''.pbo'''}} and {{hl|{{Color|purple|MYTAG}}_Ranger'''.p3d'''}} files
class STTRanger: SoldierWB
{
    displayName="STT Ranger";
    model="\STTRangers\STTRanger";
}


this would use STTRangers.PBO and STTRanger.P3D files
=== Weapon Config ===


now another example for a more complicated cpp.
<syntaxhighlight lang="cpp">
class CfgAmmo
{
class Default {};
class BulletSingle : Default {};
class BulletBurst : BulletSingle {};
class KozliceShell : BulletBurst {};
class MYTAG_RemShell : KozliceShell
{
hit = 6;
indirectHit = 6;
indirectHitRange = 0.2;
};
};


'''Example #2'''
class CfgWeapons
{
class Default {};
class MGun : Default {};
class Riffle : MGun {};
class KozliceShell : Riffle {};
class MYTAG_RemShell : KozliceShell
{
picture = "\mytag_delta\MYTAG_m_kozlice2.paa";
// ...
ammo = "MYTAG_RemShell";
// ...
sound[] = { "\mytag_delta\MYTAG_shotgun.wav", db0, 1 };
reloadMagazineSound[] = { "\mytag_delta\MYTAG_shotgunreload.wav", db-80, 1 };
};


class CfgAmmo
class Kozlice {};
{
class MYTAG_Remington : Kozlice
    class Default {};
{
    class BulletSingle : Default {};
displayName = "MYTAG_Remington";
    class BulletBurst: BulletSingle {};
model = "\mytag_delta\MYTAG_Remington";
    class KozliceShell : BulletBurst {};
picture = "\mytag_delta\MYTAG_w_kozlice.paa";
    class STTRemShell: KozliceShell
muzzles[] = { 'MYTAG_RemingtonShellMuzzle' };
    {
class MYTAG_RemingtonShellMuzzle : MYTAG_RemShell
        hit=6;indirectHit=6;indirectHitRange=0.2;
{
    };
magazines[] = { "MYTAG_RemShell" };
};
}
class CfgWeapons
};
{
};
    class Default {};
    class MGun: Default {};
    class Riffle: MGun {};
    class KozliceShell: Riffle {};
    class STTRemShell:KozliceShell
    {
        picture="\STTDelta\STTm_kozlice2.paa";
        ###
        ammo = STTRemShell;
        ###
        sound[]={\STTDelta\STTshotgun.wav,db0,1};
        reloadMagazineSound[]={\STTDelta\STTshotgunreload.wav,db-80,1};
    };
    class Kozlice {};
    class STTRemington: Kozlice
    {
        displayName = "STTRemington";
        model="\STTDelta\STTRemington";
        picture="\STTDelta\STTw_kozlice.paa";
        muzzles[] = {STTRemingtonShellMuzzle};
        class STTRemingtonShellMuzzle : STTRemShell
        {
            magazines[] = {STTRemShell};
        }
    };
};
class CfgNonAIVehicles
{
    class ProxyWeapon {};
    class ProxySTTRemington: ProxyWeapon {};
};


This is stored in STTDelta.PBO and uses the STTRemington.P3D
class CfgNonAIVehicles
{
class ProxyWeapon {};
class ProxyMYTAG_Remington : ProxyWeapon {};
};
</syntaxhighlight>


I've cut out the lines that don't need a tag to make it easier to read.
This would be stored in {{hl|{{Color|purple|mytag}}_delta'''.pbo'''}} and use the {{hl|{{Color|purple|MYTAG}}_Remington'''.p3d'''}} file.


As you can see I have used the STT tag all the way through the class names. I even use the Tag for the paa/pac and wav files that I have inside the addon folder (this just makes it easier to see what files I have altered- not necessary to avoid conflicts)


''SelectThis''
{{GameCategory|ofp|Editing}}
{{GameCategory|arma1|Editing}}
{{GameCategory|arma2|Editing}}
{{GameCategory|arma3|Editing}}
{{GameCategory|tkoh|Editing}}

Latest revision as of 20:19, 3 February 2024

A Tag, also referred as an OFPEC tag, is a usually two to eight characters identifier that is individual to each designer, and allows for proper distinction between different authors' content.

Before 2022 and Arma Reforger era, a tag was three to five characters long.

If an addon does not have a tag it could cause a conflict with another addon: this can cause your mission, game (or even your whole computer depending on the game) to crash.


Tags are used in the following mod/addon contents:

  • Global variables
  • Function names
  • New classes (in config.cpp files)
  • P3D names
  • Addon PBO names - this is less true in Arma 3 since mod management is made through Steam.
    Note: for Real Virtuality games (OFP → Arma 3) pbo names tags should be lower case for Linux server compatibility.
It is good practice for mission framework makers to use tags for global variables as well.


Rules

Valid Invalid
  • ARM4_Variable
  • ABC_Variable
  • A2345678_Variable
  • 1ST_Variable
  • A_Variable
  • A234567890_Variable
  • AbC_Variable
  • ABCVariable

Tags must:

  • be composed of letters and eventually numbers
  • be 2 to 8 characters long
  • be uppercase
  • start with a letter
  • followed by an underscore _
Following the regex ^[A-Z][A-Z0-9]{1,7}_.


History

Tags were originally introduced by OFPEC in 2002 as a way to avoid conflicts between different addons. The system was so effective that it was officially adopted by BI as a requirement for their Addons at Ease initiative.
Today, every respectable addon maker has their own individual tag.

OFPEC have created a list of all these tags so that people can see who registered which tag in order to avoid a tag usage conflict.


Examples

Scripting

// considering MYTAG is the current tag
player setVariable ["MYTAG_hasDocuments", false];

waitUntil { sleep 1; player getVariable ["MYTAG_hasDocuments", false] };
MYTAG_DocumentsGrabbed = true;
publicVariable "MYTAG_DocumentsGrabbed";

Unit Config

class MYTAG_Ranger : B_Soldier_F
{
	displayName = "MYTAG Ranger";
	model="\mytag_rangers\MYTAG_Ranger";
}

this would use mytag_rangers.pbo and MYTAG_Ranger.p3d files

Weapon Config

class CfgAmmo
{
	class Default {};
	class BulletSingle : Default {};
	class BulletBurst : BulletSingle {};
	class KozliceShell : BulletBurst {};
	class MYTAG_RemShell : KozliceShell
	{
		hit = 6;
		indirectHit = 6;
		indirectHitRange = 0.2;
	};
};

class CfgWeapons
{
	class Default {};
	class MGun : Default {};
	class Riffle : MGun {};
	class KozliceShell : Riffle {};
	class MYTAG_RemShell : KozliceShell
	{
		picture = "\mytag_delta\MYTAG_m_kozlice2.paa";
		// ...
		ammo = "MYTAG_RemShell";
		// ...
		sound[] = { "\mytag_delta\MYTAG_shotgun.wav", db0, 1 };
		reloadMagazineSound[] = { "\mytag_delta\MYTAG_shotgunreload.wav", db-80, 1 };
	};

	class Kozlice {};
	class MYTAG_Remington : Kozlice
	{
		displayName = "MYTAG_Remington";
		model = "\mytag_delta\MYTAG_Remington";
		picture = "\mytag_delta\MYTAG_w_kozlice.paa";
		muzzles[] = { 'MYTAG_RemingtonShellMuzzle' };
		class MYTAG_RemingtonShellMuzzle : MYTAG_RemShell
		{
			magazines[] = { "MYTAG_RemShell" };
		}
	};
};

class CfgNonAIVehicles
{
	class ProxyWeapon {};
	class ProxyMYTAG_Remington : ProxyWeapon {};
};

This would be stored in mytag_delta.pbo and use the MYTAG_Remington.p3d file.