Scripting Tags

From Bohemia Interactive Community
Revision as of 11:43, 3 May 2020 by Lou Montana (talk | contribs) (Page refresh)
Jump to navigation Jump to search

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.