Open main menu

UESPWiki β

Oblivion Mod:Cobl/Modding/General Functions

< Mod / Oblivion: Oblivion Mod: Cobl: Mods ! Modding ! Projects

For all functions:

  • See the script for more details
  • Do not edit the script
  • If you know of a better technique or would like an extra option, please mention it here!
  • If you need a variation of the script, make a new script and copy/paste the COBL script into the new script.
  • Do not edit any of the COBL scripts, seriously. Be careful not to hit the "Recompile all Scripts" button and before you release use TES4View to make sure you haven't edited any of the scripts.

Functional ActivatorsEdit

(I need to write up a CS wiki article on activators - for now, I assume you know what they are--Haama)
All functions

  • Have the same name setup
    • Script = cobGenFuncNameFAS
    • Base = cobGenFuncNameFA
    • Ref = cobGenFuncNameFAR
  • Assume the function will work, and won't perform any checks.
    • Most functions include a debug mode that will perform the necessary checks. Set cobGenDebug to 1 to enter this mode.
  • Can have variable flags, much like a DOS command
  • Most require OBSE
  • Some use labels
  • Here's a Cheat Sheet with the requirements, labels and flags for each function
Function Script Version Details
cobGenAddFromListFAS 1.36 Adds items from one list to a container. The list can either be another container or a Pluggy array. Also includes options to control the quantity of each added item and block message spam when added to the player. Essentially, this is a DuplicateAllItems function that doesn't create new FormIDs.
  • Updates
    • v1.39 - Uses COBL's transfer container instead of the double-message trick.
cobGenAppFinderFAS 1.47 Determines and returns the references of the strongest apparati in a container. Can use on multiple containers (i.e., a storage container and the player).
  • Updates
    • v1.48 (Internal) - Uses the LabelID function instead of manually assigning a LabelID.
cobGenMagicItemsHaveSameEffectsFAS 1.35 Determines if 2 magic items have the same effects and number of those effects (non-order specific). Optionally, it can ignore scriptless effects.
cobGenMagicItemsHaveSamePotenciessFAS 1.35 Determines if 2 magic items have the same effects and potencies (non-order specific). Optionally, it can ignore scripted and/or scriptless effects.
cobGenMimicPotionFAS 1.35 Copies all of the attributes of one potion unto another item. Optionally, it can ignore the quest status, script, or effects of the original potion. Essentially, this is a CloneForm function that can use an old FormID instead of creating a new clone.
cobGenRefreshContMenuFAS 1.35 Refreshes the container menu by re-activating it. Does it later in the same frame so multiple items can use it without refreshing each time. By default, it will only refresh the menu if it is still open (several options to change this).
cobGenRefreshInvMenuFAS 1.35 Refreshes the player's inventory menu. Does it later in the same frame so multiple items can use it without refreshing each time. By default, it will only refresh the menu if it is still open (several options to change this).
  • Updates
    • v1.40 - Uses OBSE v15 No Spam functions, if the player has it.
cobGenRemoveFromListFAS 1.36 Removes items from one list to a container. The list can either be another container or a Pluggy array. Also includes options to control the quantity of each added item and block message spam when removed from the player.
  • Updates
    • v1.40 - Uses OBSE v15 No Spam functions, if the player has it.
cobGenToggleMenuFAS 1.35 Turns off the menu to prevent lag when adding/removing items (use before adding/removing the items) and automatically turns it back on later in the frame. Good for multiple calls from multiple items, or when the item removes itself from the inventory afterwards.
  • Warning - Works perfectly with multiple items, but causes a flash when only used once. Make sure to test.

Object ScriptsEdit

Simply attach the script (or your copy) to the desired item.

Function Script Version Details
cobGenRemoveSelfOS 1.35 Safely removes self if equipped or dropped. Safe-guard for items that are supposed to disappear such as buttons and the general token used to refresh menus.
cobGenUnequipFemaleOS 1.37 For male specific clothing, armor, weapons.
  • Use this for the script of the equipable item.
  • When player dons the item, the onEquip block will unequip the item if the player is female.
  • Later version may auto-unequip for female npcs as well.
  • Updates
    • v1.48 (Internal) - Added German translation
cobGenUnequipMaleOS 1.37 For female specific clothing, armor, weapons.
  • Use this for the script of the equipable item.
  • When player dons the item, the onEquip block will unequip the item if the player is male.
  • Later version may auto-unequip for male npcs as well.
  • Updates
    • v1.48 (Internal) - Added German translation


Global VariablesEdit

Global Type Version Details
cobGenDebug bool ??? Debug flag (set to 1 for debug mode). By default, the function scripts assume the information has been entered correctly and all requirements have been met. When in debug mode, these functions will make the necessary checks, and if a problem is found will print an error message to the console.
cobGenInput, cobGenInput2, cobGenOutput int ??? Used to pass information back and forth between scripts via (pluggy) ArrayIDs. Due to the way Oblivion works, you have to use an explicit reference (Reference EditorID) to set a variable on another object. If you want to use a reference variable instead (set rVar.Var to #), you can pass the information by storing it in an array, setting cobGenInput to that ArrayID, then run rVar's script and use the information in the array. Likewise, use cobGenOutput to pass information out of rVar's script.
  • Note that these can be changed by any script, so it's best to use these with functional activators or result scripts.
cobGenLabelID 0-255 ??? Used in conjunction with cobGenLabelFAR to prevent LabelID overlaps. These are mainly used by Cobl functions, but are useful for any Functional Activator or Result Script, or if you're using a Cobl function within a loop. It requires 2 lines per LabelID, one to change the global and one to set your own variable. General usage should look like
short lID01
short lID02
...
cobGenLabelIDFAR.Activate cobGenActRef, 1 ;Changes the global
set lID01 to cobGenLabelID ;Set to your own variable
cobGenLabelIDFAR.Activate cobGenActRef, 1
set lID02 to cobGenLabelID
...
Label lID01
...
Goto lID01
  • cobGenLabelID will automatically return to 255 after the onActivate and Result script nests have run.
  • cobGenLabelID starts at 255 and continues down from there.