OFPEC tags: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:ArmA 2: Editing" to "[[Category:Arma 2: Editing")
(Page refresh)
Line 1: Line 1:
OFPEC 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. Although tags may still be refered to as "OFPEC tags", their use is equally valid and encouraged in all BI game engines!
{{SideTOC}}
A Tag, also referred as [[OFPEC]] tag, is a three to five characters identifier that is individual to each designer, and allows for proper distinction between different authors' content.


OFPEC 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.
{{Informative | It is [[Code Best Practices#Variable format|good practice]] for mission makers to use tags for global variables, but at present it is not compulsory.}}


* P3D names
== History ==


* Addon PBO names
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 [[Addons at Ease]] initiative.
Today, every respectable addon maker has their own individual tag.


A 'tag' is simply a three to five letter identifier that is individual to each designer. OFPEC have created a list of all these tags, so that people can see who 'owns' particular tags and we don't have multiple designers using the same 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.


View the current OFPEC tag list and register your own tag [http://www.ofpec.com/tags/ here]. You must be a member of OFPEC to submit a tag (this takes about 30 seconds, go [http://www.ofpec.com/forum/index.php?action=register here] to register).
{{Informative |
* See the [http://www.ofpec.com/tags/ OFPEC Tags page]
** to register a tag, an account is required: [http://www.ofpec.com/forum/index.php?action{{=}}register click here to register/login].
* A Biki Backup exists at [[OFPEC tag list]].
}}


A locked [[OFPEC_tag_list|backup]] of the tag list is also kept on this wiki.


==Tag Rules==
== Tag Rules ==
{| class="wikitable" style="float: right; margin-left: 1em"
! Valid !! Invalid
|-
| style="vertical-align: top" |
* ARMA_Variable
* ABC_Variable
* A5555_Variable
|
* {{Color|red|1}}ST_Variable
* {{Color|red|A}}_Variable
* A2345{{Color|red|67}}_Variable
* A{{Color|red|b}}C_Variable
* AB{{Color|red|CV}}ariable
|}
Tags must:
* be composed of letters and eventually numbers
* be 3 to 5 characters long
* be uppercase
* start with a letter
* followed by an '''underscore''' <tt>_</tt>


OFPEC Tags must:
{{note| Following the regex {{Inline code|[A-Z][A-Z0-9]{2,4}<nowiki/>}}.}}


* Be 3 to 5 letters long.


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


* Not be the same as pre-existing tags.
=== Example 1 ===


Four and five letter tags must be followed by an underscore, three letter tags may be followed by an underscore, ie SNY_MyVariable, SNYMyFunction or OFPEC_MyAddon.pbo.  
{{cc|considering {{Color|purple|MYTAG}} is the current tag}}
If 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 are allowed, but not SNYMy_Variable.
[[player]] [[setVariable]] ["{{Color|purple|MYTAG}}_hasDocuments", [[false]]];
{{cc|...}}
[[waitUntil]] { [[sleep]] 1; [[player]] [[getVariable]] ["{{Color|purple|MYTAG}}_hasDocuments", [[false]]] };
{{Color|purple|MYTAG}}_DocumentsGrabbed = [[true]];
[[publicVariable]] {{Color|purple|MYTAG}}_DocumentsGrabbed;


==Examples ''(by SelectThis)''==
=== Example 2 ===


'''Example #1'''
<syntaxhighlight lang="cpp">
class STTRanger: SoldierWB
class TAG_Ranger: B_Soldier_F
{
{
    displayName="STT Ranger";
displayName = "TAG Ranger";
    model="\STTRangers\STTRanger";
model="\TAG_Rangers\TAG_Ranger";
}
}
</syntaxhighlight>


this would use STTRangers.PBO and STTRanger.P3D files
this would use <tt>TAG_Rangers'''.pbo'''</tt> and <tt>TAG_Ranger'''.p3d'''</tt> files


now another example for a more complicated cpp.
=== Example 3 ===


'''Example #2'''
<syntaxhighlight lang="cpp">
class CfgAmmo
{
class Default {};
class BulletSingle : Default {};
class BulletBurst : BulletSingle {};
class KozliceShell : BulletBurst {};
class TAG_RemShell : KozliceShell
{
hit = 6;
indirectHit = 6;
indirectHitRange = 0.2;
};
};


class CfgAmmo
class CfgWeapons
{
{
    class Default {};
class Default {};
    class BulletSingle : Default {};
class MGun : Default {};
    class BulletBurst: BulletSingle {};
class Riffle: MGun {};
    class KozliceShell : BulletBurst {};
class KozliceShell : Riffle {};
    class STTRemShell: KozliceShell
class TAG_RemShell : KozliceShell
    {
{
        hit=6;indirectHit=6;indirectHitRange=0.2;
picture = "\TAG_Delta\TAG_m_kozlice2.paa";
    };
###
};
ammo = TAG_RemShell;
class CfgWeapons
###
{
sound[] = { "\TAG_Delta\TAG_shotgun.wav", db0, 1 };
    class Default {};
reloadMagazineSound[] = { "\TAG_Delta\TAG_shotgunreload.wav", db-80, 1 };
    class MGun: Default {};
};
    class Riffle: MGun {};
class Kozlice {};
    class KozliceShell: Riffle {};
class TAG_Remington : Kozlice
    class STTRemShell:KozliceShell
{
    {
displayName = "TAG_Remington";
        picture="\STTDelta\STTm_kozlice2.paa";
model = "\TAG_Delta\TAG_Remington";
        ###
picture = "\TAG_Delta\TAG_w_kozlice.paa";
        ammo = STTRemShell;
muzzles[] = {TAG_RemingtonShellMuzzle};
        ###
class TAG_RemingtonShellMuzzle : TAG_RemShell
        sound[]={\STTDelta\STTshotgun.wav,db0,1};
{
        reloadMagazineSound[]={\STTDelta\STTshotgunreload.wav,db-80,1};
magazines[] = { TAG_RemShell };
    };
}
    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 ProxyTAG_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 <tt>TAG_Delta'''.pbo'''</tt> and use the <tt>TAG_Remington'''.p3d'''</tt> 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)


[[Category:Operation Flashpoint: Editing]]
[[Category:Operation Flashpoint: Editing]]
[[Category:ArmA: Editing]]
[[Category:ArmA: Editing]]
[[Category:Arma 2: Editing]]
[[Category:Arma 2: Editing]]
[[Category:Arma 3: Editing]]
[[Category:Take On Helicopters: Editing]]
[[Category:Take On Helicopters: Editing]]

Revision as of 12:43, 3 May 2020

Template:SideTOC A Tag, also referred as OFPEC tag, is a three to five characters identifier that is individual to each designer, and allows for proper distinction between different authors' content.

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.
It is good practice for mission makers to use tags for global variables, but at present it is not compulsory.


History

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 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.


Tag Rules

Valid Invalid
  • ARMA_Variable
  • ABC_Variable
  • A5555_Variable
  • 1ST_Variable
  • A_Variable
  • A234567_Variable
  • AbC_Variable
  • ABCVariable

Tags must:

  • be composed of letters and eventually numbers
  • be 3 to 5 characters long
  • be uppercase
  • start with a letter
  • followed by an underscore _

Template:note


Examples

Example 1

// 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;

Example 2

class TAG_Ranger: B_Soldier_F
{
	displayName = "TAG Ranger";
	model="\TAG_Rangers\TAG_Ranger";
}

this would use TAG_Rangers.pbo and TAG_Ranger.p3d files

Example 3

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

class CfgWeapons
{
	class Default {};
	class MGun : Default {};
	class Riffle: MGun {};
	class KozliceShell : Riffle {};
	class TAG_RemShell : KozliceShell
	{
		picture = "\TAG_Delta\TAG_m_kozlice2.paa";
		###
		ammo = TAG_RemShell;
		###
		sound[] = { "\TAG_Delta\TAG_shotgun.wav", db0, 1 };
		reloadMagazineSound[] = { "\TAG_Delta\TAG_shotgunreload.wav", db-80, 1 };
	};
	class Kozlice {};
	class TAG_Remington : Kozlice
	{
		displayName = "TAG_Remington";
		model = "\TAG_Delta\TAG_Remington";
		picture = "\TAG_Delta\TAG_w_kozlice.paa";
		muzzles[] = {TAG_RemingtonShellMuzzle};
		class TAG_RemingtonShellMuzzle : TAG_RemShell
		{
			magazines[] = { TAG_RemShell };
		}
	};
};

class CfgNonAIVehicles
{
	class ProxyWeapon {};
	class ProxyTAG_Remington: ProxyWeapon {};
};

This would be stored in TAG_Delta.pbo and use the TAG_Remington.p3d file.