Scripting Tags

From Bohemia Interactive Community
Revision as of 18:21, 11 November 2011 by .kju (talk | contribs) (Added category.)
Jump to navigation Jump to search

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

OFPEC Tags are used in the following:

  • Global variables
  • Global function names
  • New classes (in config.cpp files)
  • P3D names
  • Addon PBO names

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.

View the current OFPEC tag list and register your own tag here. You must be a member of OFPEC to submit a tag (this takes about 30 seconds, go here to register).

A locked backup of the tag list is also kept on this wiki.

Tag Rules

OFPEC Tags must:

  • Be 3 to 5 letters long.
  • Contain only alphanumeric upper case characters. The first letter must be alphabetical.
  • Not be the same as pre-existing tags.

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

Examples (by SelectThis)

Example #1

class STTRanger: SoldierWB
{
    displayName="STT Ranger";
    model="\STTRangers\STTRanger";
}

this would use STTRangers.PBO and STTRanger.P3D files

now another example for a more complicated cpp.

Example #2

class CfgAmmo
{
    class Default {};
    class BulletSingle : Default {};
    class BulletBurst: BulletSingle {};
    class KozliceShell : BulletBurst {};
    class STTRemShell: KozliceShell
    {
        hit=6;indirectHit=6;indirectHitRange=0.2;
    };
};
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

I've cut out the lines that don't need a tag to make it easier to read.

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