@bgforge/mls-server 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -692,49 +692,49 @@
692
692
  "HANDLE_AUDIO": {
693
693
  "contents": {
694
694
  "kind": "markdown",
695
- "value": "```weidu-tp2-tooltip\naction function HANDLE_AUDIO\n```\nInstall Ogg--Vorbis compressed audio files in a safe and easy manner. This is an ACTION function.\n\nThis function supports Windows, OS X, GNU/Linux and all IE games, including BG:EE. If the game is not BG:EE, the audio will be decompressed and the resulting .wav files will be `MOVE`d to the override. If the game is BG:EE, the .ogg files are copied into the override and renamed into .wav files. Refer to the `HANDLE_AUDIO` and `HANDLE_TILESETS` tutorial for usage examples and a more practical explanation.\n\nIf the audio files need to be decompressed, this function will use oggdec.exe on Windows, which is by default expected to be found in `audio_path`. The most recent version of oggdec can be downloaded [http://downloads.xiph.org/releases/vorbis/vorbis-tools-win32-bin.7z here] (direct link). On OS X, SoX will be used, which is by default also expected to be found in `audio_path`. SoX compiled for OS X can be downloaded [http://sourceforge.net/projects/sox/files/sox/14.4.1/sox-14.4.1-macosx.zip/download here]. On GNU/Linux, oggdec will be used, but it is expected to be found on the system path and the user should install it him/herself. If you provide installation instructions for GNU/Linux, just include something to the effect of \"install oggdec, which is usually part of the package vorbis-tools\".\n\nIf the decompression utility cannot be found, the user is warned that the audio files were not installed.\n\n- INT_VAR `music` if this variable is not `0` and the game is BG:EE, the audio files are given the extension `.acm` instead of `.wav`. This variable has no effect if the game is not BG:EE. By default its value is `0`.\n- INT_VAR `quiet` if this variable is `1`, the function will suppress output from oggdec and sox. By default this is `0`.\n- STR_VAR `audio_path` to the path your `.ogg` files are stored in. By default this variable is `~%MOD_FOLDER%/audio~`.\n- STR_VAR `oggdec_path` to the path oggdec is located in. By default this variable is `~%audio_path%~`.\n- STR_VAR `sox_path` to the path SoX is located in. By default this variable is `~%audio_path%~`.\n- STR_VAR `output_path` to the path the audio should be installed into. By default this variable is `override`.\n"
695
+ "value": "```weidu-tp2-tooltip\naction function HANDLE_AUDIO\n```\n\n---\n\nInstall Ogg--Vorbis compressed audio files in a safe and easy manner. This is an ACTION function.\n\nThis function supports Windows, OS X, GNU/Linux and all IE games, including BG:EE. If the game is not BG:EE, the audio will be decompressed and the resulting .wav files will be `MOVE`d to the override. If the game is BG:EE, the .ogg files are copied into the override and renamed into .wav files. Refer to the `HANDLE_AUDIO` and `HANDLE_TILESETS` tutorial for usage examples and a more practical explanation.\n\nIf the audio files need to be decompressed, this function will use oggdec.exe on Windows, which is by default expected to be found in `audio_path`. The most recent version of oggdec can be downloaded [http://downloads.xiph.org/releases/vorbis/vorbis-tools-win32-bin.7z here] (direct link). On OS X, SoX will be used, which is by default also expected to be found in `audio_path`. SoX compiled for OS X can be downloaded [http://sourceforge.net/projects/sox/files/sox/14.4.1/sox-14.4.1-macosx.zip/download here]. On GNU/Linux, oggdec will be used, but it is expected to be found on the system path and the user should install it him/herself. If you provide installation instructions for GNU/Linux, just include something to the effect of \"install oggdec, which is usually part of the package vorbis-tools\".\n\nIf the decompression utility cannot be found, the user is warned that the audio files were not installed.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|music|= 0|  if non-zero and the game is BG:EE, audio files get the `.acm` extension instead of `.wav`. Has no effect if the game is not BG:EE.|\n|[int](https://ielib.bgforge.net/types#int)|quiet|= 0|  if `1`, suppresses output from oggdec and sox|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|audio_path|= ~%MOD_FOLDER%/audio~|  the path where `.ogg` files are stored|\n|[string](https://ielib.bgforge.net/types#string)|oggdec_path|= ~%audio_path%~|  the path where oggdec is located|\n|[string](https://ielib.bgforge.net/types#string)|sox_path|= ~%audio_path%~|  the path where SoX is located|\n|[string](https://ielib.bgforge.net/types#string)|output_path|= override|  the path the audio should be installed into|"
696
696
  }
697
697
  },
698
698
  "HANDLE_CHARSETS": {
699
699
  "contents": {
700
700
  "kind": "markdown",
701
- "value": "```weidu-tp2-tooltip\naction function HANDLE_CHARSETS\n```\nRuntime-convert `TRA` files into `UTF-8` in a safe and easy manner. This is an ACTION function.\n\nThis function supports Windows, OS X and GNU/Linux. If the game is BG:EE or BG2:EE, `TRA` files are encoded into `UTF-8` so the text can be installed without causing problems. `HANDLE_CHARSETS` needs to be used before any text is installed and is compatible with `AUTO_TRA` and all other methods of loading `TRA` files.\n\nConversion is handled by the program `iconv`. The program is available as part of the base system on OS X and GNU/Linux but a Windows version needs to be included in your mod. A Windows version can be downloaded [http://gnuwin32.sourceforge.net/packages/libiconv.htm here].\n\nIn order to function, `HANDLE_CHARSETS` needs to know a few things. First, you need to specify where you keep your `TRA` files. You do this with the variable `tra_path`. Second, `HANDLE_CHARSETS` needs to know where the Windows version of `iconv` is located. You do this with the variable `iconv_path`. Third, `HANDLE_CHARSETS` needs to know which character set the `TRA` files are in. Note that they can only be converted into `UTF-8` and cannot already be in `UTF-8`. You provide this information with `charset_table` or tell `HANDLE_CHARSETS` to try to infer this by itself with `infer_charsets`. Lastly, `HANDLE_CHARSETS` needs to know which `TRA` files to convert and whether any of them should be reloaded. You can do this with `noconvert_array`, `convert_array` and `reload_array`.\n\nUnless `convert_array` is specified, `HANDLE_CHARSETS` will recursively convert all `TRA` files in `tra_path` except those listed in `noconvert_array`. If `convert_array` is specified, only those `TRA` files listed in the array will be converted. `convert_array` may contain references to `TRA` files in subdirectories of `tra_path`.\n\n- INT_VAR `infer_charsets` to whether `HANDLE_CHARSETS` should try to infer which character set the `TRA` files are encoded in. It uses the contents of the `%language%` variable (''vide infra''). If the contents of the variable can be recognised, `HANDLE_CHARSETS` will use the character set used by the localised version of BG2 for this language. If the contents of the variable cannot be recognised, or if the `TRA` files use a different character set than the expected one, `HANDLE_CHARSETS` will fail. Refer to the compatibility matrix below for additional information. `infer_charsets` overrides `charset_table`. Defaults to `0`.\n- INT_VAR `from_utf8` to whether the function should assume the source `TRA` files are in UTF-8 or not. The default value is `0`, that is, the function assumes the `TRA` files use language-dependent charater sets and should be converted into UTF-8 when the mod is installed on EE-type games; the function produces no results on the original editions of the games. If set to `1`, the source `TRA` files are assumed to be in UTF-8 and are to be converted into language-dependent character sets when the mod is installed on original editions of the games; the function produces no results when installed on EE-type games.\n- INT_VAR `verbose` to whether the function should print debug information. Defaults to `0`.\n- STR_VAR `language` to the name of the language directory you wish to convert. The default value of this variable is `\\%LANGUAGE\\%`, in other words, the directory corresponding to the language the user selected at the start of the installation. You should never need to alter the value of this variable.\n- STR_VAR `default_language` to the name of the directory used by the default language of your mod, if your mod has one. The default language is typically one for which the translation is always complete and up to date and which you use to guard against incomplete translations. `HANDLE_CHARSETS` will convert the `TRA` files of the default language in addition to those of the user-selected language. Should these two languages be the same, the `TRA` files will only be converted once. Additionally, any `TRA` files listed in the `reload_array` (''vide infra'') will be reloaded for the default language before they are reloaded for the user-selected language. The default value of this variable is `~~` (the empty string).\n- STR_VAR `tra_path` to the path where your mod's language directories are located. `%tra_path%/%language%` should be a valid directory containing `TRA` files.\n- STR_VAR `out_path` to the path to which the converted files should be directed. The default value of this variable is `%tra_path%`, that is, the converted files reversibly overwrite the originals and the conversion is transparent to the rest of your mod. Note that if `%tra_path%` and `%out_path%` are the same directory, the conversion will naturally happen only once regardless of how many times `HANDLE_CHARSETS` are invoked, but if the directories are different, the conversion will happen for every invocation (notably, if `HANDLE_CHARSETS` is invoked among the `ALWAYS` actions).\n- STR_VAR `iconv_path` to the path where iconv.exe is located. Defaults to `%tra_path%/iconv`.\n- STR_VAR `charset_table` to the name of an associative array where the keys are the names of your language directories and the corresponding values are the character sets used by the respective language. The keys must be entirely in lowercase. `charset_table` is not used if you also specify `infer_charsets`.\n- STR_VAR `noconvert_array` to the name of an array indexed by monotonically increasing integers starting from 0. The values should be the names of `TRA` files that should not be converted into `UTF-8`. All `TRA` files in the language directory and its subdirectories except the ones listed in `noconvert_array` will be converted. The .tra file extension is optional. This variable should not be provided if you also provide `convert_array`.\n- STR_VAR `convert_array` to the name of an array indexed by monotonically increasing integers starting from 0. The values should be the names of `TRA` files that should be converted into `UTF-8`. Only those `TRA` files in the language directory or its subdirectories which are listed in `convert_array` will be converted. The .tra file extension is optional. If this variable is provided, `noconvert_array` will not be used.\n- STR_VAR `reload_array` to the name of an array indexed by monotonically increasing integers starting from 0. The values should be the names of `TRA` files which should be reloaded after they have been converted. The .tra file extension is optional. You should use this variable for reloading those `TRA` files loaded by `LANGUAGE` which should also be converted.\n- STR_VAR `exclude_directories` to the name of an array indexed by monotonically increasing integers starting from `0`. The values should be the names of directories whose contents should not be converted. The directories should be subdirectories within `%tra_path%/%language%` or its subdirectories. Only the directory name itself should be specified, not its path.\n- STR_VAR `file_regexp` to a regexp expression with the file names that must be converted. Defaults to `~.+\\.tra~`.\n"
701
+ "value": "```weidu-tp2-tooltip\naction function HANDLE_CHARSETS\n```\n\n---\n\nRuntime-convert `TRA` files into `UTF-8` in a safe and easy manner. This is an ACTION function.\n\nThis function supports Windows, OS X and GNU/Linux. If the game is BG:EE or BG2:EE, `TRA` files are encoded into `UTF-8` so the text can be installed without causing problems. `HANDLE_CHARSETS` needs to be used before any text is installed and is compatible with `AUTO_TRA` and all other methods of loading `TRA` files.\n\nConversion is handled by the program `iconv`. The program is available as part of the base system on OS X and GNU/Linux but a Windows version needs to be included in your mod. A Windows version can be downloaded [http://gnuwin32.sourceforge.net/packages/libiconv.htm here].\n\nIn order to function, `HANDLE_CHARSETS` needs to know a few things. First, you need to specify where you keep your `TRA` files. You do this with the variable `tra_path`. Second, `HANDLE_CHARSETS` needs to know where the Windows version of `iconv` is located. You do this with the variable `iconv_path`. Third, `HANDLE_CHARSETS` needs to know which character set the `TRA` files are in. Note that they can only be converted into `UTF-8` and cannot already be in `UTF-8`. You provide this information with `charset_table` or tell `HANDLE_CHARSETS` to try to infer this by itself with `infer_charsets`. Lastly, `HANDLE_CHARSETS` needs to know which `TRA` files to convert and whether any of them should be reloaded. You can do this with `noconvert_array`, `convert_array` and `reload_array`.\n\nUnless `convert_array` is specified, `HANDLE_CHARSETS` will recursively convert all `TRA` files in `tra_path` except those listed in `noconvert_array`. If `convert_array` is specified, only those `TRA` files listed in the array will be converted. `convert_array` may contain references to `TRA` files in subdirectories of `tra_path`.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|infer_charsets|= 0|  whether `HANDLE_CHARSETS` should try to infer which character set the `TRA` files are encoded in. It uses the contents of the `%language%` variable. If recognised, `HANDLE_CHARSETS` will use the charset of the localised BG2 for that language; if not recognised, or if the `TRA` files use a different charset, it will fail. `infer_charsets` overrides `charset_table`.|\n|[int](https://ielib.bgforge.net/types#int)|from_utf8|= 0|  whether the function should assume the source `TRA` files are in UTF-8 or not. The default value is `0` (function assumes language-dependent charsets, converts to UTF-8 on EE games, produces no results on original editions). If set to `1`, source `TRA` files are assumed to be in UTF-8 and converted to language-dependent charsets on original editions; produces no results on EE games.|\n|[int](https://ielib.bgforge.net/types#int)|verbose|= 0|  whether the function should print debug information|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|language|= \\%LANGUAGE\\%|  the name of the language directory you wish to convert. The default value is `\\%LANGUAGE\\%`, the directory corresponding to the language selected at installation. You should never need to alter this.|\n|[string](https://ielib.bgforge.net/types#string)|default_language|= ~~|  the name of the directory used by the default language of your mod, if your mod has one. `HANDLE_CHARSETS` will also convert the `TRA` files of this language. If the same as the user-selected language, files are only converted once. Any `TRA` files in `reload_array` will be reloaded for the default language before the user-selected language. Default is `~~` (empty string).|\n|[string](https://ielib.bgforge.net/types#string)|tra_path||  the path where your mod's language directories are located. `%tra_path%/%language%` should be a valid directory containing `TRA` files.|\n|[string](https://ielib.bgforge.net/types#string)|out_path|= %tra_path%|  the path to which the converted files should be directed. Default is `%tra_path%`, so converted files reversibly overwrite the originals. If `%tra_path%` and `%out_path%` are the same directory, conversion happens only once per invocation; if different, conversion happens for every invocation (notably, if `HANDLE_CHARSETS` is invoked among the `ALWAYS` actions, different directories will cause re-conversion on every install).|\n|[string](https://ielib.bgforge.net/types#string)|iconv_path|= %tra_path%/iconv|  the path where iconv.exe is located|\n|[string](https://ielib.bgforge.net/types#string)|charset_table||  the name of an associative array where keys are language directory names and values are the character sets used by that language. Keys must be entirely lowercase. Not used if `infer_charsets` is also specified.|\n|[string](https://ielib.bgforge.net/types#string)|noconvert_array||  the name of an array indexed by monotonically increasing integers starting from 0. Values should be names of `TRA` files that should not be converted into `UTF-8`. The .tra extension is optional. Should not be provided if `convert_array` is also provided.|\n|[string](https://ielib.bgforge.net/types#string)|convert_array||  the name of an array indexed by monotonically increasing integers starting from 0. Values should be names of `TRA` files that should be converted into `UTF-8`. The .tra extension is optional. If provided, `noconvert_array` will not be used.|\n|[string](https://ielib.bgforge.net/types#string)|reload_array||  the name of an array indexed by monotonically increasing integers starting from 0. Values should be names of `TRA` files which should be reloaded after conversion. The .tra extension is optional. Use this for `TRA` files loaded by `LANGUAGE` that should also be converted.|\n|[string](https://ielib.bgforge.net/types#string)|exclude_directories||  the name of an array indexed by monotonically increasing integers starting from `0`. Values should be names of directories whose contents should not be converted. These should be subdirectories within `%tra_path%/%language%` or its subdirectories. Only the directory name itself, not its path, should be specified.|\n|[string](https://ielib.bgforge.net/types#string)|file_regexp|= ~.+\\.tra~|  a regexp expression matching the file names that must be converted|"
702
702
  }
703
703
  },
704
704
  "HANDLE_TILESETS": {
705
705
  "contents": {
706
706
  "kind": "markdown",
707
- "value": "```weidu-tp2-tooltip\naction function HANDLE_TILESETS\n```\nInstall TISpack-compressed tilesets in a safe and easy manner. This is an ACTION function.\n\nThis function supports Windows, OS X, GNU/Linux and all IE games that support the `TIS V1` file format. The program tisunpack, part of `TISpack`, is used to decompress the provided .tiz files and the resulting .tis files are placed in the override. Refer to the `HANDLE_AUDIO` and `HANDLE_TILESETS` tutorial for usage examples and a more practical explanation.\n\nThis function expects to find tisunpack for one or more of Windows, OS X or GNU/Linux in a common directory under the subdirectories `win32`, `osx`, and `unix`, respectively. For example, in `mymod/tiz/win32`, `mymod/tiz/osx` and `mymod/tiz/unix`, the common directory is `mymod/tiz` and `mymod/tiz/win32/tisunpack.exe` should be a valid file. For GNU/Linux, this function also supports tisunpack being located on the system path (something the user would take care of). If you choose to leave tisunpack to the user, you should mention this requirement in any installation instructions you provide.\n\nIf tisunpack for the user's platform could not be found, the installation fails.\n\n- STR_VAR `tiz_path` to the path your .tiz files are stored in. By default this variable is `~%MOD_FOLDER%/tiz~`.\n- STR_VAR `tisunpack_path` to the common directory where the subdirectories `win32`, `osx` and `unix` are located. By default this variable is `~%tiz_path%~`.\n- STR_VAR `output_path` to the path the tilesets should be installed into. By default this variable is `override`.\n"
707
+ "value": "```weidu-tp2-tooltip\naction function HANDLE_TILESETS\n```\n\n---\n\nInstall TISpack-compressed tilesets in a safe and easy manner. This is an ACTION function.\n\nThis function supports Windows, OS X, GNU/Linux and all IE games that support the `TIS V1` file format. The program tisunpack, part of `TISpack`, is used to decompress the provided .tiz files and the resulting .tis files are placed in the override. Refer to the `HANDLE_AUDIO` and `HANDLE_TILESETS` tutorial for usage examples and a more practical explanation.\n\nThis function expects to find tisunpack for one or more of Windows, OS X or GNU/Linux in a common directory under the subdirectories `win32`, `osx`, and `unix`, respectively. For example, in `mymod/tiz/win32`, `mymod/tiz/osx` and `mymod/tiz/unix`, the common directory is `mymod/tiz` and `mymod/tiz/win32/tisunpack.exe` should be a valid file. For GNU/Linux, this function also supports tisunpack being located on the system path (something the user would take care of). If you choose to leave tisunpack to the user, you should mention this requirement in any installation instructions you provide.\n\nIf tisunpack for the user's platform could not be found, the installation fails.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|tiz_path|= ~%MOD_FOLDER%/tiz~|  the path where `.tiz` files are stored|\n|[string](https://ielib.bgforge.net/types#string)|tisunpack_path|= ~%tiz_path%~|  the common directory where the subdirectories `win32`, `osx` and `unix` are located|\n|[string](https://ielib.bgforge.net/types#string)|output_path|= override|  the path the tilesets should be installed into|"
708
708
  }
709
709
  },
710
710
  "INSTALL_PVRZ": {
711
711
  "contents": {
712
712
  "kind": "markdown",
713
- "value": "```weidu-tp2-tooltip\naction function INSTALL_PVRZ\n```\nInstall a PVRZ file and updates the PVRZ index. This is an ACTION function.\n This function copies the specified PVRZ file into the target folder and updates the PVRZ index. This function should be used in conjunction with UPDATE_PVRZ_INDICES.\n - INT_VAR `original_base_index` to the current base index. This value is returned by the function UPDATE_PVRZ_INDICES as `original_base_index`.\n - INT_VAR `new_base_index` to the new base index. This value is returned by the function UPDATE_PVRZ_INDICES as `new_base_index`.\n - STR_VAR `source_file` to the source file to copy. The filename must match the regular expression ~MOS[0-9]+\\.PVRZ~ (e.g., MOS0000.PVRZ, mos1592.pvrz or Mos12345.PVRZ). Case is ignored.\n - STR_VAR `target_folder` to the target folder to copy the source file into. The default value is \"override\".\n - RET `success` is set to non-zero if the function returned successfully and is set to zero on error.\n This function can additionally return all the variables automatically set by COPY."
713
+ "value": "```weidu-tp2-tooltip\naction function INSTALL_PVRZ\n```\n\n---\n\nInstall a PVRZ file and updates the PVRZ index. This is an ACTION function.\n This function copies the specified PVRZ file into the target folder and updates the PVRZ index. This function should be used in conjunction with UPDATE_PVRZ_INDICES.\n This function can additionally return all the variables automatically set by COPY.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|original_base_index||  the current base index, as returned by UPDATE_PVRZ_INDICES|\n|[int](https://ielib.bgforge.net/types#int)|new_base_index||  the new base index, as returned by UPDATE_PVRZ_INDICES|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|source_file||  the source file to copy. The filename must match the regular expression ~MOS[0-9]+\\.PVRZ~ (e.g., MOS0000.PVRZ, mos1592.pvrz or Mos12345.PVRZ). Case is ignored.|\n|[string](https://ielib.bgforge.net/types#string)|target_folder|= override|  the target folder to copy the source file into|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|success||  non-zero if the function returned successfully, zero on error|"
714
714
  }
715
715
  },
716
716
  "sc#addWmpAre": {
717
717
  "contents": {
718
718
  "kind": "markdown",
719
- "value": "```weidu-tp2-tooltip\naction function sc#addWmpAre\n```\nAdds an area to the worldmap. All variables are zero or blank by default unless otherwise indicated. This is an ACTION function.\n\n- ACTION_DEFINE_ASSOCIATIVE_ARRAY `toNewArea` to the area references that lead to the new area;\n- ACTION_DEFINE_ASSOCIATIVE_ARRAY `fromNewArea` to the area references that lead away from the new area;\n- STR_VAR `areName` to the resource reference of the area to add (like \\\"ar0700\\\");\n- STR_VAR `strName` to the descriptive name of the area (like \\\"Waukeen's Promenade\\\");\n- STR_VAR `strDesc` to the area description that will show up when hovering the cursor over the area on the worldmap;\n- STR_VAR `worldmap` to the name of the .wmp file you want patched (default is \\\"worldmap\\\");\n- INT_VAR `mapIcon` to the area's map icon index (from mapicons.bam);\n- INT_VAR `xCoord` to the area's X (east-west) coordinate;\n- INT_VAR `yCoord` to the area's Y (north-south) coordinate;\n- INT_VAR `tTime` to the area's travel time in hours * 4 (so 2 = 8 hours);\n- INT_VAR `inclSv` to 1 if you want to patch saved game worldmaps as well as the master worldmap. '''NB:''' changes to saved games are uninstallable;\n- INT_VAR `visible` to 1 if you want the ''visible'' flag to be set;\n- INT_VAR `visibleAdjacent` to 1 if you want the ''visible from adjacent'' flag to be set;\n- INT_VAR `reachable` to 1 if you want the ''reachable'' flag to be set;\n- INT_VAR `visited` to 1 if you want the ''visited'' flag to be set;\n- RET `areNum` returns the worldmap entry number for the new area;\n"
719
+ "value": "```weidu-tp2-tooltip\naction function sc#addWmpAre\n```\n\n---\n\nAdds an area to the worldmap. All variables are zero or blank by default unless otherwise indicated. This is an ACTION function.\n\n`toNewArea` and `fromNewArea` are ACTION_DEFINE_ASSOCIATIVE_ARRAY variables for the area references that lead to and from the new area respectively.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|mapIcon|= 0|  the area's map icon index (from mapicons.bam)|\n|[int](https://ielib.bgforge.net/types#int)|xCoord|= 0|  the area's X (east-west) coordinate|\n|[int](https://ielib.bgforge.net/types#int)|yCoord|= 0|  the area's Y (north-south) coordinate|\n|[int](https://ielib.bgforge.net/types#int)|tTime|= 0|  the area's travel time in hours * 4 (so 2 = 8 hours)|\n|[int](https://ielib.bgforge.net/types#int)|inclSv|= 0|  set to 1 to patch saved game worldmaps as well as the master worldmap. NB: changes to saved games are uninstallable.|\n|[int](https://ielib.bgforge.net/types#int)|visible|= 0|  set to 1 to set the 'visible' flag|\n|[int](https://ielib.bgforge.net/types#int)|visibleAdjacent|= 0|  set to 1 to set the 'visible from adjacent' flag|\n|[int](https://ielib.bgforge.net/types#int)|reachable|= 0|  set to 1 to set the 'reachable' flag|\n|[int](https://ielib.bgforge.net/types#int)|visited|= 0|  set to 1 to set the 'visited' flag|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|areName|= |  the resource reference of the area to add (like \"ar0700\")|\n|[string](https://ielib.bgforge.net/types#string)|strName|= |  the descriptive name of the area (like \"Waukeen's Promenade\")|\n|[string](https://ielib.bgforge.net/types#string)|strDesc|= |  the area description that will show up when hovering the cursor over the area on the worldmap|\n|[resref](https://ielib.bgforge.net/types#resref)|worldmap|= worldmap|  the name of the .wmp file you want patched|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|areNum||  the worldmap entry number for the new area|"
720
720
  }
721
721
  },
722
722
  "READ_SOUNDSET": {
723
723
  "contents": {
724
724
  "kind": "markdown",
725
- "value": "```weidu-tp2-tooltip\naction macro READ_SOUNDSET\n```\nReads soundset of a creature and stores it as an array of string references This is an ACTION macro.\n - SPRINT `npc` to the target creature (with .cre extension)\n - SPRINT `soundset` to the name of soundset you want."
725
+ "value": "```weidu-tp2-tooltip\naction function READ_SOUNDSET\n```\n\n---\n\nReads soundset of a creature and stores it as an array of string references This is an ACTION macro.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|npc||  the target creature (with .cre extension)|\n|[string](https://ielib.bgforge.net/types#string)|soundset||  the name of soundset you want|"
726
726
  }
727
727
  },
728
728
  "WRITE_SOUNDSET": {
729
729
  "contents": {
730
730
  "kind": "markdown",
731
- "value": "```weidu-tp2-tooltip\naction macro WRITE_SOUNDSET\n```\nWrites soundset to all matching creatures. Regexp allowed. This is an ACTION macro.\n - SPRINT `npc` to a creature in question (with .cre extension)\n - SPRINT `soundset` to name of soundset you have.\n - SET `overwrite` to 2 if you want new soundset to overwrite the old one completely. Set it to 1 if you want to overwrite old string references only with non-empty new references (may keep some old). Set it to 0 it you want to overwrite only empty old references with new ones."
731
+ "value": "```weidu-tp2-tooltip\naction function WRITE_SOUNDSET\n```\n\n---\n\nWrites soundset to all matching creatures. Regexp allowed. This is an ACTION macro.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|overwrite||  2 to overwrite the old soundset completely; 1 to overwrite old string references only with non-empty new references; 0 to overwrite only empty old references with new ones|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|npc||  the creature in question (with .cre extension)|\n|[string](https://ielib.bgforge.net/types#string)|soundset||  the name of soundset you have|"
732
732
  }
733
733
  },
734
734
  "tb#fix_file_size": {
735
735
  "contents": {
736
736
  "kind": "markdown",
737
- "value": "```weidu-tp2-tooltip\naction macro tb#fix_file_size\n```\nOverwrites all files matching a certain regexp with a certain standard file, if they are under a certain size.\n This is an ACTION macro.\n - SET `tb#fix_file_size_min` to the maximum allowed size (files whose size is exactly this value are NOT overwritten).\n - SPRINT `tb#fix_file_size_target` to the standard file used to replace file(s) that match the regexp.\n - SPRINT `tb#fix_file_size_category` to a descriptive name.\n - SPRINT `tb#fix_file_size_regexp` to the regexp for the file(s) to be checked for a match."
737
+ "value": "```weidu-tp2-tooltip\naction function tb#fix_file_size\n```\n\n---\n\nOverwrites all files matching a certain regexp with a certain standard file, if they are under a certain size.\n This is an ACTION macro.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|tb#fix_file_size_min||  the maximum allowed size (files whose size is exactly this value are NOT overwritten)|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|tb#fix_file_size_target||  the standard file used to replace file(s) that match the regexp|\n|[string](https://ielib.bgforge.net/types#string)|tb#fix_file_size_category||  a descriptive name|\n|[string](https://ielib.bgforge.net/types#string)|tb#fix_file_size_regexp||  the regexp for the file(s) to be checked for a match|"
738
738
  }
739
739
  },
740
740
  "LEXICOGRAPHICALLY": {
@@ -1064,61 +1064,61 @@
1064
1064
  "DIRECTORY_OF_FILESPEC": {
1065
1065
  "contents": {
1066
1066
  "kind": "markdown",
1067
- "value": "```weidu-tp2-tooltip\ndimorphic function DIRECTORY_OF_FILESPEC\n```\nReturns the directory of a file specification. Compare to SOURCE_DIRECTORY. This is an ACTION and PATCH function.\n - STR_VAR `filespec` to the file specification, which must include an identifiable directory, or a warning will be raised.\n - RET `directory` returns the directory of the file specification."
1067
+ "value": "```weidu-tp2-tooltip\nDIRECTORY_OF_FILESPEC\n```\n\n---\n\nReturns the directory of a file specification. Compare to SOURCE_DIRECTORY. This is an ACTION and PATCH function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|filespec||  the file specification, which must include an identifiable directory, or a warning will be raised|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|directory||  the directory of the file specification|"
1068
1068
  }
1069
1069
  },
1070
1070
  "EXT_OF_FILESPEC": {
1071
1071
  "contents": {
1072
1072
  "kind": "markdown",
1073
- "value": "```weidu-tp2-tooltip\ndimorphic function EXT_OF_FILESPEC\n```\nReturns the resource extension of a file specification. Compare to SOURCE_EXT. This is an ACTION and PATCH function.\n - STR_VAR `filespec` to the file specification, which must include an identifiable resource extension, or a warning will be raised.\n - RET `ext` returns the resource extension of the file specification."
1073
+ "value": "```weidu-tp2-tooltip\nEXT_OF_FILESPEC\n```\n\n---\n\nReturns the resource extension of a file specification. Compare to SOURCE_EXT. This is an ACTION and PATCH function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|filespec||  the file specification, which must include an identifiable resource extension, or a warning will be raised|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|ext||  the resource extension of the file specification|"
1074
1074
  }
1075
1075
  },
1076
1076
  "FILE_OF_FILESPEC": {
1077
1077
  "contents": {
1078
1078
  "kind": "markdown",
1079
- "value": "```weidu-tp2-tooltip\ndimorphic function FILE_OF_FILESPEC\n```\nReturns the file of a file specification. Compare to SOURCE_FILE. This is an ACTION and PATCH function.\n - STR_VAR `filespec` to the file specification, which may or may not include a directory.\n - RET `file` returns the file of the file specification."
1079
+ "value": "```weidu-tp2-tooltip\nFILE_OF_FILESPEC\n```\n\n---\n\nReturns the file of a file specification. Compare to SOURCE_FILE. This is an ACTION and PATCH function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|filespec||  the file specification, which may or may not include a directory|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|file||  the file of the file specification|"
1080
1080
  }
1081
1081
  },
1082
1082
  "FIND_FREE_PVRZ_INDEX": {
1083
1083
  "contents": {
1084
1084
  "kind": "markdown",
1085
- "value": "```weidu-tp2-tooltip\ndimorphic function FIND_FREE_PVRZ_INDEX\n```\n\n---\n\nAttempt to find a contiguous block of free PVRZ indices in the game installation. This is a PATCH and an ACTION function.\nThis function attempts to find the first available free PVRZ index of a contiguous block which guarantees to fit at least `num_to_reserve` indices.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types/#int)|num_to_reserve|= 1|  the minimum required size of the contiguous block of free indices (1-999)|\n|[int](https://ielib.bgforge.net/types/#int)|start_index|= 1000|  the index the search should begin at|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types/#int)|free_index||  the first available index matching the specified parameters, -1 on errors|"
1085
+ "value": "```weidu-tp2-tooltip\ndimorphic function FIND_FREE_PVRZ_INDEX\n```\n\n---\n\nAttempt to find a contiguous block of free PVRZ indices in the game installation. This is a PATCH and an ACTION function.\nThis function attempts to find the first available free PVRZ index of a contiguous block which guarantees to fit at least `num_to_reserve` indices.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|num_to_reserve|= 1|  the minimum required size of the contiguous block of free indices (1-999)|\n|[int](https://ielib.bgforge.net/types#int)|start_index|= 1000|  the index the search should begin at|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|free_index||  the first available index matching the specified parameters, -1 on errors|"
1086
1086
  }
1087
1087
  },
1088
1088
  "GET_UNIQUE_FILE_NAME": {
1089
1089
  "contents": {
1090
1090
  "kind": "markdown",
1091
- "value": "```weidu-tp2-tooltip\ndimorphic function GET_UNIQUE_FILE_NAME\n```\nCreates a file name that is currently unallocated. This is a PATCH and ACTION function. This function will create a filename using __ as a prefix. __ is reserved by The Bigg and writeable by anybody, as long as you dynamically create the file name (either by using this function or other code of your devising). The algorithm creates file names in base 36, going from __0000.ext to __zzzz.ext; this allows for 36 ^ 4 = 1679616 unique file names.\n To allow users to reinstall your mod without breaking the identity of these files, you can use the `base` parameter to ensure that the same thing will be mapped to the same file on reinstalls. For instance, if you're iterating through Mages to give each of them a spellbook, base should contain your modder prefix, an identifier for the purpose of the call, and the file name you're working on, for instance\":\" ~tb#spellbooks_%SOURCE_RES%~\n - STR_VAR `extension` to the desired extension (required).\n - STR_VAR `base` to a string unique to your mod and current file (optional).\n - RET `filename` the currently unallocated file name (sans the extension)."
1091
+ "value": "```weidu-tp2-tooltip\ndimorphic function GET_UNIQUE_FILE_NAME\n```\n\n---\n\nCreates a file name that is currently unallocated. This is a PATCH and ACTION function. This function will create a filename using __ as a prefix. __ is reserved by The Bigg and writeable by anybody, as long as you dynamically create the file name (either by using this function or other code of your devising). The algorithm creates file names in base 36, going from __0000.ext to __zzzz.ext; this allows for 36 ^ 4 = 1679616 unique file names.\nTo allow users to reinstall your mod without breaking the identity of these files, you can use the `base` parameter to ensure that the same thing will be mapped to the same file on reinstalls. For instance, if you're iterating through Mages to give each of them a spellbook, base should contain your modder prefix, an identifier for the purpose of the call, and the file name you're working on.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|extension|_required_|  the desired extension|\n|[string](https://ielib.bgforge.net/types#string)|base||  a string unique to your mod and current file (optional). For instance, if iterating through Mages to give each a spellbook, base should contain your modder prefix, an identifier for the purpose, and the file name you're working on, e.g. `~tb#spellbooks_%SOURCE_RES%~`.|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|filename||  the currently unallocated file name (sans the extension)|"
1092
1092
  }
1093
1093
  },
1094
1094
  "NAME_NUM_OF_SPELL_RES": {
1095
1095
  "contents": {
1096
1096
  "kind": "markdown",
1097
- "value": "```weidu-tp2-tooltip\ndimorphic function NAME_NUM_OF_SPELL_RES\n```\nConverts a spell resource name to a spell.ids reference. This is an ACTION and PATCH macro and function.\n - SPRINT `spell_res` to the resource name for the referenced spell.\n - RET `spell_num` to the IDS numerical reference of that spell.\n - RET `spell_name` to the IDS symbolic reference of a spell."
1097
+ "value": "```weidu-tp2-tooltip\ndimorphic function NAME_NUM_OF_SPELL_RES\n```\n\n---\n\nConverts a spell resource name to a spell.ids reference. This is an ACTION and PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|spell_res||  the resource name for the referenced spell|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|spell_num||  the IDS numerical reference of that spell|\n|[string](https://ielib.bgforge.net/types#string)|spell_name||  the IDS symbolic reference of a spell|"
1098
1098
  }
1099
1099
  },
1100
1100
  "RES_NAME_OF_SPELL_NUM": {
1101
1101
  "contents": {
1102
1102
  "kind": "markdown",
1103
- "value": "```weidu-tp2-tooltip\ndimorphic function RES_NAME_OF_SPELL_NUM\n```\nConverts a spell.ids reference to resource name. This is an ACTION and PATCH macro and function.\n - SET `spell_num` to the IDS numerical reference of that spell.\n - RET `spell_name` to the IDS symbolic reference of a spell.\n - RET `spell_res` to the resource name for the referenced spell."
1103
+ "value": "```weidu-tp2-tooltip\ndimorphic function RES_NAME_OF_SPELL_NUM\n```\n\n---\n\nConverts a spell.ids reference to resource name. This is an ACTION and PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|spell_num||  the IDS numerical reference of that spell|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|spell_name||  the IDS symbolic reference of a spell|\n|[resref](https://ielib.bgforge.net/types#resref)|spell_res||  the resource name for the referenced spell|"
1104
1104
  }
1105
1105
  },
1106
1106
  "RES_NUM_OF_SPELL_NAME": {
1107
1107
  "contents": {
1108
1108
  "kind": "markdown",
1109
- "value": "```weidu-tp2-tooltip\ndimorphic function RES_NUM_OF_SPELL_NAME\n```\nConverts a spell.ids reference to resource name. This is an ACTION and PATCH macro and function.\n - SPRINT `spell_name` to the IDS symbolic reference of a spell.\n - RET `spell_num` to the IDS numerical reference of that spell.\n - RET `spell_res` to the resource name for the referenced spell."
1109
+ "value": "```weidu-tp2-tooltip\ndimorphic function RES_NUM_OF_SPELL_NAME\n```\n\n---\n\nConverts a spell.ids reference to resource name. This is an ACTION and PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|spell_name||  the IDS symbolic reference of a spell|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|spell_num||  the IDS numerical reference of that spell|\n|[resref](https://ielib.bgforge.net/types#resref)|spell_res||  the resource name for the referenced spell|"
1110
1110
  }
1111
1111
  },
1112
1112
  "RES_OF_FILESPEC": {
1113
1113
  "contents": {
1114
1114
  "kind": "markdown",
1115
- "value": "```weidu-tp2-tooltip\ndimorphic function RES_OF_FILESPEC\n```\nReturns the resource name of a file specification. Compare to SOURCE_RES. This is an ACTION and PATCH function.\n - STR_VAR `filespec` to the file specification, which must include an identifiable resource name, or a warning will be raised.\n - RET `res` returns the resource name of the file specification."
1115
+ "value": "```weidu-tp2-tooltip\ndimorphic function RES_OF_FILESPEC\n```\n\n---\n\nReturns the resource name of a file specification. Compare to SOURCE_RES. This is an ACTION and PATCH function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|filespec||  the file specification, which must include an identifiable resource name, or a warning will be raised|\n|**RET**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|res||  the resource name of the file specification|"
1116
1116
  }
1117
1117
  },
1118
1118
  "SUBSTRING": {
1119
1119
  "contents": {
1120
1120
  "kind": "markdown",
1121
- "value": "```weidu-tp2-tooltip\ndimorphic function SUBSTRING\n```\n\n---\n\nReturns a substring of the provided string. This is an ACTION and PATCH function. All integer variables default to 0.\nThe function will fail with an error if either `start` or `length` are negative or if any of `start`, `length` or the sum of the two is greater than the length of `string`.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types/#int)|start||  the string index (0 based) from which the start of the substring should be read|\n|[int](https://ielib.bgforge.net/types/#int)|length||  the length of the substring to be read|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types/#string)|string||  the string the substring should be read from|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types/#string)|substring||  the substring read from the provided string|"
1121
+ "value": "```weidu-tp2-tooltip\ndimorphic function SUBSTRING\n```\n\n---\n\nReturns a substring of the provided string. This is an ACTION and PATCH function. All integer variables default to 0.\nThe function will fail with an error if either `start` or `length` are negative or if any of `start`, `length` or the sum of the two is greater than the length of `string`.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|start|= 0|  the string index (0 based) from which the start of the substring should be read|\n|[int](https://ielib.bgforge.net/types#int)|length|= 0|  the length of the substring to be read|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|string||  the string the substring should be read from|\n|**RET**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|substring||  the substring read from the provided string|"
1122
1122
  }
1123
1123
  },
1124
1124
  "ALLOW_MISSING": {
@@ -1310,7 +1310,7 @@
1310
1310
  "ADD_STORE_PURCHASE": {
1311
1311
  "contents": {
1312
1312
  "kind": "markdown",
1313
- "value": "```weidu-tp2-tooltip\nADD_STORE_PURCHASE\n```\nAdds one or more item categories the store will buy to the current STO file. Existing categories will be skipped.\n - INT_VAR `category` to the item category to add. A nearly complete list of supported item category codes can be found [here](https://gibberlings3.github.io/iesdp/file_formats/ie_formats/sto_v1.htm#tableItemType).\n - RET `index` returns the index of the added purchase. Returns `-1` if the purchase could not be added.\n - RET `offset` returns the offset of the added purchase. Returns `-1` if the purchase could not be added."
1313
+ "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_PURCHASE\n```\n\n---\n\nAdds one or more item categories the store will buy to the current STO file. Existing categories will be skipped.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|category||  the item category to add. A nearly complete list of supported item category codes can be found [here](https://gibberlings3.github.io/iesdp/file_formats/ie_formats/sto_v1.htm#tableItemType).|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the added purchase. Returns `-1` if the purchase could not be added.|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the added purchase. Returns `-1` if the purchase could not be added.|"
1314
1314
  }
1315
1315
  },
1316
1316
  "APPEND_FILE": {
@@ -1838,13 +1838,13 @@
1838
1838
  "REMOVE_STORE_CURE": {
1839
1839
  "contents": {
1840
1840
  "kind": "markdown",
1841
- "value": "```weidu-tp2-tooltip\nREMOVE_STORE_CURE\n```\nRemoves all cure instances matching the specified spell name from the current STO file. This is a patch function.\n - STR_VAR `spell_name` to the resource name (resref) of the spell to remove. Regular expression syntax is supported.\n - RET `index` returns the index of the first removed entry matching the spell name, returns `-1` otherwise.\n - RET `offset` returns the offset of the first removed entry matching the spell name, returns `-1` otherwise."
1841
+ "value": "```weidu-tp2-tooltip\npatch function REMOVE_STORE_CURE\n```\n\n---\n\nRemoves all cure instances matching the specified spell name from the current STO file. This is a patch function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|spell_name||  the resource name (resref) of the spell to remove. Regular expression syntax is supported.|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the first removed entry matching the spell name, returns `-1` otherwise|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the first removed entry matching the spell name, returns `-1` otherwise|"
1842
1842
  }
1843
1843
  },
1844
1844
  "REMOVE_STORE_DRINK": {
1845
1845
  "contents": {
1846
1846
  "kind": "markdown",
1847
- "value": "```weidu-tp2-tooltip\nREMOVE_STORE_DRINK\n```\nRemoves all drink instances matching the specified drink name from the current STO file. This is a patch function.\n - STR_VAR `drink_name` to the name of the drink. The following syntax is supported:\n - `Literal string`: Example: Elminster's Choice Beer\n - Note: Regular expression syntax is supported for literal strings.\n - `Strref value`: Example: `#1234`\n - `Translation reference`: Example: `@1000`\n - RET `index` returns the index of the first removed entry matching the drink name, returns `-1` otherwise.\n - RET `offset` returns the offset of the first removed entry matching the drink name, returns `-1` otherwise."
1847
+ "value": "```weidu-tp2-tooltip\npatch function REMOVE_STORE_DRINK\n```\n\n---\n\nRemoves all drink instances matching the specified drink name from the current STO file. This is a patch function.\n\n`drink_name` supports: literal strings (regexp supported), strref values (`#1234`), or translation references (`@1000`).\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|drink_name||  the name of the drink|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the first removed entry matching the drink name, returns `-1` otherwise|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the first removed entry matching the drink name, returns `-1` otherwise|"
1848
1848
  }
1849
1849
  },
1850
1850
  "REMOVE_STORE_ITEM": {
@@ -1856,13 +1856,13 @@
1856
1856
  "REMOVE_STORE_ITEM_EX": {
1857
1857
  "contents": {
1858
1858
  "kind": "markdown",
1859
- "value": "```weidu-tp2-tooltip\nREMOVE_STORE_ITEM_EX\n```\nRemoves all sale instances matching the specified item name from the current STO file. This is a patch function.\n - STR_VAR `item_name` to the resource name (resref) of the item to remove. Regular expression syntax is supported.\n - RET `index` returns the index of the first removed entry matching the item name, returns `-1` otherwise.\n - RET `offset` returns the offset of the first removed entry matching the item name, returns `-1` otherwise."
1859
+ "value": "```weidu-tp2-tooltip\npatch function REMOVE_STORE_ITEM_EX\n```\n\n---\n\nRemoves all sale instances matching the specified item name from the current STO file. This is a patch function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_name||  the resource name (resref) of the item to remove. Regular expression syntax is supported.|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the first removed entry matching the item name, returns `-1` otherwise|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the first removed entry matching the item name, returns `-1` otherwise|"
1860
1860
  }
1861
1861
  },
1862
1862
  "REMOVE_STORE_PURCHASE": {
1863
1863
  "contents": {
1864
1864
  "kind": "markdown",
1865
- "value": "```weidu-tp2-tooltip\nREMOVE_STORE_PURCHASE\n```\nRemoves the specified item category from the current STO file. This is a patch function.\n - INT_VAR `category` to the item category to remove. A nearly complete list of supported item category codes can be found [here](https://gibberlings3.github.io/iesdp/file_formats/ie_formats/sto_v1.htm#tableItemType).\n - RET `index` returns the index of the first removed entry matching the category, returns `-1` otherwise.\n - RET `offset` returns the offset of the first removed entry matching the category, returns `-1` otherwise."
1865
+ "value": "```weidu-tp2-tooltip\npatch function REMOVE_STORE_PURCHASE\n```\n\n---\n\nRemoves the specified item category from the current STO file. This is a patch function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|category||  the item category to remove. A nearly complete list of supported item category codes can be found [here](https://gibberlings3.github.io/iesdp/file_formats/ie_formats/sto_v1.htm#tableItemType).|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the first removed entry matching the category, returns `-1` otherwise|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the first removed entry matching the category, returns `-1` otherwise|"
1866
1866
  }
1867
1867
  },
1868
1868
  "REPLACE": {
@@ -2042,229 +2042,229 @@
2042
2042
  "ADD_AREA_ITEM": {
2043
2043
  "contents": {
2044
2044
  "kind": "markdown",
2045
- "value": "```weidu-tp2-tooltip\npatch function ADD_AREA_ITEM\n```\nAdds an item to a container of an area. This is a PATCH macro and function.\n - SPRINT `item_to_add` to the item you want to add\n - SET `container_to_add_to` to the number of the container the item should be added to. The count starts at 1.\n - SPRINT `flags` to flags the item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc). Default - no flags.\n - SET `charges1` to amount in stock/number of charges of first magical ability (default 0)\n - SET `charges2` to number of charges of second magical ability (default 0)\n - SET `charges3` to number of charges of third magical ability (default 0)"
2045
+ "value": "```weidu-tp2-tooltip\npatch function ADD_AREA_ITEM\n```\n\n---\n\nAdds an item to a container of an area. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|container_to_add_to||  the number of the container the item should be added to. The count starts at 1.|\n|[int](https://ielib.bgforge.net/types#int)|charges1|= 0|  amount in stock/number of charges of first magical ability|\n|[int](https://ielib.bgforge.net/types#int)|charges2|= 0|  number of charges of second magical ability|\n|[int](https://ielib.bgforge.net/types#int)|charges3|= 0|  number of charges of third magical ability|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|item_to_add||  the item you want to add|\n|[string](https://ielib.bgforge.net/types#string)|flags|= |  flags the item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)|"
2046
2046
  }
2047
2047
  },
2048
2048
  "ADD_AREA_REGION_TRIGGER": {
2049
2049
  "contents": {
2050
2050
  "kind": "markdown",
2051
- "value": "```weidu-tp2-tooltip\npatch function ADD_AREA_REGION_TRIGGER\n```\nAdds an area region to the current are file. This is a PATCH macro and function. Unlike other macros you do not need to set every variable. You are only required to set those values that you need to write.\n - SPRINT `ab_RT_Name` -- Name to assign to new region\n - SET `ab_RT_Type` -- Type of trigger -- 0=proximity; 1=info; 2=travel\n - SET `ab_RT_BbLX` -- Bounding Box - low x value - LEFT\n - SET `ab_RT_BbLY` -- Bounding Box - low y value - TOP\n - SET `ab_RT_BbHX` -- Bounding Box - High x value - RIGHT\n - SET `ab_RT_BbHY` -- Bounding Box - High y value - BOTTOM\n - SET `ab_RT_VxPr` -- Number of Vertex Pairs for current region\n - SET `ab_RT_CuId` -- Cursor Index - points to a graphic in cursors.bam\n - SPRINT `ab_RT_Dest` -- Destination Area\n - SPRINT `ab_RT_EntN` -- Entrance Name\n - SET `ab_RT_Fbit` -- Flag bits set in bit format which are read right to left - 0=off; 1=on\n - SET `ab_RT_Itxt` -- Info text\n - SET `ab_RT_TDtD` -- Trap Detection Difficulty\n - SET `ab_RT_TRmD` -- Trap Removal Difficulty\n - SET `ab_RT_TSet` -- Trap is set - 0=no; 1=yes\n - SET `ab_RT_TDet` -- Trap is detected - 0=no; 1=yes\n - SET `ab_RT_LPoX` -- Launch Point X\n - SET `ab_RT_LPoY` -- Launch Point Y\n - SPRINT `ab_RT_KeyI` -- Key Item\n - SET `ab_RT_Rbcs` -- Region Script file\n - SET `ab_RT_ALPX` -- Alternate Launch Point X\n - SET `ab_RT_ALPY` -- Alternate Launch Point Y\n - SET `ab_RT_Dial` -- Dialog file (used only in PST)\n The vertex points are separated by their XY values You may have as many pairs as you need. Just copy this set and increment the #. Example\":\" For the X values\":\" 'ab_RT_Vx_X_0', 'ab_RT_Vx_X_1', 'ab_RT_Vx_X_2'\n For the Y values\":\" 'ab_RT_Vx_Y_0', 'ab_RT_Vx_Y_1', 'ab_RT_Vx_Y_2'\n - SET `ab_RT_Vx_X_0` -- Point #0 X value\n - SET `ab_RT_Vx_Y_0` -- Point #0 Y value\n NOTE: The original code released in WeiDU v211 has been overhauled and re-released in v212. Therefore, the user defined variable names have been changed. If you used the 211 version you will need to update your mod to use the variables in this version. Sorry for the inconvenience..."
2051
+ "value": "```weidu-tp2-tooltip\npatch function ADD_AREA_REGION_TRIGGER\n```\n\n---\n\nAdds an area region to the current are file. This is a PATCH macro and function. Unlike other macros you do not need to set every variable. You are only required to set those values that you need to write.\n\nVertex points use indexed XY pair variables: `ab_RT_Vx_X_0`/`ab_RT_Vx_Y_0` for point 0, `ab_RT_Vx_X_1`/`ab_RT_Vx_Y_1` for point 1, etc. (INT_VAR, each defaults to 0). These are not listed in `args` because the number of vertex pairs is variable and the schema does not support indexed parameter arrays.\n\nNote: the variable names in this function were changed between WeiDU v211 and v212. If you used the v211 version you will need to update your mod to use the variables in this version.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_Type||  type of trigger: 0=proximity, 1=info, 2=travel|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_BbLX||  bounding box left X value|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_BbLY||  bounding box top Y value|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_BbHX||  bounding box right X value|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_BbHY||  bounding box bottom Y value|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_VxPr||  number of vertex pairs for current region|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_CuId||  cursor index (points to a graphic in cursors.bam)|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_Fbit||  flag bits in bit format, read right to left: 0=off, 1=on|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_Itxt||  info text|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_TDtD||  trap detection difficulty|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_TRmD||  trap removal difficulty|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_TSet||  trap is set: 0=no, 1=yes|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_TDet||  trap is detected: 0=no, 1=yes|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_LPoX||  launch point X|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_LPoY||  launch point Y|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_Rbcs||  region script file|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_ALPX||  alternate launch point X|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_ALPY||  alternate launch point Y|\n|[int](https://ielib.bgforge.net/types#int)|ab_RT_Dial||  dialog file (used only in PST)|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|ab_RT_Name||  name to assign to the new region|\n|[resref](https://ielib.bgforge.net/types#resref)|ab_RT_Dest||  destination area|\n|[string](https://ielib.bgforge.net/types#string)|ab_RT_EntN||  entrance name|\n|[string](https://ielib.bgforge.net/types#string)|ab_RT_KeyI||  key item|"
2052
2052
  }
2053
2053
  },
2054
2054
  "ADD_CRE_EFFECT": {
2055
2055
  "contents": {
2056
2056
  "kind": "markdown",
2057
- "value": "```weidu-tp2-tooltip\npatch function ADD_CRE_EFFECT\n```\nAdds an effect to a creature. All variables except `probability1` are 0 by default. This is a PATCH macro and function.\n - SET `opcode` to opcode.\n - SET `timing` to timing type.\n - SET `target` to target type.\n - SET `parameter1` to first parameter.\n - SET `parameter2` to second parameter.\n - SET `parameter3` to third parameter.\n - SET `parameter4` to forth parameter.\n - SET `power` to power.\n - SET `resist_dispel` to magic resistance/dispel type.\n - SET `duration` to duration.\n - SET `probability1` to probability 1 (default 100).\n - SET `probability2` to probability 2.\n - SPRINT `resource` to resource (8 chars max).\n - SPRINT `resource2` to second resource (8 chars max).\n - SPRINT `vvcresource` to VVC resource (8 chars max).\n - SPRINT `effsource` to effect source.\n - SPRINT `effvar` to effect variable.\n - SET `dicenumber` to number of dices to be thrown.\n - SET `dicesize` to size of dices to be thrown.\n - SET `savingthrow` to type of savingthrow to be allowed against the effect.\n - SET `savebonus` to saving throw bonus.\n - SET `school` to magical school.\n - SET `special` to the special parameter (only valid for functions; not macros).\n - SET `lowestafflvl` to lowest affected level.\n - SET `highestafflvl` to highest affected level.\n - SET `casterx` to caster X position.\n - SET `castery` to caster Y position.\n - SET `targetx` to target X position.\n - SET `targety` to target Y position.\n - SET `restype` to source resource type.\n - SET `sourceslot` to source resource slot.\n - SET `casterlvl` to caster level.\n - SET `sectype` to secondary type.\n - SET `insert_point` to the index at which the new effect is to be inserted. 0 is first and negative values or values equal to or exceeding the existing number of effects are last."
2057
+ "value": "```weidu-tp2-tooltip\npatch function ADD_CRE_EFFECT\n```\n\n---\n\nAdds an effect to a creature. All variables except `probability1` are 0 by default. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode|= 0|  opcode|\n|[int](https://ielib.bgforge.net/types#int)|timing|= 0|  timing type|\n|[int](https://ielib.bgforge.net/types#int)|target|= 0|  target type|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= 0|  first parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= 0|  second parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter3|= 0|  third parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter4|= 0|  fourth parameter|\n|[int](https://ielib.bgforge.net/types#int)|power|= 0|  power|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= 0|  magic resistance/dispel type|\n|[int](https://ielib.bgforge.net/types#int)|duration|= 0|  duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= 100|  probability 1|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= 0|  probability 2|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= 0|  number of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= 0|  size of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= 0|  type of saving throw to be allowed against the effect|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= 0|  saving throw bonus|\n|[int](https://ielib.bgforge.net/types#int)|school|= 0|  magical school|\n|[int](https://ielib.bgforge.net/types#int)|special|= 0|  the special parameter (only valid for functions; not macros)|\n|[int](https://ielib.bgforge.net/types#int)|lowestafflvl|= 0|  lowest affected level|\n|[int](https://ielib.bgforge.net/types#int)|highestafflvl|= 0|  highest affected level|\n|[int](https://ielib.bgforge.net/types#int)|casterx|= 0|  caster X position|\n|[int](https://ielib.bgforge.net/types#int)|castery|= 0|  caster Y position|\n|[int](https://ielib.bgforge.net/types#int)|targetx|= 0|  target X position|\n|[int](https://ielib.bgforge.net/types#int)|targety|= 0|  target Y position|\n|[int](https://ielib.bgforge.net/types#int)|restype|= 0|  source resource type|\n|[int](https://ielib.bgforge.net/types#int)|sourceslot|= 0|  source resource slot|\n|[int](https://ielib.bgforge.net/types#int)|casterlvl|= 0|  caster level|\n|[int](https://ielib.bgforge.net/types#int)|sectype|= 0|  secondary type|\n|[int](https://ielib.bgforge.net/types#int)|insert_point|= 0|  the index at which the new effect is to be inserted. 0 is first and negative values or values equal to or exceeding the existing number of effects are last.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  resource (8 chars max)|\n|[resref](https://ielib.bgforge.net/types#resref)|resource2||  second resource (8 chars max)|\n|[resref](https://ielib.bgforge.net/types#resref)|vvcresource||  VVC resource (8 chars max)|\n|[string](https://ielib.bgforge.net/types#string)|effsource||  effect source|\n|[string](https://ielib.bgforge.net/types#string)|effvar||  effect variable|"
2058
2058
  }
2059
2059
  },
2060
2060
  "ADD_CRE_ITEM_FLAGS": {
2061
2061
  "contents": {
2062
2062
  "kind": "markdown",
2063
- "value": "```weidu-tp2-tooltip\npatch function ADD_CRE_ITEM_FLAGS\n```\nAdds flags to all matching items possessed by a creature. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `item_to_change` to the item the flags should be added to\n - SPRINT `flags to flags` you need to add (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)."
2063
+ "value": "```weidu-tp2-tooltip\npatch function ADD_CRE_ITEM_FLAGS\n```\n\n---\n\nAdds flags to all matching items possessed by a creature. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_to_change||  the item the flags should be added to|\n|[string](https://ielib.bgforge.net/types#string)|flags||  flags to add (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)|"
2064
2064
  }
2065
2065
  },
2066
2066
  "ADD_CRE_SCRIPT": {
2067
2067
  "contents": {
2068
2068
  "kind": "markdown",
2069
- "value": "```weidu-tp2-tooltip\npatch function ADD_CRE_SCRIPT\n```\nAssigns a script to a creature in the first available slot. This is a PATCH function. By default, the function will try all 5 script slots from SCRIPT_OVERRIDE to SCRIPT_DEFAULT.\n The function will fail with an error if the file being patched does not have a signature (first 3 bytes) that case-sensitively equals CRE, if either `offset_start` or `offset_end` are negative, if `offset_end` is less than `offset_start` or if `offset_end` is greater than the size of the file being patched.\n - INT_VAR `offset_start` to the offset from which the search for an empty slot should start. (default SCRIPT_OVERRIDE)\n - INT_VAR `offset_end` to the offset at which the search should end. (default SCRIPT_DEFAULT)\n - STR_VAR `script` to the resource reference of the script to be assigned.\n - RET `success` a return value indicating whether the script was successfully assigned. 1 signifies success and 0 signifies that no empty slot was found. A harmless warning will be printed if the function was unsuccessful."
2069
+ "value": "```weidu-tp2-tooltip\npatch function ADD_CRE_SCRIPT\n```\n\n---\n\nAssigns a script to a creature in the first available slot. This is a PATCH function. By default, the function will try all 5 script slots from SCRIPT_OVERRIDE to SCRIPT_DEFAULT.\n The function will fail with an error if the file being patched does not have a signature (first 3 bytes) that case-sensitively equals CRE, if either `offset_start` or `offset_end` are negative, if `offset_end` is less than `offset_start` or if `offset_end` is greater than the size of the file being patched.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|offset_start|= SCRIPT_OVERRIDE|  the offset from which the search for an empty slot should start|\n|[int](https://ielib.bgforge.net/types#int)|offset_end|= SCRIPT_DEFAULT|  the offset at which the search should end|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|script||  the resource reference of the script to be assigned|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|success||  1 if the script was successfully assigned, 0 if no empty slot was found|"
2070
2070
  }
2071
2071
  },
2072
2072
  "ADD_ITEM_EFFECT": {
2073
2073
  "contents": {
2074
2074
  "kind": "markdown",
2075
- "value": "```weidu-tp2-tooltip\npatch function ADD_ITEM_EFFECT\n```\nAdds an extended effect to an item. All variables except `probability1`, type and `insert_point` are 0 by default. This is a PATCH macro and function.- SET `opcode` to opcode\n - SET `target` to target type\n - SET `timing` to timing type\n - SET `parameter1` to first parameter\n - SET `parameter2` to second parameter\n - SET `power` to power\n - SET `resist_dispel` to magic resistance/dispel type\n - SET `duration` to duration\n - SET `probability1` to probability 1 (default 100)\n - SET `probability2` to probability 2\n - SPRINT `resource` to resource (8 chars max)\n - SET `dicenumber` to number of dices to be thrown\n - SET `dicesize` to size of dices to be thrown\n - SET `savingthrow` to type of savingthrow to be allowed against the effect\n - SET `savebonus` to saving throw bonus\n - SET `special` to the special parameter (only valid for functions; not macros)\n - SET `header` to number of extended header (starting from 1) the effect should be added to (by default the effect is added to every header).\n - SET `type` to the type of header to which the effect should be added or 99 for all types. Defaults to 3 (magic).\n - SET `insert_point` to the position of the effect. If this variable is 0 the effect will be inserted as the first effect of the extended header. If this variable is negative or greater than the number of effects, the effect will be inserted as the last effect. The effect is added as the last effect by default."
2075
+ "value": "```weidu-tp2-tooltip\npatch function ADD_ITEM_EFFECT\n```\n\n---\n\nAdds an extended effect to an item. All variables except `probability1`, type and `insert_point` are 0 by default. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode|= 0|  opcode|\n|[int](https://ielib.bgforge.net/types#int)|target|= 0|  target type|\n|[int](https://ielib.bgforge.net/types#int)|timing|= 0|  timing type|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= 0|  first parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= 0|  second parameter|\n|[int](https://ielib.bgforge.net/types#int)|power|= 0|  power|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= 0|  magic resistance/dispel type|\n|[int](https://ielib.bgforge.net/types#int)|duration|= 0|  duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= 100|  probability 1|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= 0|  probability 2|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= 0|  number of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= 0|  size of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= 0|  type of saving throw to be allowed against the effect|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= 0|  saving throw bonus|\n|[int](https://ielib.bgforge.net/types#int)|special|= 0|  the special parameter (only valid for functions; not macros)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  number of extended header (starting from 1) the effect should be added to; by default the effect is added to every header|\n|[int](https://ielib.bgforge.net/types#int)|type|= 3|  the type of header to which the effect should be added, or 99 for all types. Default is 3 (magic).|\n|[int](https://ielib.bgforge.net/types#int)|insert_point||  the position of the effect; 0 inserts as first, negative or exceeding the count inserts as last. The effect is added as the last effect by default.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  resource (8 chars max)|"
2076
2076
  }
2077
2077
  },
2078
2078
  "ADD_ITEM_EQEFFECT": {
2079
2079
  "contents": {
2080
2080
  "kind": "markdown",
2081
- "value": "```weidu-tp2-tooltip\npatch function ADD_ITEM_EQEFFECT\n```\nAdds an equipping effect to an item. All variables except 'probability1' are 0 by default. This is a PATCH macro and function.- SET `opcode` to opcode\n - SET `target` to target type\n - SET `timing` to timing type\n - SET `parameter1` to first parameter\n - SET `parameter2` to second parameter\n - SET `power` to power\n - SET `resist_dispel` to magic resistance/dispel type\n - SET `duration` to duration\n - SET `probability1` to probability 1 (default 100)\n - SET `probability2` to probability 2\n - SPRINT `resource` to resource (8 chars max)\n - SET `dicenumber` to number of dices to be thrown\n - SET `dicesize` to size of dices to be thrown\n - SET `savingthrow` to type of savingthrow to be allowed against the effect\n - SET `savebonus` to saving throw bonus\n - SET `special` to the special parameter (only valid for functions; not macros)\n - SET `header` to number of extended header (starting from 1) the effect should be added to (by default the effect is added to every header).\n - SET `insert_point` to the position of the effect. If this variable is 0 the effect will be inserted as the first effect of the extended header. If this variable is negative or greater than the number of effects, the effect will be inserted as the last effect. The effect is added as the first effect by default."
2081
+ "value": "```weidu-tp2-tooltip\npatch function ADD_ITEM_EQEFFECT\n```\n\n---\n\nAdds an equipping effect to an item. All variables except `probability1` are 0 by default. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode|= 0|  opcode|\n|[int](https://ielib.bgforge.net/types#int)|target|= 0|  target type|\n|[int](https://ielib.bgforge.net/types#int)|timing|= 0|  timing type|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= 0|  first parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= 0|  second parameter|\n|[int](https://ielib.bgforge.net/types#int)|power|= 0|  power|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= 0|  magic resistance/dispel type|\n|[int](https://ielib.bgforge.net/types#int)|duration|= 0|  duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= 100|  probability 1|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= 0|  probability 2|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= 0|  number of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= 0|  size of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= 0|  type of saving throw to be allowed against the effect|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= 0|  saving throw bonus|\n|[int](https://ielib.bgforge.net/types#int)|special|= 0|  the special parameter (only valid for functions; not macros)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  number of extended header (starting from 1) the effect should be added to; by default the effect is added to every header|\n|[int](https://ielib.bgforge.net/types#int)|insert_point|= 0|  the position of the effect; 0 inserts as first, negative or exceeding the count inserts as last. The effect is added as the first effect by default.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  resource (8 chars max)|"
2082
2082
  }
2083
2083
  },
2084
2084
  "ADD_SPELL_CFEFFECT": {
2085
2085
  "contents": {
2086
2086
  "kind": "markdown",
2087
- "value": "```weidu-tp2-tooltip\npatch function ADD_SPELL_CFEFFECT\n```\nAdds a casting-feature effect to a spell. All variables except `probability1` are 0 by default. This is a PATCH macro and function.\n - SET `opcode` to opcode\n - SET `target` to target type\n - SET `timing` to timing type\n - SET `parameter1` to first parameter\n - SET `parameter2` to second parameter\n - SET `power` to power\n - SET `resist_dispel` to magic resistance/dispel type\n - SET `duration` to duration\n - SET `probability1` to probability 1 (default 100)\n - SET `probability2` to probability 2\n - SPRINT `resource` to resource (8 chars max)\n - SET `dicenumber` to number of dices to be thrown\n - SET `dicesize` to size of dices to be thrown\n - SET `savingthrow` to type of savingthrow to be allowed against the effect\n - SET `savebonus` to saving throw bonus\n - SET `special` to the special parameter (only valid for functions; not macros)\n - SET `header` to number of extended header (starting from 1) the effect should be added to (by default the effect is added to every header).\n - SET `insert_point` to the position of the effect. If this variable is 0 the effect will be inserted as the first effect of the extended header. If this variable is negative or greater than the number of effects, the effect will be inserted as the last effect. The effect is added as the first effect by default."
2087
+ "value": "```weidu-tp2-tooltip\npatch function ADD_SPELL_CFEFFECT\n```\n\n---\n\nAdds a casting-feature effect to a spell. All variables except `probability1` are 0 by default. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode|= 0|  opcode|\n|[int](https://ielib.bgforge.net/types#int)|target|= 0|  target type|\n|[int](https://ielib.bgforge.net/types#int)|timing|= 0|  timing type|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= 0|  first parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= 0|  second parameter|\n|[int](https://ielib.bgforge.net/types#int)|power|= 0|  power|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= 0|  magic resistance/dispel type|\n|[int](https://ielib.bgforge.net/types#int)|duration|= 0|  duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= 100|  probability 1|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= 0|  probability 2|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= 0|  number of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= 0|  size of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= 0|  type of saving throw to be allowed against the effect|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= 0|  saving throw bonus|\n|[int](https://ielib.bgforge.net/types#int)|special|= 0|  the special parameter (only valid for functions; not macros)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  number of extended header (starting from 1) the effect should be added to; by default the effect is added to every header|\n|[int](https://ielib.bgforge.net/types#int)|insert_point|= 0|  the position of the effect; 0 inserts as first, negative or exceeding the count inserts as last. The effect is added as the first effect by default.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  resource (8 chars max)|"
2088
2088
  }
2089
2089
  },
2090
2090
  "ADD_SPELL_EFFECT": {
2091
2091
  "contents": {
2092
2092
  "kind": "markdown",
2093
- "value": "```weidu-tp2-tooltip\npatch function ADD_SPELL_EFFECT\n```\nAdds an extended effect to a spell. All variables except `probability1` and `insert_point` are 0 by default. This is a PATCH macro and function.\n - SET `opcode` to opcode\n - SET `target` to target type\n - SET `timing` to timing type\n - SET `parameter1` to first parameter\n - SET `parameter2` to second parameter\n - SET `power` to power\n - SET `resist_dispel` to magic resistance/dispel type\n - SET `duration` to duration\n - SET `probability1` to probability 1 (default 100)\n - SET `probability2` to probability 2\n - SPRINT `resource` to resource (8 chars max)\n - SET `dicenumber` to number of dices to be thrown\n - SET `dicesize` to size of dices to be thrown\n - SET `savingthrow` to type of savingthrow to be allowed against the effect\n - SET `savebonus` to saving throw bonus\n - SET `special` to the special parameter (only valid for functions; not macros)\n - SET `header` to number of extended header (starting from 1) the effect should be added to (by default the effect is added to every header).\n - SET `insert_point` to the position of the effect. If this variable is 0 the effect will be inserted as the first effect of the extended header. If this variable is negative or greater than the number of effects, the effect will be inserted as the last effect. The effect is added as the last effect by default."
2093
+ "value": "```weidu-tp2-tooltip\npatch function ADD_SPELL_EFFECT\n```\n\n---\n\nAdds an extended effect to a spell. All variables except `probability1` and `insert_point` are 0 by default. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode|= 0|  opcode|\n|[int](https://ielib.bgforge.net/types#int)|target|= 0|  target type|\n|[int](https://ielib.bgforge.net/types#int)|timing|= 0|  timing type|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= 0|  first parameter|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= 0|  second parameter|\n|[int](https://ielib.bgforge.net/types#int)|power|= 0|  power|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= 0|  magic resistance/dispel type|\n|[int](https://ielib.bgforge.net/types#int)|duration|= 0|  duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= 100|  probability 1|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= 0|  probability 2|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= 0|  number of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= 0|  size of dices to be thrown|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= 0|  type of saving throw to be allowed against the effect|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= 0|  saving throw bonus|\n|[int](https://ielib.bgforge.net/types#int)|special|= 0|  the special parameter (only valid for functions; not macros)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  number of extended header (starting from 1) the effect should be added to; by default the effect is added to every header|\n|[int](https://ielib.bgforge.net/types#int)|insert_point||  the position of the effect; 0 inserts as first, negative or exceeding the count inserts as last. The effect is added as the last effect by default.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  resource (8 chars max)|"
2094
2094
  }
2095
2095
  },
2096
2096
  "ADD_STORE_CURE": {
2097
2097
  "contents": {
2098
2098
  "kind": "markdown",
2099
- "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_CURE\n```\nAdds a cure to the current STO file. This is a PATCH function.\n - INT_VAR `price` to the spell price.\n - INT_VAR `overwrite` to non-zero to overwrite any instances of an existing cure entry of matching spell resref when found. (Default: `0`)\n - STR_VAR `spell_name` to the resource name (resref) of the spell to add.\n - STR_VAR `position` to the desired position in the list of cures. Refer to the table below for supported expressions. The following syntax is supported (Default: `FIRST`):\n - `AFTER resref`: Will place the new spell directly behind the spell given by `resref`.\n You can list more than one resref, separated by space. The new spell will be\n added after the entry of the first matching resref.\n - `BEFORE resref`: Will place the new spell directly before the spell given by `resref`.\n You can list more than one resref, separated by space. The new spell will be\n added before the entry of the first matching resref.\n - `LAST`: Will place the new spell after all existing cures.\n - `FIRST`: Will place the new spell before all existing cures.\n - `AT value`: Will place the new spell at the position given by the number `value`.\n Use negative values to place the new spell relative to the last spell position\n in reverse order.\n - RET `index` returns the index of the added cure or the last matching index when overwriting cure entries. Returns `-1` if the spell could not be added or updated.\n - RET `offset` returns the offset of the added cure or the last matching offset when overwriting cures. Returns `-1` if the spell could not be added or updated."
2099
+ "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_CURE\n```\n\n---\n\nAdds a cure to the current STO file. This is a PATCH function.\n\n`position` syntax: `AFTER resref`, `BEFORE resref`, `LAST`, `FIRST`, or `AT value` (negative `value` counts from the end).\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|price||  the spell price|\n|[int](https://ielib.bgforge.net/types#int)|overwrite|= 0|  non-zero to overwrite any instances of an existing cure entry of matching spell resref when found|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|spell_name||  the resource name (resref) of the spell to add|\n|[string](https://ielib.bgforge.net/types#string)|position|= FIRST|  the desired position in the list of cures. `AFTER` and `BEFORE` accept multiple resrefs separated by spaces; the entry is positioned relative to the first matching resref.|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the added cure or the last matching index when overwriting. Returns `-1` if the spell could not be added or updated.|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the added cure or the last matching offset when overwriting. Returns `-1` if the spell could not be added or updated.|"
2100
2100
  }
2101
2101
  },
2102
2102
  "ADD_STORE_DRINK": {
2103
2103
  "contents": {
2104
2104
  "kind": "markdown",
2105
- "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_DRINK\n```\nAdds a drink to the current STO file. This is a PATCH function.\n - INT_VAR `price` to the price of the drink.\n - INT_VAR `rate` to the rate (%) of displaying a rumor.\n - INT_VAR `overwrite` to non-zero to overwrite any instances of an existing drink of matching `drink_name` when found. (Default: `0`)\n - STR_VAR `drink_name` to the name of the drink. The following syntax is supported:\n - `Literal string`: Example: Elminster's Choice Beer\n - `Strref value`: Example: `#1234`\n - `Translation reference`: Example: `@1000`\n - STR_VAR `position` to the desired position in the list of drinks. Refer to the table below for supported expressions. The following syntax is supported (Default: `FIRST`):\n - `AFTER name`: Will place the new drink directly behind the drink given by `name`. Name can\n either be a strref value (e.g. `#1234`) or a translation reference (e.g. `@1000`).\n You can list more than one name, separated by space. The new drink will be\n added after the entry of the first matching name.\n - `BEFORE name`: Will place the new drink directly before the drink given by `name`. Name can\n either be a strref value (e.g. `#1234`) or a translation reference (e.g. `@1000`).\n You can list more than one name, separated by space. The new drink will be\n added before the entry of the first matching name.\n - `LAST`: Will place the new drink after all existing drinks.\n - `FIRST`: Will place the new drink before all existing drinks.\n - `AT value`: Will place the new drink at the position given by the number \"value\".\n Use negative values to place the new drink relative to the last drink position\n in reverse order.\n - RET `index` returns the index of the added drink or the last matching index when overwriting drinks. Returns `-1` if the drink could not be added or updated.\n - RET `offset` returns the offset of the added drink or the last matching offset when overwriting drinks. Returns `-1` if the drink could not be added or updated."
2105
+ "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_DRINK\n```\n\n---\n\nAdds a drink to the current STO file. This is a PATCH function.\n\n`drink_name` supports: literal strings, strref values (`#1234`), or translation references (`@1000`).\n`position` syntax: `AFTER name`, `BEFORE name`, `LAST`, `FIRST`, or `AT value` (negative `value` counts from the end). Name can be a strref value or translation reference.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|price||  the price of the drink|\n|[int](https://ielib.bgforge.net/types#int)|rate||  the rate (%) of displaying a rumor|\n|[int](https://ielib.bgforge.net/types#int)|overwrite|= 0|  non-zero to overwrite any instances of an existing drink of matching `drink_name` when found|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|drink_name||  the name of the drink|\n|[string](https://ielib.bgforge.net/types#string)|position|= FIRST|  the desired position in the list of drinks. `AFTER` and `BEFORE` accept multiple names separated by spaces; the entry is positioned relative to the first matching name.|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the added drink or the last matching index when overwriting. Returns `-1` if the drink could not be added or updated.|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the added drink or the last matching offset when overwriting. Returns `-1` if the drink could not be added or updated.|"
2106
2106
  }
2107
2107
  },
2108
2108
  "ADD_STORE_ITEM_EX": {
2109
2109
  "contents": {
2110
2110
  "kind": "markdown",
2111
- "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_ITEM_EX\n```\nAdds an item to the current STO file. This is a PATCH function.\n - INT_VAR `charge1` to the number of charges of the 1st ability or quantity for stackables. (Default: `0`)\n - INT_VAR `charge2` to the number of charges of the 2nd ability. (Default: `0`)\n - INT_VAR `charge3` to the number of charges of the 3rd ability. (Default: `0`)\n - INT_VAR `stack` to the number of item instances the store carries in the stack. (Default: `1`)\n - INT_VAR `unlimited` to non-zero if the store should carry an inexhaustible stack of the new item. (Default: `0`)\n - INT_VAR `overwrite` to non-zero to overwrite any instances of an existing sale entry of matching item resref when found. (Default: `0`)\n - INT_VAR `expiration` to the item's expiration time, when it will be replaced with the drained item. (Default: `0`)\n - STR_VAR `item_name` to the resource name (resref) of the item to add.\n - STR_VAR `position` to the desired position of the item in the list of sale entries. The following syntax is supported (Default: `FIRST`):\n - `AFTER resref`: Will place the new item directly behind the item given by `resref`.\n You can list more than one resref, separated by space. The new item will be\n added after the entry of the first matching resref.\n - `BEFORE resref`: Will place the new item directly before the item given by `resref`.\n You can list more than one resref, separated by space. The new item will be\n added before the entry of the first matching resref.\n - `LAST`: Will place the new item after all existing items.\n - `FIRST`: Will place the new item before all existing items.\n - `AT value`: Will place the new item at the position given by the number `value`.\n Use negative values to place the new item relative to the last item position\n in reverse order.\n - STR_VAR `flags` to numeric values or the following constants: `none`, `identified`, `unstealable`, `stolen`. Constants can be combined by using ampersand (`&`) or space as separators (e.g. `identified&unstealable`). (Default: `none`)\n - STR_VAR `sale_trigger` Availability trigger (`STO V1.1` only). The following syntax is supported (Default: `#-1`):\n - `Trigger string`: Example: `GlobalGT(\"MyCondition\",\"GLOBAL\",0)`\n - `Strref value`: Example: `#1234`\n - `Translation reference`: Example: `@1000`\n - RET `index` returns the index of the added item or the last matching index when overwriting items. Returns `-1` if the item could not be added or updated.\n - RET `offset` returns the offset of the added item or the last matching offset when overwriting items. Returns `-1` if the item could not be added or updated."
2111
+ "value": "```weidu-tp2-tooltip\npatch function ADD_STORE_ITEM_EX\n```\n\n---\n\nAdds an item to the current STO file. This is a PATCH function.\n\n`position` syntax: `AFTER resref`, `BEFORE resref`, `LAST`, `FIRST`, or `AT value` (negative `value` counts from the end).\n`flags` constants: `none`, `identified`, `unstealable`, `stolen`; combinable with `&` or space.\n`sale_trigger` supports: trigger strings, strref values (`#1234`), or translation references (`@1000`).\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|charge1|= 0|  the number of charges of the 1st ability or quantity for stackables|\n|[int](https://ielib.bgforge.net/types#int)|charge2|= 0|  the number of charges of the 2nd ability|\n|[int](https://ielib.bgforge.net/types#int)|charge3|= 0|  the number of charges of the 3rd ability|\n|[int](https://ielib.bgforge.net/types#int)|stack|= 1|  the number of item instances the store carries in the stack|\n|[int](https://ielib.bgforge.net/types#int)|unlimited|= 0|  non-zero if the store should carry an inexhaustible stack of the new item|\n|[int](https://ielib.bgforge.net/types#int)|overwrite|= 0|  non-zero to overwrite any instances of an existing sale entry of matching item resref when found|\n|[int](https://ielib.bgforge.net/types#int)|expiration|= 0|  the item's expiration time, when it will be replaced with the drained item|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|item_name||  the resource name (resref) of the item to add|\n|[string](https://ielib.bgforge.net/types#string)|position|= FIRST|  the desired position of the item in the list of sale entries. `AFTER` and `BEFORE` accept multiple resrefs separated by spaces; the entry is positioned relative to the first matching resref.|\n|[string](https://ielib.bgforge.net/types#string)|flags|= none|  item flags: `none`, `identified`, `unstealable`, `stolen`; combinable with `&` or space|\n|[string](https://ielib.bgforge.net/types#string)|sale_trigger|= #-1|  availability trigger (`STO V1.1` only)|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|index||  the index of the added item or the last matching index when overwriting. Returns `-1` if the item could not be added or updated.|\n|[int](https://ielib.bgforge.net/types#int)|offset||  the offset of the added item or the last matching offset when overwriting. Returns `-1` if the item could not be added or updated.|"
2112
2112
  }
2113
2113
  },
2114
2114
  "ADD_WORLDMAP_LINKS": {
2115
2115
  "contents": {
2116
2116
  "kind": "markdown",
2117
- "value": "```weidu-tp2-tooltip\npatch function ADD_WORLDMAP_LINKS\n```\nAdd links from one worldmap area to another. This is a PATCH function.\n This function add links from one specified area to another. Links can be added from all four directional nodes (north, east, south, west) or from a specific node. If a link already exists, its metadata (distance scale, random encounters, etc.) will be overwritten. Links connecting the areas in the opposite direction will not be added. If either of the areas do not exist in the worldmap, a warning is printed and no links are added.\n - INT_VAR `distance_scale` to the distance scale between the two areas. `distance_scale` * 4 equals the travel time between the areas (in hours).\n - INT_VAR `default_entry` to the default entry location. Legal values for this variable are 1 (northern side), 2 (eastern), 4 (southern) and 8 (western). The default value is 1.\n - INT_VAR `encounter_probability` to the probability of a random encounter occurring.\n - STR_VAR `from_area` to the area from which the links should originate.\n - STR_VAR `from_node` to the directional node from which the links should originate. Legal values for this variable are “north”, n”, east”, e”, south”, s”, west and “w”. Values are not case sensitive. Links are added to all four nodes by default.\n - STR_VAR `to_area` to the area to which the links should lead.\n - STR_VAR `entry` to the entry point in `to_area`.\n - STR_VAR `random_area1` to the first random-encounter area.\n - STR_VAR `random_area2` to the second random-encounter area.\n - STR_VAR `random_area3` to the third random-encounter area.\n - STR_VAR `random_area4` to the fourth random-encounter area.\n - STR_VAR `random_area5` to the fifth random-encounter area."
2117
+ "value": "```weidu-tp2-tooltip\npatch function ADD_WORLDMAP_LINKS\n```\n\n---\n\nAdd links from one worldmap area to another. This is a PATCH function.\n This function add links from one specified area to another. Links can be added from all four directional nodes (north, east, south, west) or from a specific node. If a link already exists, its metadata (distance scale, random encounters, etc.) will be overwritten. Links connecting the areas in the opposite direction will not be added. If either of the areas do not exist in the worldmap, a warning is printed and no links are added.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|distance_scale||  the distance scale between the two areas (`distance_scale` * 4 equals the travel time in hours)|\n|[int](https://ielib.bgforge.net/types#int)|default_entry|= 1|  the default entry location: 1 (northern side), 2 (eastern), 4 (southern) or 8 (western)|\n|[int](https://ielib.bgforge.net/types#int)|encounter_probability||  the probability of a random encounter occurring|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|from_area||  the area from which the links should originate|\n|[string](https://ielib.bgforge.net/types#string)|from_node||  the directional node from which the links should originate: north, n, east, e, south, s, west, w. Not case-sensitive. Links are added to all four nodes by default.|\n|[resref](https://ielib.bgforge.net/types#resref)|to_area||  the area to which the links should lead|\n|[string](https://ielib.bgforge.net/types#string)|entry||  the entry point in `to_area`|\n|[resref](https://ielib.bgforge.net/types#resref)|random_area1||  the first random-encounter area|\n|[resref](https://ielib.bgforge.net/types#resref)|random_area2||  the second random-encounter area|\n|[resref](https://ielib.bgforge.net/types#resref)|random_area3||  the third random-encounter area|\n|[resref](https://ielib.bgforge.net/types#resref)|random_area4||  the fourth random-encounter area|\n|[resref](https://ielib.bgforge.net/types#resref)|random_area5||  the fifth random-encounter area|"
2118
2118
  }
2119
2119
  },
2120
2120
  "ALTER_AREA_ACTOR": {
2121
2121
  "contents": {
2122
2122
  "kind": "markdown",
2123
- "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_ACTOR\n```\nPatch area actors. This is a PATCH function. All integer variables, except `expiry`, default to the value -1 and a negative value results in no change to the corresponding field. The variable `expiry` instead has a default value of -2. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. All string variables except `actor_name` default to the string \"same\", which results in no change to the corresponding field. The variable `actor_name` is required.\n - INT_VAR `x_coord` to the new x coordinate. Unless dest_x is defined, x_coord is used as the x-value of the destination, as well.\n - INT_VAR `y_coord` to the new y coordinate. Unless dest_y is defined, y_coord is used as the y-value of the destination, as well.\n - INT_VAR `dest_x` to the new x destination.\n - INT_VAR `dest_y` to the new y destination.\n - INT_VAR `spawned` to the new spawned value.\n - INT_VAR `animation` to the new animation value.\n - INT_VAR `orient` to the new facing direction.\n - INT_VAR `expiry` to the new expiration time.\n - INT_VAR `wander` to the new wander-distance value.\n - INT_VAR `follow` to the new follow-distance value.\n - INT_VAR `times_talked` to the new number of times the actor has been talked to.\n - INT_VAR `flag_cre_unattached` to the new value of the flag known as CRE attached (bit 0).\n - INT_VAR `flag_seen_party` to the new value of the flag known as has seen party (bit 1).\n - INT_VAR `flag_invulnerable` to the new value of the flag known as invulnerable (bit 2).\n - INT_VAR `flag_override_script_name` to the new value of the flag known as override script name (bit 3).\n - INT_VAR `flag_time_0` through `flag_time_23` to the new values of the actor's appearance schedule.\n - STR_VAR `actor_name` to the name of the actor to be patched. This variable is required.\n - STR_VAR `dlg_file` to the resref of the new dialogue file.\n - STR_VAR `script_override` to the resref of the new override script.\n - STR_VAR `script_general` to the resref of the new general script.\n - STR_VAR `script_class` to the resref of the new class script.\n - STR_VAR `script_race` to the resref of the new race script.\n - STR_VAR `script_default` to the resref of the new default script.\n - STR_VAR `script_specifics` to the resref of the new specifics script.\n - STR_VAR `cre_file` to the resref of the new creature file."
2123
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_ACTOR\n```\n\n---\n\nPatch area actors. This is a PATCH function. All integer variables, except `expiry`, default to the value -1 and a negative value results in no change to the corresponding field. The variable `expiry` instead has a default value of -2. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. All string variables except `actor_name` default to the string \"same\", which results in no change to the corresponding field. The variable `actor_name` is required.\n\nAppearance schedule: set `flag_time_0` through `flag_time_23` (INT_VAR, default -1 each) to the new values of the actor's appearance schedule for each hour of the day. These are not listed in `args` because the schema does not support parameter ranges; use each variable individually.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|x_coord|= -1|  the new x coordinate. Unless dest_x is defined, x_coord is used as the x-value of the destination, as well.|\n|[int](https://ielib.bgforge.net/types#int)|y_coord|= -1|  the new y coordinate. Unless dest_y is defined, y_coord is used as the y-value of the destination, as well.|\n|[int](https://ielib.bgforge.net/types#int)|dest_x|= -1|  the new x destination|\n|[int](https://ielib.bgforge.net/types#int)|dest_y|= -1|  the new y destination|\n|[int](https://ielib.bgforge.net/types#int)|spawned|= -1|  the new spawned value|\n|[int](https://ielib.bgforge.net/types#int)|animation|= -1|  the new animation value|\n|[int](https://ielib.bgforge.net/types#int)|orient|= -1|  the new facing direction|\n|[int](https://ielib.bgforge.net/types#int)|expiry|= -2|  the new expiration time|\n|[int](https://ielib.bgforge.net/types#int)|wander|= -1|  the new wander-distance value|\n|[int](https://ielib.bgforge.net/types#int)|follow|= -1|  the new follow-distance value|\n|[int](https://ielib.bgforge.net/types#int)|times_talked|= -1|  the new number of times the actor has been talked to|\n|[int](https://ielib.bgforge.net/types#int)|flag_cre_unattached|= -1|  the new value of the flag known as CRE attached (bit 0)|\n|[int](https://ielib.bgforge.net/types#int)|flag_seen_party|= -1|  the new value of the flag known as has seen party (bit 1)|\n|[int](https://ielib.bgforge.net/types#int)|flag_invulnerable|= -1|  the new value of the flag known as invulnerable (bit 2)|\n|[int](https://ielib.bgforge.net/types#int)|flag_override_script_name|= -1|  the new value of the flag known as override script name (bit 3)|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|actor_name|_required_|  the name of the actor to be patched|\n|[resref](https://ielib.bgforge.net/types#resref)|dlg_file|= same|  the resref of the new dialogue file|\n|[resref](https://ielib.bgforge.net/types#resref)|script_override|= same|  the resref of the new override script|\n|[resref](https://ielib.bgforge.net/types#resref)|script_general|= same|  the resref of the new general script|\n|[resref](https://ielib.bgforge.net/types#resref)|script_class|= same|  the resref of the new class script|\n|[resref](https://ielib.bgforge.net/types#resref)|script_race|= same|  the resref of the new race script|\n|[resref](https://ielib.bgforge.net/types#resref)|script_default|= same|  the resref of the new default script|\n|[resref](https://ielib.bgforge.net/types#resref)|script_specifics|= same|  the resref of the new specifics script|\n|[resref](https://ielib.bgforge.net/types#resref)|cre_file|= same|  the resref of the new creature file|"
2124
2124
  }
2125
2125
  },
2126
2126
  "ALTER_AREA_CONTAINER": {
2127
2127
  "contents": {
2128
2128
  "kind": "markdown",
2129
- "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_CONTAINER\n```\nPatch area containers, but not their contents. This is a PATCH function. All integer variables default to -1 and negative values result in no change to the corresponding field. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. All string variables except container_name default to the string \"same\", which results in no change to the corresponding field. The variable container_name is required.\n - INT_VAR `coord_x` to the new x coordinate.\n - INT_VAR `coord_y` to the new y coordinate.\n - INT_VAR `container_type` to the new type of the container.\n - INT_VAR `trapped` to whether the container should be trapped.\n - INT_VAR `detected` to whether the container trap should be detected.\n - INT_VAR `launch_x` to the new x coordinate of the launch point.\n - INT_VAR `launch_y` to the new y coordinate of the launch point.\n - INT_VAR `bounding_left` to the new value of the left edge of the bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_top` to the new value of the top edge of the bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_right` to the new value of the right edge of the bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_bottom` to the new value of the bottom edge of the bounding box. The vertices remain unchanged.\n - INT_VAR `range` to the new trigger-range value.\n - INT_VAR `lockpick_strref` to the new strref of the lockpick string.\n - INT_VAR `lock_difficulty` to the new difficulty of the lock.\n - INT_VAR `trap_detect` to the new difficulty of trap detection.\n - INT_VAR `trap_remove` to the new difficulty of trap removal.\n - INT_VAR `flag_locked` to the new value of the flag known as locked (bit 0).\n - INT_VAR `flag_mlocked` to the new value of the flag known as magical lock (bit 2).\n - INT_VAR `flag_resets` to the new value of the flag known as trap resets (bit 3).\n - INT_VAR `flag_disabled` to the new value of the flag known as disabled (bit 5).\n - STR_VAR `container_name` to the name of the container to be patched. This variable is required.\n - STR_VAR `container_script` to the resref of the new container script.\n - STR_VAR `container_key` to the resref of the new container key."
2129
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_CONTAINER\n```\n\n---\n\nPatch area containers, but not their contents. This is a PATCH function. All integer variables default to -1 and negative values result in no change to the corresponding field. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. All string variables except container_name default to the string \"same\", which results in no change to the corresponding field. The variable container_name is required.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|coord_x|= -1|  the new x coordinate|\n|[int](https://ielib.bgforge.net/types#int)|coord_y|= -1|  the new y coordinate|\n|[int](https://ielib.bgforge.net/types#int)|container_type|= -1|  the new type of the container|\n|[int](https://ielib.bgforge.net/types#int)|trapped|= -1|  whether the container should be trapped|\n|[int](https://ielib.bgforge.net/types#int)|detected|= -1|  whether the container trap should be detected|\n|[int](https://ielib.bgforge.net/types#int)|launch_x|= -1|  the new x coordinate of the launch point|\n|[int](https://ielib.bgforge.net/types#int)|launch_y|= -1|  the new y coordinate of the launch point|\n|[int](https://ielib.bgforge.net/types#int)|bounding_left|= -1|  the new value of the left edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_top|= -1|  the new value of the top edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_right|= -1|  the new value of the right edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_bottom|= -1|  the new value of the bottom edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|range|= -1|  the new trigger-range value|\n|[int](https://ielib.bgforge.net/types#int)|lockpick_strref|= -1|  the new strref of the lockpick string|\n|[int](https://ielib.bgforge.net/types#int)|lock_difficulty|= -1|  the new difficulty of the lock|\n|[int](https://ielib.bgforge.net/types#int)|trap_detect|= -1|  the new difficulty of trap detection|\n|[int](https://ielib.bgforge.net/types#int)|trap_remove|= -1|  the new difficulty of trap removal|\n|[int](https://ielib.bgforge.net/types#int)|flag_locked|= -1|  the new value of the flag known as locked (bit 0)|\n|[int](https://ielib.bgforge.net/types#int)|flag_mlocked|= -1|  the new value of the flag known as magical lock (bit 2)|\n|[int](https://ielib.bgforge.net/types#int)|flag_resets|= -1|  the new value of the flag known as trap resets (bit 3)|\n|[int](https://ielib.bgforge.net/types#int)|flag_disabled|= -1|  the new value of the flag known as disabled (bit 5)|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|container_name|_required_|  the name of the container to be patched|\n|[resref](https://ielib.bgforge.net/types#resref)|container_script|= same|  the resref of the new container script|\n|[resref](https://ielib.bgforge.net/types#resref)|container_key|= same|  the resref of the new container key|"
2130
2130
  }
2131
2131
  },
2132
2132
  "ALTER_AREA_DOOR": {
2133
2133
  "contents": {
2134
2134
  "kind": "markdown",
2135
- "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_DOOR\n```\nPatch area doors. This is a PATCH function. All integer variables, except `string_unlock` and `string_speaker`, default to -1 and negative values result in no change to the corresponding field. The variables `string_unlock` and `string_speaker` instead default to 99999999. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. All string variables except `door_name` default to the string \"same\", which results in no change to the corresponding field. The variable `door_name` is required.\n - INT_VAR `bounding_open_left` to the new value of the left edge of the open-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_open_top` to the new value of the top edge of the open-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_open_right` to the new value of the right edge of the open-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_open_bottom` to the new value of the bottom edge of the open-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_closed_left` to the new value of the left edge of the closed-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_closed_top` to the new value of the top edge of the closed-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_closed_right` to the new value of the right edge of the closed-state bounding box. The vertices remain unchanged.\n - INT_VAR `bounding_closed_bottom` to the new value of the bottom edge of the closed-state bounding box. The vertices remain unchanged.\n - INT_VAR `door_hp` to the new hit-point value.\n - INT_VAR `door_ac` to the new armor-class value.\n - INT_VAR `cursor` to the new cursor index.\n - INT_VAR `trap_detect` to the new difficulty of trap detection.\n - INT_VAR `trap_remove` to the new difficulty of trap removal.\n - INT_VAR `trapped` to whether the door should be trapped.\n - INT_VAR `detected` to whether the door trap should be detected.\n - INT_VAR `launch_x` to the new x coordinate of the launch point.\n - INT_VAR `launch_y` to the new y coordinate of the launch point.\n - INT_VAR `door_detect` to the new difficulty of door detection.\n - INT_VAR `lock_difficulty` to the new difficulty of the lock.\n - INT_VAR `open_x` to the new x coordinate of the opening point.\n - INT_VAR `open_y` to the new y coordinate of the opening point.\n - INT_VAR `close_x` to the new x coordinate of the closing point.\n - INT_VAR `close_y` to the new y coordinate of the closing point.\n - INT_VAR `string_unlock` to the new string reference of the unlock message.\n - INT_VAR `string_speaker` to the new string reference of the dialogue-speaker name.\n - INT_VAR `flag_open` to the new value of the flag known as door open (bit 0).\n - INT_VAR `flag_locked` to the new value of the flag known as door locked (bit 1).\n - INT_VAR `flag_resets` to the new value of the flag known as reset trap (bit 2).\n - INT_VAR `flag_detectable` to the new value of the flag known as trap detectable (bit 3).\n - INT_VAR `flag_forced` to the new value of the flag known as broken (bit 4).\n - INT_VAR `flag_no_close` to the new value of the flag known as can't close (bit 5).\n - INT_VAR `flag_located` to the new value of the flag known as linked (bit 6).\n - INT_VAR `flag_secret` to the new value of the flag known as door hidden (bit 7).\n - INT_VAR `flag_detected` to the new value of the flag known as door found (bit 8).\n - INT_VAR `flag_no_look` to the new value of the flag known as don't block line of sight.\n - INT_VAR `flag_uses_key` to the new value of the flag known as remove key (bit 10).\n - INT_VAR `flag_sliding` to the new value of the flag known as ignore obstacles when closing (bit 11).\n - STR_VAR `door_name` to the name of the door to be patched. This variable is required.\n - STR_VAR `door_open_sound` to the resource reference of the opening sound.\n - STR_VAR `door_close_sound` to the resource reference of the closing sound.\n - STR_VAR `door_key` to the resref of the new door key.\n - STR_VAR `door_script` to the resref of the new door script.\n - STR_VAR `travel_trigger` to the new travel-trigger name. This field is 24 bytes in length.\n - STR_VAR `dialogue` to the new resource reference of the dialogue file."
2135
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_DOOR\n```\n\n---\n\nPatch area doors. This is a PATCH function. All integer variables, except `string_unlock` and `string_speaker`, default to -1 and negative values result in no change to the corresponding field. The variables `string_unlock` and `string_speaker` instead default to 99999999. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. All string variables except `door_name` default to the string \"same\", which results in no change to the corresponding field. The variable `door_name` is required.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|bounding_open_left|= -1|  the new value of the left edge of the open-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_open_top|= -1|  the new value of the top edge of the open-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_open_right|= -1|  the new value of the right edge of the open-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_open_bottom|= -1|  the new value of the bottom edge of the open-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_closed_left|= -1|  the new value of the left edge of the closed-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_closed_top|= -1|  the new value of the top edge of the closed-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_closed_right|= -1|  the new value of the right edge of the closed-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_closed_bottom|= -1|  the new value of the bottom edge of the closed-state bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|door_hp|= -1|  the new hit-point value|\n|[int](https://ielib.bgforge.net/types#int)|door_ac|= -1|  the new armor-class value|\n|[int](https://ielib.bgforge.net/types#int)|cursor|= -1|  the new cursor index|\n|[int](https://ielib.bgforge.net/types#int)|trap_detect|= -1|  the new difficulty of trap detection|\n|[int](https://ielib.bgforge.net/types#int)|trap_remove|= -1|  the new difficulty of trap removal|\n|[int](https://ielib.bgforge.net/types#int)|trapped|= -1|  whether the door should be trapped|\n|[int](https://ielib.bgforge.net/types#int)|detected|= -1|  whether the door trap should be detected|\n|[int](https://ielib.bgforge.net/types#int)|launch_x|= -1|  the new x coordinate of the launch point|\n|[int](https://ielib.bgforge.net/types#int)|launch_y|= -1|  the new y coordinate of the launch point|\n|[int](https://ielib.bgforge.net/types#int)|door_detect|= -1|  the new difficulty of door detection|\n|[int](https://ielib.bgforge.net/types#int)|lock_difficulty|= -1|  the new difficulty of the lock|\n|[int](https://ielib.bgforge.net/types#int)|open_x|= -1|  the new x coordinate of the opening point|\n|[int](https://ielib.bgforge.net/types#int)|open_y|= -1|  the new y coordinate of the opening point|\n|[int](https://ielib.bgforge.net/types#int)|close_x|= -1|  the new x coordinate of the closing point|\n|[int](https://ielib.bgforge.net/types#int)|close_y|= -1|  the new y coordinate of the closing point|\n|[int](https://ielib.bgforge.net/types#int)|string_unlock|= 99999999|  the new string reference of the unlock message|\n|[int](https://ielib.bgforge.net/types#int)|string_speaker|= 99999999|  the new string reference of the dialogue-speaker name|\n|[int](https://ielib.bgforge.net/types#int)|flag_open|= -1|  the new value of the flag known as door open (bit 0)|\n|[int](https://ielib.bgforge.net/types#int)|flag_locked|= -1|  the new value of the flag known as door locked (bit 1)|\n|[int](https://ielib.bgforge.net/types#int)|flag_resets|= -1|  the new value of the flag known as reset trap (bit 2)|\n|[int](https://ielib.bgforge.net/types#int)|flag_detectable|= -1|  the new value of the flag known as trap detectable (bit 3)|\n|[int](https://ielib.bgforge.net/types#int)|flag_forced|= -1|  the new value of the flag known as broken (bit 4)|\n|[int](https://ielib.bgforge.net/types#int)|flag_no_close|= -1|  the new value of the flag known as can't close (bit 5)|\n|[int](https://ielib.bgforge.net/types#int)|flag_located|= -1|  the new value of the flag known as linked (bit 6)|\n|[int](https://ielib.bgforge.net/types#int)|flag_secret|= -1|  the new value of the flag known as door hidden (bit 7)|\n|[int](https://ielib.bgforge.net/types#int)|flag_detected|= -1|  the new value of the flag known as door found (bit 8)|\n|[int](https://ielib.bgforge.net/types#int)|flag_no_look|= -1|  the new value of the flag known as don't block line of sight|\n|[int](https://ielib.bgforge.net/types#int)|flag_uses_key|= -1|  the new value of the flag known as remove key (bit 10)|\n|[int](https://ielib.bgforge.net/types#int)|flag_sliding|= -1|  the new value of the flag known as ignore obstacles when closing (bit 11)|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|door_name|_required_|  the name of the door to be patched|\n|[resref](https://ielib.bgforge.net/types#resref)|door_open_sound|= same|  the resource reference of the opening sound|\n|[resref](https://ielib.bgforge.net/types#resref)|door_close_sound|= same|  the resource reference of the closing sound|\n|[resref](https://ielib.bgforge.net/types#resref)|door_key|= same|  the resref of the new door key|\n|[resref](https://ielib.bgforge.net/types#resref)|door_script|= same|  the resref of the new door script|\n|[string](https://ielib.bgforge.net/types#string)|travel_trigger|= same|  the new travel-trigger name. This field is 24 bytes in length.|\n|[resref](https://ielib.bgforge.net/types#resref)|dialogue|= same|  the new resource reference of the dialogue file|"
2136
2136
  }
2137
2137
  },
2138
2138
  "ALTER_AREA_ENTRANCE": {
2139
2139
  "contents": {
2140
2140
  "kind": "markdown",
2141
- "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_ENTRANCE\n```\nPatch coordinates and orientation of area party entrance points. This is a PATCH function. For all integer variables, a negative value results in no change to that field and the default value is -1. The variable `entrance_name` is required.\n - INT_VAR `x_coord` to the new X coordinate.\n - INT_VAR `y_coord` to the new Y coordinate.\n - INT_VAR `orient` to the new orientation.\n - STR_VAR `entrance_name` to the name of the entrance point to be altered. This variable is required."
2141
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_ENTRANCE\n```\n\n---\n\nPatch coordinates and orientation of area party entrance points. This is a PATCH function. For all integer variables, a negative value results in no change to that field and the default value is -1. The variable `entrance_name` is required.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|x_coord|= -1|  the new X coordinate|\n|[int](https://ielib.bgforge.net/types#int)|y_coord|= -1|  the new Y coordinate|\n|[int](https://ielib.bgforge.net/types#int)|orient|= -1|  the new orientation|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|entrance_name|_required_|  the name of the entrance point to be altered|"
2142
2142
  }
2143
2143
  },
2144
2144
  "ALTER_AREA_REGION": {
2145
2145
  "contents": {
2146
2146
  "kind": "markdown",
2147
- "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_REGION\n```\nPatch ''area regions'', also known as area triggers. This is a PATCH function. For all integer variables except `info_point`, a negative value results in no change and the default value is -1. The variable `info_point` results in no change if it has the default value 99999999. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. For all string variables except `region_name`, the default value is the string \"same\", which results in no change to that field. The variable `region_name` is required.\n- INT_VAR `type` to the new type of the region.\n- INT_VAR `cursor` to the new cursor index to be used.\n- INT_VAR `trap_detect` to the new difficulty of trap detection.\n- INT_VAR `trap_remove` to the new difficulty of trap removal.\n- INT_VAR `trapped` to whether the region should be trapped.\n- INT_VAR `detected` to whether the trap should be detected.\n- INT_VAR `flag_locked` to the new value of the flag known as `locked` or `invisible trap` (bit 0).\n- INT_VAR `flag_resets` to the new value of the flag known as `trap resets` (bit 1).\n- INT_VAR `flag_party_required` to the new value of the flag known as `party is required` (bit 2).\n- INT_VAR `flag_trap_detectable` to the new value of the flag known as `trap is detectable` (bit 3).\n- INT_VAR `flag_trap_enemies` to the new value of the flag known as `trap can be set off by enemies` (bit 4).\n- INT_VAR `flag_tutorial` to the new value of the flag known as `tutorial trigger` (bit 5).\n- INT_VAR `flag_trap_npcs` to the new value of the flag known as `trap can be set off by NPCs` (bit 6).\n- INT_VAR `flag_silent` to the new value of the flag known as `silent trigger` (bit 7).\n- INT_VAR `flag_deactivated` to the new value of the flag known as `deactivated` (bit 8).\n- INT_VAR `flag_impassable_npc` to the new value of the flag known as `cannot be passed by NPCs` (bit 9).\n- INT_VAR `flag_activation_point` to the new value of the flag known as `use activation point` (bit 10).\n- INT_VAR `flag_connect_to_door` to the new value of the flag known as `connected to door` (bit 11).\n- INT_VAR `bounding_left` to the new value of the left edge of the bounding box. The vertices remain unchanged.\n- INT_VAR `bounding_top` to the new value of the top edge of the bounding box. The vertices remain unchanged.\n- INT_VAR `bounding_right` to the new value of the right edge of the bounding box. The vertices remain unchanged.\n- INT_VAR `bounding_bottom` to the new value of the bottom edge of the bounding box. The vertices remain unchanged.\n- INT_VAR `info_point` to the new string reference of the info point.\n- INT_VAR `launch_x` to the new x coordinate of the launch point.\n- INT_VAR `launch_y` to the new y coordinate of the launch point.\n- INT_VAR `activate_x` to the new x coordinate of the activation point.\n- INT_VAR `activate_y` to the new y coordinate of the activation point.\n- STR_VAR `region_name` to the name of the region to be patched. This variable is required.\n- STR_VAR `destination_area` to the resref of the new destination area.\n- STR_VAR `entrance_name` to the new entrance name of the destination area.\n- STR_VAR `region_key` to the resref of the key item.\n- STR_VAR `region_script` to the resref of the region script.\n"
2147
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_AREA_REGION\n```\n\n---\n\nPatch area regions, also known as area triggers. This is a PATCH function. For all integer variables except `info_point`, a negative value results in no change and the default value is -1. The variable `info_point` results in no change if it has the default value 99999999. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. For all string variables except `region_name`, the default value is the string \"same\", which results in no change to that field. The variable `region_name` is required.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|type|= -1|  the new type of the region|\n|[int](https://ielib.bgforge.net/types#int)|cursor|= -1|  the new cursor index to be used|\n|[int](https://ielib.bgforge.net/types#int)|trap_detect|= -1|  the new difficulty of trap detection|\n|[int](https://ielib.bgforge.net/types#int)|trap_remove|= -1|  the new difficulty of trap removal|\n|[int](https://ielib.bgforge.net/types#int)|trapped|= -1|  whether the region should be trapped|\n|[int](https://ielib.bgforge.net/types#int)|detected|= -1|  whether the trap should be detected|\n|[int](https://ielib.bgforge.net/types#int)|flag_locked|= -1|  the new value of the flag known as `locked` or `invisible trap` (bit 0)|\n|[int](https://ielib.bgforge.net/types#int)|flag_resets|= -1|  the new value of the flag known as `trap resets` (bit 1)|\n|[int](https://ielib.bgforge.net/types#int)|flag_party_required|= -1|  the new value of the flag known as `party is required` (bit 2)|\n|[int](https://ielib.bgforge.net/types#int)|flag_trap_detectable|= -1|  the new value of the flag known as `trap is detectable` (bit 3)|\n|[int](https://ielib.bgforge.net/types#int)|flag_trap_enemies|= -1|  the new value of the flag known as `trap can be set off by enemies` (bit 4)|\n|[int](https://ielib.bgforge.net/types#int)|flag_tutorial|= -1|  the new value of the flag known as `tutorial trigger` (bit 5)|\n|[int](https://ielib.bgforge.net/types#int)|flag_trap_npcs|= -1|  the new value of the flag known as `trap can be set off by NPCs` (bit 6)|\n|[int](https://ielib.bgforge.net/types#int)|flag_silent|= -1|  the new value of the flag known as `silent trigger` (bit 7)|\n|[int](https://ielib.bgforge.net/types#int)|flag_deactivated|= -1|  the new value of the flag known as `deactivated` (bit 8)|\n|[int](https://ielib.bgforge.net/types#int)|flag_impassable_npc|= -1|  the new value of the flag known as `cannot be passed by NPCs` (bit 9)|\n|[int](https://ielib.bgforge.net/types#int)|flag_activation_point|= -1|  the new value of the flag known as `use activation point` (bit 10)|\n|[int](https://ielib.bgforge.net/types#int)|flag_connect_to_door|= -1|  the new value of the flag known as `connected to door` (bit 11)|\n|[int](https://ielib.bgforge.net/types#int)|bounding_left|= -1|  the new value of the left edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_top|= -1|  the new value of the top edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_right|= -1|  the new value of the right edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|bounding_bottom|= -1|  the new value of the bottom edge of the bounding box. The vertices remain unchanged.|\n|[int](https://ielib.bgforge.net/types#int)|info_point|= 99999999|  the new string reference of the info point|\n|[int](https://ielib.bgforge.net/types#int)|launch_x|= -1|  the new x coordinate of the launch point|\n|[int](https://ielib.bgforge.net/types#int)|launch_y|= -1|  the new y coordinate of the launch point|\n|[int](https://ielib.bgforge.net/types#int)|activate_x|= -1|  the new x coordinate of the activation point|\n|[int](https://ielib.bgforge.net/types#int)|activate_y|= -1|  the new y coordinate of the activation point|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|region_name|_required_|  the name of the region to be patched|\n|[resref](https://ielib.bgforge.net/types#resref)|destination_area|= same|  the resref of the new destination area|\n|[string](https://ielib.bgforge.net/types#string)|entrance_name|= same|  the new entrance name of the destination area|\n|[resref](https://ielib.bgforge.net/types#resref)|region_key|= same|  the resref of the key item|\n|[resref](https://ielib.bgforge.net/types#resref)|region_script|= same|  the resref of the region script|"
2148
2148
  }
2149
2149
  },
2150
2150
  "ALTER_EFFECT": {
2151
2151
  "contents": {
2152
2152
  "kind": "markdown",
2153
- "value": "```weidu-tp2-tooltip\npatch function ALTER_EFFECT\n```\nThis is a patch function for creature, item, or spell files that will match an existing effect and alter it based on the defined variables. Numerous variables are available for matching the specified effect and for specifying new values.\n The first batch of variables are meta-variables which will help determine the scope of the function\":\"\n - INT_VAR `check_globals` to whether the function should loop through global effects on items (also known as equipping effects) and spells (default is 1). Creature effects are all global effects, so this variable will always be considered to be one when this function is run on a creature.\n - INT_VAR `check_headers` to whether the function should loop through effects on extended headers on items and spells (default is 1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n - INT_VAR `header` to whether the function should target effects on one specific header, counting the first header as zero. A negative value will match all headers (default is -1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n - INT_VAR `header_type` to whether the function should only alter effects on extended headers of the specified type (1 - melee, 2 - ranged, etc.). Negative values will look at effects on all headers (default is -1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n - INT_VAR `multi_match` to the number of effects to alter in the active stack. If you just want to match the first effect and have the function stop, use 1. Otherwise the function will continue matching until the number of altered effects matches this value. The function will always make at least one change (e.g. 0 or negative values are treated as 1). (default is 999).\n - INT_VAR `verbose` to whether the function should provide some rudimentary information on how many effects were added (default is 0).\n - INT_VAR `silent` to whether the function should suppress warnings when no effects were altered. This option also suppresses the verbose option (default is 0).\n The next batch of variables sets the function boundaries on matching an effect to alter. Any variables not specified will not be used to determine a match. The function will only determine an effect is a match only if ALL of the variables specified are matched.\n - INT_VAR `match_opcode` to the opcode of effects to be matched (default is -1).\n - INT_VAR `match_target` to the target of effects to be matched (default is -1).\n - INT_VAR `match_power` to the power of effects to be matched (default is -1).\n - INT_VAR `match_parameter1` to parameter1 of effects to be matched (default is -1).\n - INT_VAR `match_parameter2` to parameter2 of effects to be matched (default is -1).\n - INT_VAR `match_timing` to the timing of effects to be matched (default is -1).\n - INT_VAR `match_resist_dispel` to the resist/dispel setting of effects to be matched (default is -1).\n - INT_VAR `match_duration` to the duration of effects to be matched (default is -1).\n - INT_VAR `match_probability1` to probability1 (the upper bound) of effects to be matched (default is -1).\n - INT_VAR `match_probability2` to probability2 (the lower bound) of effects to be matched (default is -1).\n - INT_VAR `match_dicenumber` to the number of dice of effects to be matched (default is -1). This field is instead used for maximum hit-dice (HD) by some opcodes.\n - INT_VAR `match_dicesize` to the size of dice of effects to be matched (default is -1). This field is used instead for minimum hit-dice (HD) by some opcodes.\n - INT_VAR `match_savingthrow` to the saving throw type of effects to be matched (default is -1).\n - INT_VAR `match_savebonus` to the saving trow bonus effects to be matched (default is -11). Since saving throws can range into negative values, this variable can match all the way down to -10.\n - INT_VAR `match_special` to the special field of effects to be matched (default is -1). The special field is used by some EE effects.\n - STR_VAR `match_resource` to the resource of effects to be matched (default is \"SAME\").\n Once a matching effect is found, the next series of variables allows the function to change the fields to these new values in the matched effect. Any variables not set in this batch will keep their existing values.\n - INT_VAR `opcode` to the value the of the altered effect's opcode.\n - INT_VAR `target` to the altered effect's target.\n - INT_VAR `power` to the altered effect's power.\n - INT_VAR `parameter1` to the altered effect's parameter1.\n - INT_VAR `parameter2` to the altered effect's parameter2.\n - INT_VAR `timing` to the altered effect's timing mode.\n - INT_VAR `resist_dispel` to the altered effect's resist/dispel setting.\n - INT_VAR `duration` to the altered effect's duration.\n - INT_VAR `probability1` to the altered effect's probability1 (the upper bound).\n - INT_VAR `probability2` to the altered effect's probability2 (the lower bound).\n - INT_VAR `dicenumber` to the altered effect's number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.\n - INT_VAR `dicesize` to the altered effect's size of dice. This field is also instead used for minimum hit-dice (HD) by some opcodes.\n - INT_VAR `savingthrow` to the altered effect's saving-throw type.\n - INT_VAR `savebonus` to the altered effect's saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field.\n - INT_VAR `special` to the new effect's special field. The special field is used by many EE effects.\n - STR_VAR `resource` to the altered effect's resource reference."
2153
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_EFFECT\n```\n\n---\n\nThis is a patch function for creature, item, or spell files that will match an existing effect and alter it based on the defined variables. Numerous variables are available for matching the specified effect and for specifying new values. Meta-variables determine the scope of the function; match variables determine which effects are matched (all must match); new-value variables set new field values in matched effects (any unset variables keep existing values).\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|check_globals|= 1|  whether the function should loop through global effects on items (equipping effects) and spells. Creature effects are all global, so this is always treated as 1 on creatures.|\n|[int](https://ielib.bgforge.net/types#int)|check_headers|= 1|  whether the function should loop through effects on extended headers on items and spells. Ignored for creatures.|\n|[int](https://ielib.bgforge.net/types#int)|header|= -1|  whether the function should target effects on one specific header, counting the first header as zero. A negative value will match all headers. Ignored for creatures.|\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  whether the function should only alter effects on extended headers of the specified type (1=melee, 2=ranged, etc.). Negative values match all headers. Ignored for creatures.|\n|[int](https://ielib.bgforge.net/types#int)|multi_match|= 999|  the number of effects to alter in the active stack. The function will always make at least one change (0 or negative values are treated as 1).|\n|[int](https://ielib.bgforge.net/types#int)|verbose|= 0|  whether the function should provide some rudimentary information on how many effects were added|\n|[int](https://ielib.bgforge.net/types#int)|silent|= 0|  whether the function should suppress warnings when no effects were altered. This option also suppresses the verbose option.|\n|[int](https://ielib.bgforge.net/types#int)|match_opcode|= -1|  the opcode of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_target|= -1|  the target of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_power|= -1|  the power of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_parameter1|= -1|  parameter1 of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_parameter2|= -1|  parameter2 of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_timing|= -1|  the timing of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_resist_dispel|= -1|  the resist/dispel setting of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_duration|= -1|  the duration of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_probability1|= -1|  probability1 (the upper bound) of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_probability2|= -1|  probability2 (the lower bound) of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_dicenumber|= -1|  the number of dice of effects to be matched. This field is instead used for maximum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|match_dicesize|= -1|  the size of dice of effects to be matched. This field is used instead for minimum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|match_savingthrow|= -1|  the saving throw type of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_savebonus|= -11|  the saving throw bonus of effects to be matched. Since saving throws can range into negative values, this variable can match all the way down to -10.|\n|[int](https://ielib.bgforge.net/types#int)|match_special|= -1|  the special field of effects to be matched. The special field is used by some EE effects.|\n|[int](https://ielib.bgforge.net/types#int)|opcode||  the value of the altered effect's opcode|\n|[int](https://ielib.bgforge.net/types#int)|target||  the altered effect's target|\n|[int](https://ielib.bgforge.net/types#int)|power||  the altered effect's power|\n|[int](https://ielib.bgforge.net/types#int)|parameter1||  the altered effect's parameter1|\n|[int](https://ielib.bgforge.net/types#int)|parameter2||  the altered effect's parameter2|\n|[int](https://ielib.bgforge.net/types#int)|timing||  the altered effect's timing mode|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel||  the altered effect's resist/dispel setting|\n|[int](https://ielib.bgforge.net/types#int)|duration||  the altered effect's duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1||  the altered effect's probability1 (the upper bound)|\n|[int](https://ielib.bgforge.net/types#int)|probability2||  the altered effect's probability2 (the lower bound)|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber||  the altered effect's number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|dicesize||  the altered effect's size of dice. This field is also instead used for minimum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow||  the altered effect's saving-throw type|\n|[int](https://ielib.bgforge.net/types#int)|savebonus||  the altered effect's saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field.|\n|[int](https://ielib.bgforge.net/types#int)|special||  the new effect's special field. The special field is used by many EE effects.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|match_resource|= SAME|  the resource of effects to be matched|\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  the altered effect's resource reference|"
2154
2154
  }
2155
2155
  },
2156
2156
  "ALTER_ITEM_EFFECT": {
2157
2157
  "contents": {
2158
2158
  "kind": "markdown",
2159
- "value": "```weidu-tp2-tooltip\npatch function ALTER_ITEM_EFFECT\n```\nPatch global (equipping) effects and/or effects on extended headers. This is a PATCH function. All integer variables except `check_globals`, `check_headers`, `header` and `savebonus` default to -1 and negative values result in no change to the corresponding field. The integer variables `check_globals`, `check_headers` and `header` default to 0. The integer variable `savebonus` defaults to -11 and values lower than -10 result in no change to the corresponding field. The string variable `resource` defaults to the string \"same\", which results in no change to the corresponding field.\n Note that both `check_globals` and `check_headers` are 0 by default, so you need to change one or both of these to 1 to perform any patching at all. If you patch headers, you can further target by using `type` to target melee, ranged, or magical headers. `match_opcode` can be left at -1 to match all effects on your targeted range or targeted to a specific opcode. If the opcode itself needs to be changed, you can use `match_opcode` to target the existing effect and `new_opcode` as the new opcode to use. `duration_high` is an alternative to `duration`, mainly for changing the overall duration of an item's effects. The idea is to allow you to mass patch effects to new durations while leaving the one-time only cosmetics and visuals--which are usual instant or only run for a few seconds--unchanged.\n - INT_VAR `check_globals` to whether to check global (on-equip) effects (0 for no, 1 for yes). (default 0)\n - INT_VAR `check_headers` to whether to check effects on extended headers (0 for no, 1 for yes). (default 0)\n - INT_VAR `header` to the number of the ability header that should be altered. A value of 0 matches all headers. (default 0)\n - INT_VAR `header_type` to which type of header that should be checked. If this variable is -1, all header types will be checked.\n - INT_VAR `match_opcode` to which type of opcode to match. If this variable is -1, all opcodes are a match.\n - INT_VAR `new_opcode` to the value the matched opcode should be changed into.\n - INT_VAR `target` to the new target.\n - INT_VAR `power` to the new power.\n - INT_VAR `parameter1` to the new parameter1.\n - INT_VAR `parameter2` to the new parameter2.\n - INT_VAR `timing` to the new timing mode.\n - INT_VAR `resist_dispel` to the new resist/dispel.\n - INT_VAR `duration` to the new duration.\n - INT_VAR `duration_high` to the new duration, but is only written if the existing duration is greater than 5.\n - INT_VAR `probability1` to the new probability1 (the upper bound).\n - INT_VAR `probability2` to the new probability2 (the lower bound).\n - INT_VAR `dicenumber` to the new number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.\n - INT_VAR `dicesize` to the new size of dice. This field is also instead used for minimum hit-dice (HD) by some opcodes.\n - INT_VAR `savingthrow` to the new saving-throw type.\n - INT_VAR `savebonus` to the new saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field. (default -11)\n - INT_VAR `special` to the new special parameter.\n - STR_VAR `resource` to the new resource reference."
2159
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_ITEM_EFFECT\n```\n\n---\n\nPatch global (equipping) effects and/or effects on extended headers. This is a PATCH function. All integer variables except `check_globals`, `check_headers`, `header` and `savebonus` default to -1 and negative values result in no change to the corresponding field. The integer variables `check_globals`, `check_headers` and `header` default to 0. The integer variable `savebonus` defaults to -11 and values lower than -10 result in no change to the corresponding field. The string variable `resource` defaults to the string \"same\", which results in no change to the corresponding field.\nNote that both `check_globals` and `check_headers` are 0 by default, so you need to change one or both of these to 1 to perform any patching at all. `duration_high` is an alternative to `duration`, mainly for changing the overall duration of an item's effects while leaving the one-time only cosmetics and visuals unchanged. You can further target by using `header_type` to target melee, ranged, or magical headers. `match_opcode` can be left at -1 to match all effects on your targeted range or set to a specific opcode; if the opcode itself needs to be changed, use `match_opcode` to target the existing effect and `new_opcode` as the replacement opcode.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|check_globals|= 0|  whether to check global (on-equip) effects (0 for no, 1 for yes)|\n|[int](https://ielib.bgforge.net/types#int)|check_headers|= 0|  whether to check effects on extended headers (0 for no, 1 for yes)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  the number of the ability header that should be altered. A value of 0 matches all headers.|\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  which type of header that should be checked. If this variable is -1, all header types will be checked.|\n|[int](https://ielib.bgforge.net/types#int)|match_opcode|= -1|  which type of opcode to match. If this variable is -1, all opcodes are a match.|\n|[int](https://ielib.bgforge.net/types#int)|new_opcode|= -1|  the value the matched opcode should be changed into|\n|[int](https://ielib.bgforge.net/types#int)|target|= -1|  the new target|\n|[int](https://ielib.bgforge.net/types#int)|power|= -1|  the new power|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= -1|  the new parameter1|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= -1|  the new parameter2|\n|[int](https://ielib.bgforge.net/types#int)|timing|= -1|  the new timing mode|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= -1|  the new resist/dispel|\n|[int](https://ielib.bgforge.net/types#int)|duration|= -1|  the new duration|\n|[int](https://ielib.bgforge.net/types#int)|duration_high|= -1|  the new duration, but is only written if the existing duration is greater than 5. One-time cosmetic effects are typically instant or only a few seconds, so a threshold of 5 naturally excludes them.|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= -1|  the new probability1 (the upper bound)|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= -1|  the new probability2 (the lower bound)|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= -1|  the new number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= -1|  the new size of dice. This field is also instead used for minimum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= -1|  the new saving-throw type|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= -11|  the new saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field.|\n|[int](https://ielib.bgforge.net/types#int)|special|= -1|  the new special parameter|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource|= same|  the new resource reference|"
2160
2160
  }
2161
2161
  },
2162
2162
  "ALTER_ITEM_HEADER": {
2163
2163
  "contents": {
2164
2164
  "kind": "markdown",
2165
- "value": "```weidu-tp2-tooltip\npatch function ALTER_ITEM_HEADER\n```\nPatch ability headers on items. This is a PATCH function. All integer variables except `match_icon` and `header` default to -1 and negative values result in no change to the corresponding field. The integer variables `match_icon` and `header` default to 0. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. The string variable `icon` defaults to the string \\\"same\\\", which results in no change to the corresponding field.\n\n`header_type` is used to limit the scope of matching. The default value of -1 will match all types of headers while values of 0-4 will match headers with those values. If `match_icon` is 1, the icon resource reference will be match with the `icon` variable as an additional qualifier. This is useful for items which have multiple magic abilities. `header` can also be used to limit patching to the Nth header, counting from 1 as the first header. The default is 0, which will match all headers.\n\n- INT_VAR `header_type` to the type of header to be matched. If this variable is -1, all headers will be a match. (default -1)\n- INT_VAR `match_icon` to whether to match the ability icon (0 for no, 1 for yes). (default 0)\n- INT_VAR `header` to the number of the ability header (starting from 1) that should be altered. A value of 0 matches all header. (default 0)\n- INT_VAR `new_header_type` to the value the matched header should be changed into.\n- INT_VAR `identify` to the new identification requirement.\n- INT_VAR `location` to the new new ability location.\n- INT_VAR `target` to the new target.\n- INT_VAR `target_count` to the new target count.\n- INT_VAR `range` to the new range.\n- INT_VAR `launcher` to the new required launcher.\n- INT_VAR `speed` to the new speed factor.\n- INT_VAR `thac0_bonus` to the new THAC0 bonus.\n- INT_VAR `dicesize` to the new dice size.\n- INT_VAR `primary_type` to the new primary type (school).\n- INT_VAR `dicenumber` to the new number of dice.\n- INT_VAR `secondary_type` to the new secondary type.\n- INT_VAR `damage_bonus` to the new damage bonus.\n- INT_VAR `damage_type` to the new damage type.\n- INT_VAR `charges` to the new number of charges.\n- INT_VAR `drained` to the new charge-depletion behaviour.\n- INT_VAR `projectile` to the new projectile.\n- INT_VAR `animation_overhand` to the new overhand animation percentage.\n- INT_VAR `animation_backhand` to the new backhand animation percentage.\n- INT_VAR `animation_thrust` to the new thrust animation percentage.\n- INT_VAR `arrow` to the new arrow qualifier.\n- INT_VAR `bolt` to the new bolt qualifier.\n- INT_VAR `bullet` to the new bullet qualifier.\n- INT_VAR `flag_strength` to the new value of the flag known as `add strength bonus` (bit 0).\n- INT_VAR `flag_break` to the new value of the flag known as `breakable` (bit 1).\n- INT_VAR `flag_strength_damage` to the new value of the flag known as `add strength bonus to damage only` (bit 2). This flag is not available in all games.\n- INT_VAR `flag_strength_thac0` to the new value of the flag known as `add strength bonus to THAC0 only` (bit 3). This flag is not available in all games.\n- INT_VAR `flag_hostile` to the new value of the flag known as `hostile` (bit 10).\n- INT_VAR `flag_recharge` to the new value of the flag known as `recharges` (bit 11).\n- INT_VAR `flag_bypass` to the new value of the flag known as `bypass armor` (bit 16). This flag is not available in all games.\n- INT_VAR `flag_keenedge` to the new value of the flag known as `keen edge` (bit 17). This flag is not available in all games.\n- INT_VAR `flag_backstab` to the new value of the flag known as `toggle backstab` (bit 25). This flag is not available in all games.\n- INT_VAR `flag_noinvisible` to the new value of the flag known as `cannot target invisible` (bit 26). This flag is not available in all games.\n- STR_VAR `icon` to the resource reference to be used for matching if `match_icon` is 1, or the new ability icon if `match_icon` is 0.\n"
2165
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_ITEM_HEADER\n```\n\n---\n\nPatch ability headers on items. This is a PATCH function. All integer variables except `match_icon` and `header` default to -1 and negative values result in no change to the corresponding field. The integer variables `match_icon` and `header` default to 0. In the case of flags, a value of 1 will set the flag and a value of 0 will unset it. The string variable `icon` defaults to the string \"same\", which results in no change to the corresponding field.\n`header_type` is used to limit the scope of matching. The default value of -1 will match all types of headers while values of 0-4 will match headers with those values. If `match_icon` is 1, the icon resource reference will be matched with the `icon` variable as an additional qualifier. `header` can also be used to limit patching to the Nth header, counting from 1 as the first header. The default is 0, which will match all headers.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  the type of header to be matched. If this variable is -1, all headers will be a match.|\n|[int](https://ielib.bgforge.net/types#int)|match_icon|= 0|  whether to match the ability icon (0 for no, 1 for yes)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  the number of the ability header (starting from 1) that should be altered. A value of 0 matches all headers.|\n|[int](https://ielib.bgforge.net/types#int)|new_header_type|= -1|  the value the matched header should be changed into|\n|[int](https://ielib.bgforge.net/types#int)|identify|= -1|  the new identification requirement|\n|[int](https://ielib.bgforge.net/types#int)|location|= -1|  the new ability location|\n|[int](https://ielib.bgforge.net/types#int)|target|= -1|  the new target|\n|[int](https://ielib.bgforge.net/types#int)|target_count|= -1|  the new target count|\n|[int](https://ielib.bgforge.net/types#int)|range|= -1|  the new range|\n|[int](https://ielib.bgforge.net/types#int)|launcher|= -1|  the new required launcher|\n|[int](https://ielib.bgforge.net/types#int)|speed|= -1|  the new speed factor|\n|[int](https://ielib.bgforge.net/types#int)|thac0_bonus|= -1|  the new THAC0 bonus|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= -1|  the new dice size|\n|[int](https://ielib.bgforge.net/types#int)|primary_type|= -1|  the new primary type (school)|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= -1|  the new number of dice|\n|[int](https://ielib.bgforge.net/types#int)|secondary_type|= -1|  the new secondary type|\n|[int](https://ielib.bgforge.net/types#int)|damage_bonus|= -1|  the new damage bonus|\n|[int](https://ielib.bgforge.net/types#int)|damage_type|= -1|  the new damage type|\n|[int](https://ielib.bgforge.net/types#int)|charges|= -1|  the new number of charges|\n|[int](https://ielib.bgforge.net/types#int)|drained|= -1|  the new charge-depletion behaviour|\n|[int](https://ielib.bgforge.net/types#int)|projectile|= -1|  the new projectile|\n|[int](https://ielib.bgforge.net/types#int)|animation_overhand|= -1|  the new overhand animation percentage|\n|[int](https://ielib.bgforge.net/types#int)|animation_backhand|= -1|  the new backhand animation percentage|\n|[int](https://ielib.bgforge.net/types#int)|animation_thrust|= -1|  the new thrust animation percentage|\n|[int](https://ielib.bgforge.net/types#int)|arrow|= -1|  the new arrow qualifier|\n|[int](https://ielib.bgforge.net/types#int)|bolt|= -1|  the new bolt qualifier|\n|[int](https://ielib.bgforge.net/types#int)|bullet|= -1|  the new bullet qualifier|\n|[int](https://ielib.bgforge.net/types#int)|flag_strength|= -1|  the new value of the flag known as `add strength bonus` (bit 0)|\n|[int](https://ielib.bgforge.net/types#int)|flag_break|= -1|  the new value of the flag known as `breakable` (bit 1)|\n|[int](https://ielib.bgforge.net/types#int)|flag_strength_damage|= -1|  the new value of the flag known as `add strength bonus to damage only` (bit 2). This flag is not available in all games.|\n|[int](https://ielib.bgforge.net/types#int)|flag_strength_thac0|= -1|  the new value of the flag known as `add strength bonus to THAC0 only` (bit 3). This flag is not available in all games.|\n|[int](https://ielib.bgforge.net/types#int)|flag_hostile|= -1|  the new value of the flag known as `hostile` (bit 10)|\n|[int](https://ielib.bgforge.net/types#int)|flag_recharge|= -1|  the new value of the flag known as `recharges` (bit 11)|\n|[int](https://ielib.bgforge.net/types#int)|flag_bypass|= -1|  the new value of the flag known as `bypass armor` (bit 16). This flag is not available in all games.|\n|[int](https://ielib.bgforge.net/types#int)|flag_keenedge|= -1|  the new value of the flag known as `keen edge` (bit 17). This flag is not available in all games.|\n|[int](https://ielib.bgforge.net/types#int)|flag_backstab|= -1|  the new value of the flag known as `toggle backstab` (bit 25). This flag is not available in all games.|\n|[int](https://ielib.bgforge.net/types#int)|flag_noinvisible|= -1|  the new value of the flag known as `cannot target invisible` (bit 26). This flag is not available in all games.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|icon|= same|  the resource reference to be used for matching if `match_icon` is 1, or the new ability icon if `match_icon` is 0|"
2166
2166
  }
2167
2167
  },
2168
2168
  "ALTER_SPELL_EFFECT": {
2169
2169
  "contents": {
2170
2170
  "kind": "markdown",
2171
- "value": "```weidu-tp2-tooltip\npatch function ALTER_SPELL_EFFECT\n```\nPatch effects on spells. This is a PATCH function. All integer variables except `check_globals`, `check_headers`, `header` and `savebonus` default to -1 and negative values result in no change to the corresponding field. The integer variables `check_globals` and `header` default to 0. The integer variable `check_headers` defaults to 1. The integer variable `savebonus` defaults to -11 and values lower than -10 result in no change to the corresponding field. The string variable `resource` defaults to the string \"same\", which results in no change to the corresponding field.\n The function will by default only check effects on headers. You can change this by changing the values of the variables `check_globals` and `check_headers`. If you patch headers, you can further target by using `type` to target melee, ranged, or magical headers. `match_opcode` can be left at -1 to match all effects on your targeted range or targeted to a specific opcode. If the opcode itself needs to be changed, you can use `match_opcode` to target the existing effect and `new_opcode` as the new opcode to use. `duration_high` is an alternative to `duration`, mainly for changing the overall duration of an item's effects. The idea is to allow you to mass patch effects to new durations while leaving the one-time only cosmetics and visuals--which are usual instant or only run for a few seconds--unchanged.\n - INT_VAR `check_globals` to whether to check global effects (0 for no, 1 for yes). (default 0)\n - INT_VAR `check_headers` to whether to check effects on extended headers (0 for no, 1 for yes). (default 1)\n - INT_VAR `header` to the number of the ability header that should be altered. A value of 0 matches all headers. (default 0)\n - INT_VAR `header_type` to which type of header that should be checked. If this variable is -1, all header types will be checked.\n - INT_VAR `match_opcode` to which type of opcode to match. If this variable is -1, all opcodes are a match.\n - INT_VAR `new_opcode` to the value the matched opcode should be changed into.\n - INT_VAR `target` to the new target.\n - INT_VAR `power` to the new power.\n - INT_VAR `parameter1` to the new parameter1.\n - INT_VAR `parameter2` to the new parameter2.\n - INT_VAR `timing` to the new timing mode.\n - INT_VAR `resist_dispel` to the new resist/dispel.\n - INT_VAR `duration` to the new duration.\n - INT_VAR `duration_high` to the new duration, but is only written if the existing duration is greater than 5.\n - INT_VAR `probability1` to the new probability1 (the upper bound).\n - INT_VAR `probability2` to the new probability2 (the lower bound).\n - INT_VAR `dicenumber` to the new number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.\n - INT_VAR `dicesize` to the new size of dice. This field is also instead used for minimum hit-dice (HD) by some opcodes.\n - INT_VAR `savingthrow` to the new saving-throw type.\n - INT_VAR `savebonus` to the new saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field. (default -11)\n - INT_VAR `special` to the new special parameter.\n - STR_VAR `resource` to the new resource reference."
2171
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_SPELL_EFFECT\n```\n\n---\n\nPatch effects on spells. This is a PATCH function. All integer variables except `check_globals`, `check_headers`, `header` and `savebonus` default to -1 and negative values result in no change to the corresponding field. The integer variables `check_globals` and `header` default to 0. The integer variable `check_headers` defaults to 1. The integer variable `savebonus` defaults to -11 and values lower than -10 result in no change to the corresponding field. The string variable `resource` defaults to the string \"same\", which results in no change to the corresponding field.\nThe function will by default only check effects on headers. `duration_high` is an alternative to `duration`, mainly for changing the overall duration of spell effects while leaving the one-time only cosmetics and visuals unchanged. You can further target by using `header_type` to target melee, ranged, or magical headers. `match_opcode` can be left at -1 to match all effects on your targeted range or set to a specific opcode; if the opcode itself needs to be changed, use `match_opcode` to target the existing effect and `new_opcode` as the replacement opcode.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|check_globals|= 0|  whether to check global effects (0 for no, 1 for yes)|\n|[int](https://ielib.bgforge.net/types#int)|check_headers|= 1|  whether to check effects on extended headers (0 for no, 1 for yes)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  the number of the ability header that should be altered. A value of 0 matches all headers.|\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  which type of header that should be checked. If this variable is -1, all header types will be checked.|\n|[int](https://ielib.bgforge.net/types#int)|match_opcode|= -1|  which type of opcode to match. If this variable is -1, all opcodes are a match.|\n|[int](https://ielib.bgforge.net/types#int)|new_opcode|= -1|  the value the matched opcode should be changed into|\n|[int](https://ielib.bgforge.net/types#int)|target|= -1|  the new target|\n|[int](https://ielib.bgforge.net/types#int)|power|= -1|  the new power|\n|[int](https://ielib.bgforge.net/types#int)|parameter1|= -1|  the new parameter1|\n|[int](https://ielib.bgforge.net/types#int)|parameter2|= -1|  the new parameter2|\n|[int](https://ielib.bgforge.net/types#int)|timing|= -1|  the new timing mode|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel|= -1|  the new resist/dispel|\n|[int](https://ielib.bgforge.net/types#int)|duration|= -1|  the new duration|\n|[int](https://ielib.bgforge.net/types#int)|duration_high|= -1|  the new duration, but is only written if the existing duration is greater than 5. One-time cosmetic effects are typically instant or only a few seconds, so a threshold of 5 naturally excludes them.|\n|[int](https://ielib.bgforge.net/types#int)|probability1|= -1|  the new probability1 (the upper bound)|\n|[int](https://ielib.bgforge.net/types#int)|probability2|= -1|  the new probability2 (the lower bound)|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= -1|  the new number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= -1|  the new size of dice. This field is also instead used for minimum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow|= -1|  the new saving-throw type|\n|[int](https://ielib.bgforge.net/types#int)|savebonus|= -11|  the new saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field.|\n|[int](https://ielib.bgforge.net/types#int)|special|= -1|  the new special parameter|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|resource|= same|  the new resource reference|"
2172
2172
  }
2173
2173
  },
2174
2174
  "ALTER_SPELL_HEADER": {
2175
2175
  "contents": {
2176
2176
  "kind": "markdown",
2177
- "value": "```weidu-tp2-tooltip\npatch function ALTER_SPELL_HEADER\n```\nPatch ability headers on spells. This is a PATCH function.All integer variables except `match_icon` and `header` default to -1 and negative values result in no change to the corresponding field. The integer variables `match_icon` and `header` default to 0. The string variable `icon` defaults to the string \"same\", which results in no change to the corresponding field.\n `header_type` is used to limit the scope of matching. The default value of -1 will match all types of headers while values of 0-4 will match headers with those values. If `match_icon` is 1, the `icon` resource reference will be match with the `icon` variable as an additional qualifier. This is useful for items which have multiple magic abilities. `header` can also be used to limit patching to the Nth header, counting from 1 as the first header. The default is 0, which will match all headers.\n - INT_VAR `header_type` to the type of header to be matched. If this variable is -1, all headers will be a match. (default -1)\n - INT_VAR `match_icon` to whether to match the ability icon (0 for no, 1 for yes). (default 0)\n - INT_VAR `header` to the number of the ability header (starting from 1) that should be altered. A value of 0 matches all header. (default 0)\n - INT_VAR `new_header_type` to the value the matched header should be changed into.\n - INT_VAR `location` to the new new ability location.\n - INT_VAR `target` to the new target.\n - INT_VAR `target_count` to the new target count.\n - INT_VAR `range` to the new range.\n - INT_VAR `min_level` to the new required minimum level.\n - INT_VAR `speed` to the new speed factor.\n - INT_VAR `thac0_bonus` to the new THAC0 bonus.\n - INT_VAR `dicesize` to the new dice size.\n - INT_VAR `dicenumber` to the new number of dice.\n - INT_VAR `damage_bonus` to the new damage bonus.\n - INT_VAR `damage_type` to the new damage type.\n - INT_VAR `charges` to the new number of charges.\n - INT_VAR `projectile` to the new projectile.\n - STR_VAR `icon` to the resource reference to be used for matching if `match_icon` is 1, or the new ability icon if `match_icon` is 0."
2177
+ "value": "```weidu-tp2-tooltip\npatch function ALTER_SPELL_HEADER\n```\n\n---\n\nPatch ability headers on spells. This is a PATCH function. All integer variables except `match_icon` and `header` default to -1 and negative values result in no change to the corresponding field. The integer variables `match_icon` and `header` default to 0. The string variable `icon` defaults to the string \"same\", which results in no change to the corresponding field.\n`header_type` is used to limit the scope of matching. The default value of -1 will match all types of headers while values of 0-4 will match headers with those values. If `match_icon` is 1, the `icon` resource reference will be matched with the `icon` variable as an additional qualifier. `header` can also be used to limit patching to the Nth header, counting from 1 as the first header. The default is 0, which will match all headers.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  the type of header to be matched. If this variable is -1, all headers will be a match.|\n|[int](https://ielib.bgforge.net/types#int)|match_icon|= 0|  whether to match the ability icon (0 for no, 1 for yes)|\n|[int](https://ielib.bgforge.net/types#int)|header|= 0|  the number of the ability header (starting from 1) that should be altered. A value of 0 matches all headers.|\n|[int](https://ielib.bgforge.net/types#int)|new_header_type|= -1|  the value the matched header should be changed into|\n|[int](https://ielib.bgforge.net/types#int)|location|= -1|  the new ability location|\n|[int](https://ielib.bgforge.net/types#int)|target|= -1|  the new target|\n|[int](https://ielib.bgforge.net/types#int)|target_count|= -1|  the new target count|\n|[int](https://ielib.bgforge.net/types#int)|range|= -1|  the new range|\n|[int](https://ielib.bgforge.net/types#int)|min_level|= -1|  the new required minimum level|\n|[int](https://ielib.bgforge.net/types#int)|speed|= -1|  the new speed factor|\n|[int](https://ielib.bgforge.net/types#int)|thac0_bonus|= -1|  the new THAC0 bonus|\n|[int](https://ielib.bgforge.net/types#int)|dicesize|= -1|  the new dice size|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber|= -1|  the new number of dice|\n|[int](https://ielib.bgforge.net/types#int)|damage_bonus|= -1|  the new damage bonus|\n|[int](https://ielib.bgforge.net/types#int)|damage_type|= -1|  the new damage type|\n|[int](https://ielib.bgforge.net/types#int)|charges|= -1|  the new number of charges|\n|[int](https://ielib.bgforge.net/types#int)|projectile|= -1|  the new projectile|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|icon|= same|  the resource reference to be used for matching if `match_icon` is 1, or the new ability icon if `match_icon` is 0|"
2178
2178
  }
2179
2179
  },
2180
2180
  "CLONE_EFFECT": {
2181
2181
  "contents": {
2182
2182
  "kind": "markdown",
2183
- "value": "```weidu-tp2-tooltip\npatch function CLONE_EFFECT\n```\nThis is a patch function for creature, item, or spell files that will match an existing effect and create a new one based on the matched effect. Numerous variables are available for matching the specified effect and for specifying new values in the new effect based on the matched effect.\nThe first batch of variables are meta-variables which will help determine the scope of the function:\n- INT_VAR `check_globals` to whether the function should loop through global effects on items (also known as equipping effects) and spells (default is 1). Creature effects are all global effects, so this variable will always be considered to be one when this function is run on a creature.\n- INT_VAR `check_headers` to whether the function should loop through effects on extended headers on items and spells if set to 1 (default is 1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n- INT_VAR `header` to whether the function should target effects on one specific header, counting the first header as zero. A negative value will match all headers (default is -1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n- INT_VAR `header_type` to whether the function should only clone effects on extended headers of the specified type (1 - melee, 2 - ranged, etc.). Negative values will look at effects on all headers (default is -1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n- INT_VAR `multi_match` to the number of effects to clone in the active stack. If you just want to match the first effect and have the function stop, use 1. Otherwise the function will continue matching until the number of cloned effects matches this value. The function will always make at least one change (e.g. 0 or negative values are treated as 1). (default is 999).\n- INT_VAR `verbose` to whether the function should provide some rudimentary information on how many effects were added (default is 0).\n- INT_VAR `silent` to whether the function should suppress warnings when no effects were added. This option also suppresses the verbose option (default is 0).\n- STR_VAR `insert` to the relative position the cloned effect should be inserted at. A value of `below` puts the new, cloned effect immediately below the matched effect. Values of `first` or `last` will put the new effect at the top or bottom of the effect stack, respectively. All other values will default to `above`, where the effect is added immediately before the matched effect (default is `above`).\n\nThe next batch of variables sets the function boundaries on matching an effect to clone. Any variables not specified will not be used to determine a match. The function will only determine an effect is a match only if ALL of the variables specified are matched.\n- INT_VAR `match_opcode` to the opcode of effects to be matched (default -1).\n- INT_VAR `match_target` to the target of effects to be matched (default -1).\n- INT_VAR `match_power` to the power of effects to be matched (default -1).\n- INT_VAR `match_parameter1` to parameter1 of effects to be matched (default -1).\n- INT_VAR `match_parameter2` to parameter2 of effects to be matched (default -1).\n- INT_VAR `match_timing` to the timing of effects to be matched (default -1).\n- INT_VAR `match_resist_dispel` to the resist/dispel setting of effects to be matched (default -1).\n- INT_VAR `match_duration` to the duration of effects to be matched (default -1).\n- INT_VAR `match_probability1` to probability1 (the upper bound) of effects to be matched (default -1).\n- INT_VAR `match_probability2` to probability2 (the lower bound) of effects to be matched (default -1).\n- INT_VAR `match_dicenumber` to the number of dice of effects to be matched (default -1). This field is instead used for maximum hit-dice (HD) by some opcodes.\n- INT_VAR `match_dicesize` to the size of dice of effects to be matched (default -1). This field is used instead for minimum hit-dice (HD) by some opcodes.\n- INT_VAR `match_savingthrow` to the saving throw type of effects to be matched (default -1).\n- INT_VAR `match_savebonus` to the saving throw bonus of effects to be matched (default -11). Since saving throws can range into negative values, this variable can match all the way down to -10.\n- INT_VAR `match_special` to the special field of effects to be matched (default -1). The special field is used by some EE effects.\n- STR_VAR `match_resource` to the resource of effects to be matched (default \\\"SAME\\\").\nOnce a matching effect is found, a new effect is created (STR_VAR `insert` determines its placement) with all of the same specifications as the matched effect. The next series of variables allows the function to change the fields to new values in the newly-created effect. Any variables not set in this batch will simply inherit their values from the matched effect.\n- INT_VAR `opcode` to the value the of the new effect's opcode.\n- INT_VAR `target` to the new effect's target.\n- INT_VAR `power` to the new effect's power.\n- INT_VAR `parameter1` to the new effect's parameter1.\n- INT_VAR `parameter2` to the new effect's parameter2.\n- INT_VAR `timing` to the new effect's timing mode.\n- INT_VAR `resist_dispel` to the new effect's resist/dispel setting.\n- INT_VAR `duration` to the new effect's duration.\n- INT_VAR `probability1` to the new effect's probability1 (the upper bound).\n- INT_VAR `probability2` to the new effect's probability2 (the lower bound).\n- INT_VAR `dicenumber` to the new effect's number of dice. This field is instead used for maximum hit-dice (HD) by some opcodes.\n- INT_VAR `dicesize` to the new effect's size of dice. This field is also instead for minimum hit-dice (HD) by some opcodes.\n- INT_VAR `savingthrow` to the new effect's saving-throw type.\n- INT_VAR `savebonus` to the new effect's saving-throw bonus/penalty. This variable can take negative values down to -10 while still writing to the corresponding field.\n- INT_VAR `special` to the new effect's special field. The special field is used by many EE effects.\n- STR_VAR `resource` to the new effect's resource reference.\n"
2183
+ "value": "```weidu-tp2-tooltip\npatch function CLONE_EFFECT\n```\n\n---\n\nMatches an existing effect on a creature, item, or spell file and creates a new one based on it. All unset match variables are ignored; all unset new-effect variables inherit from the matched effect.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|check_globals|= 1|  loop through global/equipping effects on items and spells (always 1 for creatures)|\n|[int](https://ielib.bgforge.net/types#int)|check_headers|= 1|  loop through extended header effects on items and spells (ignored for creatures)|\n|[int](https://ielib.bgforge.net/types#int)|header|= -1|  target a specific header (0-based); -1 matches all (ignored for creatures)|\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  restrict to extended headers of this type (1=melee, 2=ranged, etc.); -1 matches all|\n|[int](https://ielib.bgforge.net/types#int)|multi_match|= 999|  max number of effects to clone; 0 or negative treated as 1|\n|[int](https://ielib.bgforge.net/types#int)|verbose|= 0|  print info on how many effects were added|\n|[int](https://ielib.bgforge.net/types#int)|silent|= 0|  suppress warnings and verbose output|\n|[int](https://ielib.bgforge.net/types#int)|match_opcode|= -1|  opcode to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_target|= -1|  target to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_power|= -1|  power to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_parameter1|= -1|  parameter1 to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_parameter2|= -1|  parameter2 to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_timing|= -1|  timing to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_resist_dispel|= -1|  resist/dispel to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_duration|= -1|  duration to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_probability1|= -1|  probability1 upper bound to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_probability2|= -1|  probability2 lower bound to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_dicenumber|= -1|  dice number to match (or max HD for some opcodes); -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_dicesize|= -1|  dice size to match (or min HD for some opcodes); -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_savingthrow|= -1|  saving throw type to match; -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_savebonus|= -11|  saving throw bonus to match (down to -10); -11 = any|\n|[int](https://ielib.bgforge.net/types#int)|match_special|= -1|  special field to match (EE effects); -1 = any|\n|[int](https://ielib.bgforge.net/types#int)|opcode||  new effect's opcode (inherits from matched if unset)|\n|[int](https://ielib.bgforge.net/types#int)|target||  new effect's target|\n|[int](https://ielib.bgforge.net/types#int)|power||  new effect's power|\n|[int](https://ielib.bgforge.net/types#int)|parameter1||  new effect's parameter1|\n|[int](https://ielib.bgforge.net/types#int)|parameter2||  new effect's parameter2|\n|[int](https://ielib.bgforge.net/types#int)|timing||  new effect's timing mode|\n|[int](https://ielib.bgforge.net/types#int)|resist_dispel||  new effect's resist/dispel setting|\n|[int](https://ielib.bgforge.net/types#int)|duration||  new effect's duration|\n|[int](https://ielib.bgforge.net/types#int)|probability1||  new effect's probability1 upper bound|\n|[int](https://ielib.bgforge.net/types#int)|probability2||  new effect's probability2 lower bound|\n|[int](https://ielib.bgforge.net/types#int)|dicenumber||  new effect's dice number (or max HD for some opcodes)|\n|[int](https://ielib.bgforge.net/types#int)|dicesize||  new effect's dice size (or min HD for some opcodes)|\n|[int](https://ielib.bgforge.net/types#int)|savingthrow||  new effect's saving throw type|\n|[int](https://ielib.bgforge.net/types#int)|savebonus||  new effect's saving throw bonus/penalty (down to -10)|\n|[int](https://ielib.bgforge.net/types#int)|special||  new effect's special field (EE effects)|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|insert|= above|  placement of cloned effect relative to matched; above, below, first, or last|\n|[resref](https://ielib.bgforge.net/types#resref)|match_resource|= SAME|  resource to match|\n|[resref](https://ielib.bgforge.net/types#resref)|resource||  new effect's resource reference (inherits from matched if unset)|"
2184
2184
  }
2185
2185
  },
2186
2186
  "DELETE_AREA_ITEM": {
2187
2187
  "contents": {
2188
2188
  "kind": "markdown",
2189
- "value": "```weidu-tp2-tooltip\npatch function DELETE_AREA_ITEM\n```\nDeletes all matching items from an area. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `item_to_delete` to the item you want to delete."
2189
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_AREA_ITEM\n```\n\n---\n\nDeletes all matching items from an area. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_to_delete||  the item you want to delete|"
2190
2190
  }
2191
2191
  },
2192
2192
  "DELETE_CRE_EFFECT": {
2193
2193
  "contents": {
2194
2194
  "kind": "markdown",
2195
- "value": "```weidu-tp2-tooltip\npatch function DELETE_CRE_EFFECT\n```\nDeletes all effects with specified opcode from a creature. (Warning\":\" doesn't check EFF version) This is a PATCH macro and function.\n - SET `opcode_to_delete` to the opcode of the effect you want to delete. Opcode of (-1) will match all effects."
2195
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_CRE_EFFECT\n```\n\n---\n\nDeletes all effects with specified opcode from a creature. (Warning: doesn't check EFF version) This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode_to_delete||  the opcode of the effect you want to delete. Opcode of (-1) will match all effects.|"
2196
2196
  }
2197
2197
  },
2198
2198
  "DELETE_CRE_ITEM": {
2199
2199
  "contents": {
2200
2200
  "kind": "markdown",
2201
- "value": "```weidu-tp2-tooltip\npatch function DELETE_CRE_ITEM\n```\nDeletes all matching items from a creature. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `item_to_delete` to the item you want to delete."
2201
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_CRE_ITEM\n```\n\n---\n\nDeletes all matching items from a creature. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_to_delete||  the item you want to delete|"
2202
2202
  }
2203
2203
  },
2204
2204
  "DELETE_EFFECT": {
2205
2205
  "contents": {
2206
2206
  "kind": "markdown",
2207
- "value": "```weidu-tp2-tooltip\npatch function DELETE_EFFECT\n```\nThis is a patch function for creature, item, or spell files that will match an existing effect and then delete it. Numerous variables are available for matching the specified effect.\n The first batch of variables are meta-variables which will help determine the scope of the function\":\"\n - INT_VAR `check_globals` to whether the function should loop through global effects on items (also known as equipping effects) and spells (default is 1). Creature effects are all global effects, so this variable will always be considered to be one when this function is run on a creature.\n - INT_VAR `check_headers` to whether the function should loop through effects on extended headers on items and spells (default is 1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n - INT_VAR `header` to whether the function should target effects on one specific header, counting the first header as zero. A negative value will match all headers (default is -1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n - INT_VAR `header_type` to whether the function should only delete effects on extended headers of the specified type (1 - melee, 2 - ranged, etc.). Negative values will look at effects on all headers (default is -1). Creatures have no extended headers, so this variable is ignored when used on creatures.\n - INT_VAR `multi_match` to the number of effects to delete in the active stack. If you just want to match the first effect and have the function stop, use 1. Otherwise the function will continue matching until the number of deleted effects matches this value. The function will always make at least one change (e.g. 0 or negative values are treated as 1). (default is 999).\n - INT_VAR `verbose` to whether the function should provide some rudimentary information on how many effects were deleted (default is 0).\n The next batch of variables sets the function boundaries on matching an effect to delete. Any variables not specified will not be used to determine a match. The function will only determine an effect is a match only if ALL of the variables specified are matched.\n - INT_VAR `match_opcode` to the opcode of effects to be matched (default -1).\n - INT_VAR `match_target` to the target of effects to be matched (default -1).\n - INT_VAR `match_power` to the power of effects to be matched (default -1).\n - INT_VAR `match_parameter1` to parameter1 of effects to be matched (default -1).\n - INT_VAR `match_parameter2` to parameter2 of effects to be matched (default -1).\n - INT_VAR `match_timing` to the timing of effects to be matched (default -1).\n - INT_VAR `match_resist_dispel` to the resist/dispel setting of effects to be matched (default -1).\n - INT_VAR `match_duration` to the duration of effects to be matched (default -1).\n - INT_VAR `match_probability1` to probability1 (the upper bound) of effects to be matched (default -1).\n - INT_VAR `match_probability2` to probability2 (the lower bound) of effects to be matched (default -1).\n - INT_VAR `match_dicenumber` to the number of dice of effects to be matched (default -1). This field is instead used for maximum hit-dice (HD) by some opcodes.\n - INT_VAR `match_dicesize` to the size of dice of effects to be matched (default -1). This field is used instead for minimum hit-dice (HD) by some opcodes.\n - INT_VAR `match_savingthrow` to the saving throw type of effects to be matched (default -1).\n - INT_VAR `match_savebonus` to the saving throw bonus effects to be matched (default -11). Since saving throws can range into negative values, this variable can match all the way down to -10.\n - INT_VAR `match_special` to the special field of effects to be matched (default -1). The special field is used by some EE effects.\n - STR_VAR `match_resource` to the resource of effects to be matched (default \"SAME\").\n Once a matching effect is found it is deleted. The function will continue to delete effects from the stack until the number of effects deleted matches the `multi_match` variable."
2207
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_EFFECT\n```\n\n---\n\nThis is a patch function for creature, item, or spell files that will match an existing effect and then delete it. Numerous variables are available for matching the specified effect. Meta-variables determine the scope; match variables determine which effects are matched (all must match). Once a matching effect is found it is deleted. The function will continue to delete effects from the stack until the number of effects deleted matches the `multi_match` variable.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|check_globals|= 1|  whether the function should loop through global effects on items (equipping effects) and spells. Creature effects are all global, so this is always treated as 1 on creatures.|\n|[int](https://ielib.bgforge.net/types#int)|check_headers|= 1|  whether the function should loop through effects on extended headers on items and spells. Ignored for creatures.|\n|[int](https://ielib.bgforge.net/types#int)|header|= -1|  whether the function should target effects on one specific header, counting the first header as zero. A negative value will match all headers. Ignored for creatures.|\n|[int](https://ielib.bgforge.net/types#int)|header_type|= -1|  whether the function should only delete effects on extended headers of the specified type (1=melee, 2=ranged, etc.). Negative values match all headers. Ignored for creatures.|\n|[int](https://ielib.bgforge.net/types#int)|multi_match|= 999|  the number of effects to delete in the active stack. The function will always make at least one change (0 or negative values are treated as 1).|\n|[int](https://ielib.bgforge.net/types#int)|verbose|= 0|  whether the function should provide some rudimentary information on how many effects were deleted|\n|[int](https://ielib.bgforge.net/types#int)|match_opcode|= -1|  the opcode of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_target|= -1|  the target of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_power|= -1|  the power of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_parameter1|= -1|  parameter1 of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_parameter2|= -1|  parameter2 of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_timing|= -1|  the timing of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_resist_dispel|= -1|  the resist/dispel setting of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_duration|= -1|  the duration of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_probability1|= -1|  probability1 (the upper bound) of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_probability2|= -1|  probability2 (the lower bound) of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_dicenumber|= -1|  the number of dice of effects to be matched. This field is instead used for maximum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|match_dicesize|= -1|  the size of dice of effects to be matched. This field is used instead for minimum hit-dice (HD) by some opcodes.|\n|[int](https://ielib.bgforge.net/types#int)|match_savingthrow|= -1|  the saving throw type of effects to be matched|\n|[int](https://ielib.bgforge.net/types#int)|match_savebonus|= -11|  the saving throw bonus of effects to be matched. Since saving throws can range into negative values, this variable can match all the way down to -10.|\n|[int](https://ielib.bgforge.net/types#int)|match_special|= -1|  the special field of effects to be matched. The special field is used by some EE effects.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|match_resource|= SAME|  the resource of effects to be matched|"
2208
2208
  }
2209
2209
  },
2210
2210
  "DELETE_ITEM_EFFECT": {
2211
2211
  "contents": {
2212
2212
  "kind": "markdown",
2213
- "value": "```weidu-tp2-tooltip\npatch function DELETE_ITEM_EFFECT\n```\nDeletes all extended effects with specified opcode from an item. This is a PATCH macro and function.\n - SET `opcode_to_delete` to the opcode of the effect you want to delete. Opcode of (-1) will match all effects."
2213
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_ITEM_EFFECT\n```\n\n---\n\nDeletes all extended effects with specified opcode from an item. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode_to_delete||  the opcode of the effect you want to delete. Opcode of (-1) will match all effects.|"
2214
2214
  }
2215
2215
  },
2216
2216
  "DELETE_ITEM_EQEFFECT": {
2217
2217
  "contents": {
2218
2218
  "kind": "markdown",
2219
- "value": "```weidu-tp2-tooltip\npatch function DELETE_ITEM_EQEFFECT\n```\nDeletes all equipping effects with specified opcode from an item. This is a PATCH macro and function.\n - SET `opcode_to_delete` to the opcode of the effect you want to delete. Opcode of (-1) will match all effects."
2219
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_ITEM_EQEFFECT\n```\n\n---\n\nDeletes all equipping effects with specified opcode from an item. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode_to_delete||  the opcode of the effect you want to delete. Opcode of (-1) will match all effects.|"
2220
2220
  }
2221
2221
  },
2222
2222
  "DELETE_ITEM_HEADER": {
2223
2223
  "contents": {
2224
2224
  "kind": "markdown",
2225
- "value": "```weidu-tp2-tooltip\npatch function DELETE_ITEM_HEADER\n```\nDelete ability headers, also known as extended headers, from items. This is a PATCH function. All integer variables default to 0.\n This function will delete one or more ability headers, along with all of their associated effects, and properly re-index the file.\n - INT_VAR `header_type` to the header type to delete. If this variable is -1, all header types will be a match. (default 0)"
2225
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_ITEM_HEADER\n```\n\n---\n\nDelete ability headers, also known as extended headers, from items. This is a PATCH function. All integer variables default to 0.\nThis function will delete one or more ability headers, along with all of their associated effects, and properly re-index the file.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|header_type|= 0|  the header type to delete. If this variable is -1, all header types will be a match.|"
2226
2226
  }
2227
2227
  },
2228
2228
  "DELETE_SPELL_EFFECT": {
2229
2229
  "contents": {
2230
2230
  "kind": "markdown",
2231
- "value": "```weidu-tp2-tooltip\npatch function DELETE_SPELL_EFFECT\n```\nDeletes all extended effects with specified opcode from a spell. This is a PATCH macro and function.\n - SET `opcode_to_delete` to the opcode of the effect you want to delete. Opcode of (-1) will match all effects."
2231
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_SPELL_EFFECT\n```\n\n---\n\nDeletes all extended effects with specified opcode from a spell. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|opcode_to_delete||  the opcode of the effect you want to delete. Opcode of (-1) will match all effects.|"
2232
2232
  }
2233
2233
  },
2234
2234
  "DELETE_SPELL_HEADER": {
2235
2235
  "contents": {
2236
2236
  "kind": "markdown",
2237
- "value": "```weidu-tp2-tooltip\npatch function DELETE_SPELL_HEADER\n```\nDelete ability headers, also known as extended headers, from spells. This is a PATCH function. The integer variable `header_type` defaults to 0. The integer variable `min_level` defaults to -1 and if this variable is 0 or greater, only headers with a matching minimum level will be deleted.\n This function will delete one or more ability headers, along with all of their associated effects, and properly re-index the file.\n - INT_VAR `header_type` to the header type to delete. If this variable is -1, all header types will be a match. (default 0)\n - INT_VAR `min_level` to the minimum level to be matched. If this variable is negative, it will not be used for matching. (default -1)"
2237
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_SPELL_HEADER\n```\n\n---\n\nDelete ability headers, also known as extended headers, from spells. This is a PATCH function. The integer variable `header_type` defaults to 0. The integer variable `min_level` defaults to -1 and if this variable is 0 or greater, only headers with a matching minimum level will be deleted.\nThis function will delete one or more ability headers, along with all of their associated effects, and properly re-index the file.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|header_type|= 0|  the header type to delete. If this variable is -1, all header types will be a match.|\n|[int](https://ielib.bgforge.net/types#int)|min_level|= -1|  the minimum level to be matched. If this variable is negative, it will not be used for matching.|"
2238
2238
  }
2239
2239
  },
2240
2240
  "DELETE_STORE_ITEM": {
2241
2241
  "contents": {
2242
2242
  "kind": "markdown",
2243
- "value": "```weidu-tp2-tooltip\npatch function DELETE_STORE_ITEM\n```\nDeletes all matching items from a store. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `item_to_delete` to the item you want to delete."
2243
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_STORE_ITEM\n```\n\n---\n\nDeletes all matching items from a store. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_to_delete||  the item you want to delete|"
2244
2244
  }
2245
2245
  },
2246
2246
  "DELETE_WORLDMAP_LINKS": {
2247
2247
  "contents": {
2248
2248
  "kind": "markdown",
2249
- "value": "```weidu-tp2-tooltip\npatch function DELETE_WORLDMAP_LINKS\n```\nDelete all links from one worldmap area to another. This is a PATCH function.\n This function will delete links from one specified area to another. Links can be deleted from all four directional nodes (north, east, south, west) or from a specific node. Links connecting the areas in the opposite direction will not be deleted.\n - STR_VAR `from_area` to the area from which the links that are to be deleted originate.\n - STR_VAR `from_node` to the directional node from which the links that are to be deleted originate. Legal values for this variable are \"north\", \"n\", \"east\", \"e\", \"south\", \"s\", \"west\", \"w\". Values are not case sensitive. Links are deleted from all four nodes by default.\n - STR_VAR `to_area` to the area to which the links that are to be deleted lead."
2249
+ "value": "```weidu-tp2-tooltip\npatch function DELETE_WORLDMAP_LINKS\n```\n\n---\n\nDelete all links from one worldmap area to another. This is a PATCH function.\nThis function will delete links from one specified area to another. Links can be deleted from all four directional nodes (north, east, south, west) or from a specific node. Links connecting the areas in the opposite direction will not be deleted.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|from_area||  the area from which the links that are to be deleted originate|\n|[string](https://ielib.bgforge.net/types#string)|from_node||  the directional node from which the links that are to be deleted originate. Legal values are \"north\", \"n\", \"east\", \"e\", \"south\", \"s\", \"west\", \"w\". Values are not case sensitive. Links are deleted from all four nodes by default.|\n|[resref](https://ielib.bgforge.net/types#resref)|to_area||  the area to which the links that are to be deleted lead|"
2250
2250
  }
2251
2251
  },
2252
2252
  "FJ_CRE_EFF_V2": {
2253
2253
  "contents": {
2254
2254
  "kind": "markdown",
2255
- "value": "```weidu-tp2-tooltip\npatch function FJ_CRE_EFF_V2\n```\nConverts creatures using version 1 effects to version 2. Called by FJ_CRE_VALIDITY or FJ_CRE_REINDEX automatically if relevant.\n This is a PATCH function."
2255
+ "value": "```weidu-tp2-tooltip\npatch function FJ_CRE_EFF_V2\n```\n\n---\n\nConverts creatures using version 1 effects to version 2. Called by FJ_CRE_VALIDITY or FJ_CRE_REINDEX automatically if relevant.\n This is a PATCH function."
2256
2256
  }
2257
2257
  },
2258
2258
  "FJ_CRE_REINDEX": {
2259
2259
  "contents": {
2260
2260
  "kind": "markdown",
2261
- "value": "```weidu-tp2-tooltip\npatch function FJ_CRE_REINDEX\n```\nReorders creatures with nonstandard offset orders. Called by FJ_CRE_VALIDITY automatically if relevant.\n This is a PATCH function.\n - INT_VAR `do_reindex` to 0 if you don't want the creature file to be reindexed. Defaults to 1.\n - INT_VAR `do_eff` to 0 if you don't want EFFv1 <-> EFFv2 conversion to be applied. Defaults to 1."
2261
+ "value": "```weidu-tp2-tooltip\npatch function FJ_CRE_REINDEX\n```\n\n---\n\nReorders creatures with nonstandard offset orders. Called by FJ_CRE_VALIDITY automatically if relevant. This is a PATCH function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|do_reindex|=&nbsp;1|&nbsp;&nbsp;set to 0 if you don't want the creature file to be reindexed|\n|[int](https://ielib.bgforge.net/types#int)|do_eff|=&nbsp;1|&nbsp;&nbsp;set to 0 if you don't want EFFv1 <-> EFFv2 conversion to be applied|"
2262
2262
  }
2263
2263
  },
2264
2264
  "FJ_CRE_VALIDITY": {
2265
2265
  "contents": {
2266
2266
  "kind": "markdown",
2267
- "value": "```weidu-tp2-tooltip\npatch function FJ_CRE_VALIDITY\n```\nChecks whether a CRE file is well-formed or not, fixes some common bugs, and reports whether the CRE file is still broken or not. In particular\\\":\\\"\n\n- reports invalidity if it is charbase.cre, shorter than the minimum size, the signature mismatches, or a sub-structure has members and its offset is in the header.\n- if a empty sub-structure's offset is in the header, point them to the end of the header.\n- if the cre is valid, force it to use proper order (known spells, spell memorization info, memorized spells, effects, items, item slot).\n- forces the CRE file to use EFF V2 effects internally (or EFF V1 if on BG1).\n\nThis is a PATCH function.\n\n- INT_VAR `do_message` to 1 if you want explicit an explicit message regarding the cre invalidity. Defaults to 0.\n- INT_VAR `do_reindex` to 0 if you don't want the creature file to be reindexed. Defaults to 1.\n- INT_VAR `do_eff` to 0 if you don't want EFFv1 <-> EFFv2 conversion to be applied. Defaults to 1.\n- RET `valid` returns 1 if the CRE is well-formed, 0 otherwise.\n"
2267
+ "value": "```weidu-tp2-tooltip\npatch function FJ_CRE_VALIDITY\n```\n\n---\n\nChecks whether a CRE file is well-formed or not, fixes some common bugs, and reports whether the CRE file is still broken or not. In particular: reports invalidity if it is charbase.cre, shorter than the minimum size, the signature mismatches, or a sub-structure has members and its offset is in the header; if an empty sub-structure's offset is in the header, point them to the end of the header; if the cre is valid, force it to use proper order (known spells, spell memorization info, memorized spells, effects, items, item slot); forces the CRE file to use EFF V2 effects internally (or EFF V1 if on BG1). This is a PATCH function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|do_message|=&nbsp;0|&nbsp;&nbsp;set to 1 if you want an explicit message regarding the cre invalidity|\n|[int](https://ielib.bgforge.net/types#int)|do_reindex|=&nbsp;1|&nbsp;&nbsp;set to 0 if you don't want the creature file to be reindexed|\n|[int](https://ielib.bgforge.net/types#int)|do_eff|=&nbsp;1|&nbsp;&nbsp;set to 0 if you don't want EFFv1 <-> EFFv2 conversion to be applied|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|valid||&nbsp;&nbsp;returns 1 if the CRE is well-formed, 0 otherwise|"
2268
2268
  }
2269
2269
  },
2270
2270
  "FL#FJ_CRE_REINDEX": {
@@ -2282,49 +2282,49 @@
2282
2282
  "ITEM_EFFECT_TO_SPELL": {
2283
2283
  "contents": {
2284
2284
  "kind": "markdown",
2285
- "value": "```weidu-tp2-tooltip\npatch function ITEM_EFFECT_TO_SPELL\n```\nCopies all extended effects from the current item to the first extended header of a spell. This is a PATCH macro and function.\n - SET `type` to the header type to copy the effect from (use 99 to specify 'all types').\n - SET `header` to number of extended header the effect should be copied from (use 99 to specify 'every header').\n - SET `insert_point` to the index into the spell file at which the effects should be inserted. A value of 0 will have the effects inserted as the first effects of the spell. Effects are inserted as the last effects by default.\n - SPRINT `new_itm_spl` to a spell you want to copy effects to."
2285
+ "value": "```weidu-tp2-tooltip\npatch function ITEM_EFFECT_TO_SPELL\n```\n\n---\n\nCopies all extended effects from the current item to the first extended header of a spell. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|type||&nbsp;&nbsp;the header type to copy the effect from (use 99 to specify 'all types')|\n|[int](https://ielib.bgforge.net/types#int)|header||&nbsp;&nbsp;number of extended header the effect should be copied from (use 99 to specify 'every header')|\n|[int](https://ielib.bgforge.net/types#int)|insert_point||&nbsp;&nbsp;the index into the spell file at which the effects should be inserted. A value of 0 will have the effects inserted as the first effects of the spell. Effects are inserted as the last effects by default.|\n|**STR**|**vars**|||\n|[resref](https://ielib.bgforge.net/types#resref)|new_itm_spl||&nbsp;&nbsp;a spell you want to copy effects to|"
2286
2286
  }
2287
2287
  },
2288
2288
  "REMOVE_CRE_ITEM_FLAGS": {
2289
2289
  "contents": {
2290
2290
  "kind": "markdown",
2291
- "value": "```weidu-tp2-tooltip\npatch function REMOVE_CRE_ITEM_FLAGS\n```\nRemoves flags from all matching items possessed by a creature. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `item_to_change` to the item the flags should be removed from\n - SPRINT `flags` to flags you need to remove (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)."
2291
+ "value": "```weidu-tp2-tooltip\npatch function REMOVE_CRE_ITEM_FLAGS\n```\n\n---\n\nRemoves flags from all matching items possessed by a creature. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_to_change||&nbsp;&nbsp;the item the flags should be removed from|\n|[string](https://ielib.bgforge.net/types#string)|flags||&nbsp;&nbsp;flags you need to remove (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)|"
2292
2292
  }
2293
2293
  },
2294
2294
  "REPLACE_AREA_ITEM": {
2295
2295
  "contents": {
2296
2296
  "kind": "markdown",
2297
- "value": "```weidu-tp2-tooltip\npatch function REPLACE_AREA_ITEM\n```\nReplaces all matching items in an area with another item. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `old_item` to the item you want to be replaced\n - SPRINT `new_item` to the new item\n - SPRINT `flags` to flags the new item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc). Default - no flags.\n - SET `charges1` to amount in stock/number of charges of first magical ability (default 0)\n - SET `charges2` to number of charges of second magical ability (default 0)\n - SET `charges3` to number of charges of third magical ability (default 0)"
2297
+ "value": "```weidu-tp2-tooltip\npatch function REPLACE_AREA_ITEM\n```\n\n---\n\nReplaces all matching items in an area with another item. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|charges1|=&nbsp;0|&nbsp;&nbsp;amount in stock/number of charges of first magical ability|\n|[int](https://ielib.bgforge.net/types#int)|charges2|=&nbsp;0|&nbsp;&nbsp;number of charges of second magical ability|\n|[int](https://ielib.bgforge.net/types#int)|charges3|=&nbsp;0|&nbsp;&nbsp;number of charges of third magical ability|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|old_item||&nbsp;&nbsp;the item you want to be replaced|\n|[resref](https://ielib.bgforge.net/types#resref)|new_item||&nbsp;&nbsp;the new item|\n|[string](https://ielib.bgforge.net/types#string)|flags|=&nbsp;|&nbsp;&nbsp;flags the new item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc). Default - no flags.|"
2298
2298
  }
2299
2299
  },
2300
2300
  "REPLACE_STORE_ITEM": {
2301
2301
  "contents": {
2302
2302
  "kind": "markdown",
2303
- "value": "```weidu-tp2-tooltip\npatch function REPLACE_STORE_ITEM\n```\nReplaces all matching items in a store with another item. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `old_item` to the item you want to be replaced\n - SPRINT `new_item` to the new item\n - SET `number_in_stock` to number of new items in stock (default 0)\n - SPRINT `flags` to flags new item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc). Default - no flags.\n - SET `charges1` to number of charges of first magical ability (default 0)\n - SET `charges2` to number of charges of second magical ability (default 0)\n - SET `charges3` to number of charges of third magical ability (default 0)"
2303
+ "value": "```weidu-tp2-tooltip\npatch function REPLACE_STORE_ITEM\n```\n\n---\n\nReplaces all matching items in a store with another item. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|number_in_stock|=&nbsp;0|&nbsp;&nbsp;number of new items in stock|\n|[int](https://ielib.bgforge.net/types#int)|charges1|=&nbsp;0|&nbsp;&nbsp;number of charges of first magical ability|\n|[int](https://ielib.bgforge.net/types#int)|charges2|=&nbsp;0|&nbsp;&nbsp;number of charges of second magical ability|\n|[int](https://ielib.bgforge.net/types#int)|charges3|=&nbsp;0|&nbsp;&nbsp;number of charges of third magical ability|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|old_item||&nbsp;&nbsp;the item you want to be replaced|\n|[resref](https://ielib.bgforge.net/types#resref)|new_item||&nbsp;&nbsp;the new item|\n|[string](https://ielib.bgforge.net/types#string)|flags|=&nbsp;|&nbsp;&nbsp;flags new item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc). Default - no flags.|"
2304
2304
  }
2305
2305
  },
2306
2306
  "SET_CRE_ITEM_FLAGS": {
2307
2307
  "contents": {
2308
2308
  "kind": "markdown",
2309
- "value": "```weidu-tp2-tooltip\npatch function SET_CRE_ITEM_FLAGS\n```\nSet flags to all matching items possessed by a creature. Regexp allowed. This is a PATCH macro and function.\n - SPRINT `item_to_change` to the item which flags should be set\n - SPRINT `flags` to flags you need to set (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)."
2309
+ "value": "```weidu-tp2-tooltip\npatch function SET_CRE_ITEM_FLAGS\n```\n\n---\n\nSet flags to all matching items possessed by a creature. Regexp allowed. This is a PATCH macro and function.\n\n| | | | |\n|-:|:-|:-|:-|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|item_to_change||&nbsp;&nbsp;the item which flags should be set|\n|[string](https://ielib.bgforge.net/types#string)|flags||&nbsp;&nbsp;flags you need to set (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc)|"
2310
2310
  }
2311
2311
  },
2312
2312
  "T-CRE_EFF_V1": {
2313
2313
  "contents": {
2314
2314
  "kind": "markdown",
2315
- "value": "```weidu-tp2-tooltip\npatch function T-CRE_EFF_V1\n```\nConverts creatures using version 2 effects to version 1. Called by FJ_CRE_VALIDITY or FJ_CRE_REINDEX automatically if relevant.\n This is a PATCH function."
2315
+ "value": "```weidu-tp2-tooltip\npatch function T-CRE_EFF_V1\n```\n\n---\n\nConverts creatures using version 2 effects to version 1. Called by FJ_CRE_VALIDITY or FJ_CRE_REINDEX automatically if relevant. This is a PATCH function."
2316
2316
  }
2317
2317
  },
2318
2318
  "UPDATE_PVRZ_INDICES": {
2319
2319
  "contents": {
2320
2320
  "kind": "markdown",
2321
- "value": "```weidu-tp2-tooltip\npatch function UPDATE_PVRZ_INDICES\n```\nUpdate the PVRZ references in a BAM V2 or MOS V2 resource. This is a PATCH function.\n This function will update the PVRZ references in a BAM V2 or MOS V2 resource with the next contiguous block of free PVRZ indices. This function is intended to be used in combination with the action function INSTALL_PVRZ.\n - INT_VAR `target_base_index` is an optional parameter. When specified, the function attempts to use a block of free PVRZ indices starting at the specified value. The default value is 1000.\n - RET `original_base_index` returns the lowest PVRZ index used by the source BAM or MOS. Returns -1 on error.\n - RET `new_base_index` returns the lowest PVRZ index used by the target BAM or MOS. Returns -1 on error.\n - RET `index_range` returns the range of reserved PVRZ indices, i.e., the difference between the smallest and biggest PVRZ index, inclusive. Returns 0 on error."
2321
+ "value": "```weidu-tp2-tooltip\npatch function UPDATE_PVRZ_INDICES\n```\n\n---\n\nUpdate the PVRZ references in a BAM V2 or MOS V2 resource. This is a PATCH function.\nThis function will update the PVRZ references in a BAM V2 or MOS V2 resource with the next contiguous block of free PVRZ indices. This function is intended to be used in combination with the action function INSTALL_PVRZ.\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|target_base_index|=&nbsp;1000|&nbsp;&nbsp;when specified, the function attempts to use a block of free PVRZ indices starting at the specified value|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|original_base_index||&nbsp;&nbsp;the lowest PVRZ index used by the source BAM or MOS. Returns -1 on error.|\n|[int](https://ielib.bgforge.net/types#int)|new_base_index||&nbsp;&nbsp;the lowest PVRZ index used by the target BAM or MOS. Returns -1 on error.|\n|[int](https://ielib.bgforge.net/types#int)|index_range||&nbsp;&nbsp;the range of reserved PVRZ indices, i.e., the difference between the smallest and biggest PVRZ index, inclusive. Returns 0 on error.|"
2322
2322
  }
2323
2323
  },
2324
2324
  "fj_are_structure": {
2325
2325
  "contents": {
2326
2326
  "kind": "markdown",
2327
- "value": "```weidu-tp2-tooltip\npatch function fj_are_structure\n```\nAdds a structure to an area file. All variables are zero or blank by default unless otherwise indicated. Fields designated by an asterisk are typically required; all others are optional. This is a PATCH function.\nUniversal structure variables\\\":\\\"\n\n- STR_VAR `fj_structure_type` to the type of area structure to be added (actor, region, spawn, entrance, container, itm, ambient, variable, door, animation, explored bitmask, songlist, rest interrupt table, note or projectile)^*^;\n- INT_VAR `fj_delete_mode` to the index of the structure to be deleted (if deleting rather than adding a new structure);\n- INT_VAR `fj_debug` to 1 to enable feedback;\n- RET `fj_return_offset` returns the position of the structure in the area file;\n\n Actor structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the actor's name^*^;\n- INT_VAR `fj_loc_x` to the starting X (horizontal) coordinate^*^;\n- INT_VAR `fj_loc_y` to the starting Y (vertical) coordinate^*^;\n- INT_VAR `fj_dest_x` to the destination X coordinate (by default the same as `fj_loc_x`);\n- INT_VAR `fj_dest_y` to the destination Y coordinate (by default the same as `fj_loc_y`);\n- INT_VAR `fj_loading` to whether the .cre file is loaded (0=attached, 1=loaded, default 1);\n- INT_VAR `fj_spawned` to whether the creature has been spawned (0=no, 1=yes, default 0);\n- INT_VAR `fj_animation` to the actor's animation number (from animate.ids, though the engine uses the animation set on the .cre file);\n- INT_VAR `fj_orientation` to the facing direction (0-15 where 0=south, 4=west, 8=north, 12=east, default 0);\n- INT_VAR `fj_expiry` to the actor removal timer in absolute ticks (default -1 to avoid removal);\n- INT_VAR `fj_wander_dist_actor` to the actor's random walk distance limit;\n- INT_VAR `fj_mvmt_dist_actor` to the actor's movement distance limit;\n- INT_VAR `fj_schedule` to the hourly appearance schedule (bits 0-23, default -1 or always);\n- INT_VAR `fj_num_talked` to the NumTimesTalkedTo (in .sav files);\n- STR_VAR `fj_dlg_resref` to the actor's dialogue file (normally obtained from .cre files);\n- STR_VAR `fj_bcs_override` to the actor's override script (normally obtained from .cre files);\n- STR_VAR `fj_bcs_general` to the actor's general script (normally obtained from .cre files);\n- STR_VAR `fj_bcs_class` to the actor's class script (normally obtained from .cre files);\n- STR_VAR `fj_bcs_race` to the actor's race script (normally obtained from .cre files);\n- STR_VAR `fj_bcs_default` to the actor's default script (normally obtained from .cre files);\n- STR_VAR `fj_cre_resref` to the actor's resource reference (creature filename)^*^;\n- STR_VAR `fj_cre_embedded` to path/to/file.cre if embedding a new creature (defaults to `fj_cre_resref` if not set);\n\nRegion structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the region's name^*^;\n- INT_VAR `fj_type` to the region type (0=trap, 1=info, 2=travel)^*^;\n- INT_VAR `fj_box_left` to the leftmost X coordinate of the region's bounding box^*^;\n- INT_VAR `fj_box_top` to the topmost Y coordinate of the region's bounding box^*^;\n- INT_VAR `fj_box_right` to the rightmost X coordinate of the region's bounding box^*^;\n- INT_VAR `fj_box_bottom` to the bottommost Y coordinate of the region's bounding box^*^;\n- INT_VAR `fj_cursor_idx` to the region's mouse cursor index (from cursors.bam)^*^;\n- STR_VAR `fj_destination_area` to the destination area resource reference (for travel regions);\n- STR_VAR `fj_destination_name` to the entrance name in the destination area (for travel regions);\n- INT_VAR `fj_flags` to the bitwise region flags;\n- INT_VAR `fj_info_point_strref` to the information text string reference (for info points, default -1);\n- INT_VAR `fj_trap_detect` to the trap detection difficulty percentage;\n- INT_VAR `fj_trap_remove` to the trap removal difficulty percentage;\n- INT_VAR `fj_trap_active` to whether the region is trapped (0=no, 1=yes);\n- INT_VAR `fj_trap_status` to whether the trap is detected (0=no, 1=yes);\n- INT_VAR `fj_loc_x` to the trap launch X coordinate^*^;\n- INT_VAR `fj_loc_y` to the trap launch Y coordinate^*^;\n- STR_VAR `fj_key_resref` to the filename of the region's key;\n- STR_VAR `fj_reg_script` to the region script;\n- INT_VAR `fj_alt_x` to the activation point X coordinate;\n- INT_VAR `fj_alt_y` to the activation point Y coordinate;\n- STR_VAR `fj_sound` to the sound resource reference (ONLY for PST);\n- INT_VAR `fj_talk_loc_x` to the talk location point X coordinate (ONLY for PST);\n- INT_VAR `fj_talk_loc_y` to the talk location point Y coordinate (ONLY for PST);\n- INT_VAR `fj_speaker_strref` to the speaker's name string reference (default -1; ONLY for PST);\n- STR_VAR `fj_dialog` to the region's dialogue file (ONLY for PST);\n- INT_VAR `fj_vertex_0` to (X coordinate + (Y coordinate << 16)) for each vertex pair^*^;\n\nSpawn structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the spawn point's name^*^;\n- INT_VAR `fj_loc_x` to the spawning X coordinate^*^;\n- INT_VAR `fj_loc_y` to the spawning Y coordinate^*^;\n- STR_VAR `fj_cre_resref0` to the resource reference of each creature spawned (0-9)^*^;\n- INT_VAR `fj_spawn_num` to the count of spawn creatures^*^;\n- INT_VAR `fj_difficulty` to the base number of creatures to spawn (encounter difficulty)^*^;\n- INT_VAR `fj_delay` to the number of seconds between spawning (default 10);\n- INT_VAR `fj_method` to the spawn method;\n- INT_VAR `fj_duration` to the creature duration (default 1000);\n- INT_VAR `fj_wander_dist_spawn` to the creature's random walk distance limit (default 1000);\n- INT_VAR `fj_mvmt_dist_spawn` to the creature's movement distance limit (default 1000);\n- INT_VAR `fj_max_num` to the maximum number of creatures to spawn^*^;\n- INT_VAR `fj_enable` to the spawn point status (0=inactive, 1=active, default 1);\n- INT_VAR `fj_schedule` to the hourly appearance schedule (bits 0-23, default -1 or always);\n- INT_VAR `fj_day_prob` to the spawn point daytime probability (default 100);\n- INT_VAR `fj_night_prob` to the spawn point nighttime probability (default 100);\n\nEntrance structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the entrance's name^*^;\n- INT_VAR `fj_loc_x` to the X coordinate^*^;\n- INT_VAR `fj_loc_y` to the Y coordinate^*^;\n- INT_VAR `fj_orientation` to the facing direction (0-15 where 0=south, 4=west, 8=north, 12=east)^*^;\n\nContainer structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the container's name^*^;\n- INT_VAR `fj_loc_x` to the X coordinate^*^;\n- INT_VAR `fj_loc_y` to the Y coordinate^*^;\n- INT_VAR `fj_type` to the container type (1=bag, 2=chest, 3=drawer, 4=pile, 5=table, 6=shelf, 7=altar, 8=nonvisible, 9=spellbook, 10=body, 11=barrel, 12=crate)^*^;\n- INT_VAR `fj_lock_diff` to the lock difficulty (default 100);\n- INT_VAR `fj_flags` to the bitwise container flags (bit0=locked, bit3=trap resets, bit5=disabled);\n- INT_VAR `fj_trap_detect` to the trap detection difficulty percentage;\n- INT_VAR `fj_trap_remove_diff` to the trap removal difficulty percentage (default 100);\n- INT_VAR `fj_trap_active` to whether the container is trapped (0=no, 1=yes);\n- INT_VAR `fj_trap_status` to whether the trap is detected (0=no, 1=yes);\n- INT_VAR `fj_trap_loc_x` to the trap launch X coordinate^*^;\n- INT_VAR `fj_trap_loc_y` to the trap launch Y coordinate^*^;\n- INT_VAR `fj_box_left` to the leftmost X coordinate of the trap's bounding box;\n- INT_VAR `fj_box_top` to the topmost Y coordinate of the trap's bounding box;\n- INT_VAR `fj_box_right` to the rightmost X coordinate of the trap's bounding box;\n- INT_VAR `fj_box_bottom` to the bottommost Y coordinate of the trap's bounding box;\n- STR_VAR `fj_trap_script` to the trap's script;\n- INT_VAR `fj_vertex_0` to (X coordinate + (Y coordinate << 16)) for each vertex pair^*^;\n- STR_VAR `fj_key_resref` to the filename of the container's key;\n- INT_VAR `fj_lockpick_strref` to the lockpick string reference (default -1);\n\nItem structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the item's resource reference (filename)^*^;\n- INT_VAR `fj_con_itm_idx` to the index of the container to which the item is added^*^;\n- INT_VAR `fj_itm_expiry` to the item expiration time (default 0);\n- INT_VAR `fj_charge0` to the charges of the 1st ability (item quantity for stackables, default 0);\n- INT_VAR `fj_charge1` to the charges of the 2nd ability (default 0);\n- INT_VAR `fj_charge2` to the charges of the 3rd ability (default 0);\n- INT_VAR `fj_flags` to the bitwise item flags (bit0=identified, bit1=unstealable, bit2=stolen, bit3=undroppable, default 0);\n\nAmbient structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the ambient's name^*^;\n- INT_VAR `fj_loc_x` to the X coordinate^*^;\n- INT_VAR `fj_loc_y` to the Y coordinate^*^;\n- INT_VAR `fj_radius` to the sound radius (default 500);\n- INT_VAR `fj_loc_z` to the Z coordinate (height);\n- INT_VAR `fj_pitch_variance` to the pitch variance;\n- INT_VAR `fj_volume_variance` to the volume variance;\n- INT_VAR `fj_volume` to the volume percentage (default 80);\n- STR_VAR `fj_wav_resref0` to the resource reference of each sound (0-9)^*^;\n- INT_VAR `fj_sound_num` to the number of sounds^*^;\n- INT_VAR `fj_delay` to the base interval in seconds between sounds from this ambient list;\n- INT_VAR `fj_variation` to the base deviation from the base interval;\n- INT_VAR `fj_schedule` to the hourly appearance schedule (bits 0-23, default -1 or always);\n- INT_VAR `fj_flags` to the bitwise ambient flags^*^;\n\nVariable structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the variable's name^*^;\n- INT_VAR `fj_variable_value` to the variable's value^*^;\n\nDoor structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the door's name^*^;\n- STR_VAR `fj_door_wed_id` to the door ID linked to the .wed file^*^;\n- INT_VAR `fj_flags` to the bitwise door flags^*^;\n- INT_VAR `fj_open_box_left` to the leftmost X coordinate of the open door's bounding box^*^;\n- INT_VAR `fj_open_box_top` to the topmost Y coordinate of the open door's bounding box^*^;\n- INT_VAR `fj_open_box_right` to the rightmost X coordinate of the open door's bounding box^*^;\n- INT_VAR `fj_open_box_bottom` to the bottommost Y coordinate of the open door's bounding box^*^;\n- INT_VAR `fj_closed_box_left` to the leftmost X coordinate of the closed door's bounding box^*^;\n- INT_VAR `fj_closed_box_top` to the topmost Y coordinate of the closed door's bounding box^*^;\n- INT_VAR `fj_closed_box_right` to the rightmost X coordinate of the closed door's bounding box^*^;\n- INT_VAR `fj_closed_box_bottom` to the bottommost Y coordinate of the closed door's bounding box^*^;\n- INT_VAR `fj_door_open_vert_0` to (X coordinate + (Y coordinate << 16)) for each vertex pair of the open door^*^;\n- INT_VAR `fj_door_closed_vert_0` to (X coordinate + (Y coordinate << 16)) for each vertex pair of the closed door^*^;\n- INT_VAR `fj_cell_open_vert_0` to (X coordinate + (Y coordinate << 16)) for each impeded search map cell of the open door^*^;\n- INT_VAR `fj_cell_closed_vert_0` to (X coordinate + (Y coordinate << 16)) for each impeded search map cell of the closed door^*^;\n- STR_VAR `fj_door_open_wav` to the door open sound;\n- STR_VAR `fj_door_close_wav` to the door closed sound;\n- INT_VAR `fj_cursor_idx` to the door's mouse cursor index (from cursors.bam)^*^;\n- INT_VAR `fj_trap_detect` to the trap detection difficulty percentage;\n- INT_VAR `fj_trap_remove` to the trap removal difficulty percentage;\n- INT_VAR `fj_trap_active` to whether the door is trapped (0=no, 1=yes);\n- INT_VAR `fj_trap_status` to whether the trap is detected (0=no, 1=yes);\n- INT_VAR `fj_trap_loc_x` to the trap launch X coordinate^*^;\n- INT_VAR `fj_trap_loc_y` to the trap launch Y coordinate^*^;\n- STR_VAR `fj_key_resref` to the filename of the door's key;\n- STR_VAR `fj_door_script` to the door script;\n- INT_VAR `fj_detect_diff` to the detection difficulty (for secret doors);\n- INT_VAR `fj_locked_diff` to the lock difficulty;\n- INT_VAR `fj_open_loc_x` to the X coordinate for toggling the door's open state^*^;\n- INT_VAR `fj_open_loc_y` to the Y coordinate for toggling the door's open state^*^;\n- INT_VAR `fj_closed_loc_x` to the X coordinate for toggling the door's closed state^*^;\n- INT_VAR `fj_closed_loc_y` to the Y coordinate for toggling the door's closed state^*^;\n- INT_VAR `fj_lockpick_strref` to the lockpick string reference (default -1);\n- STR_VAR `fj_travel_trigger` to the travel region name^*^;\n- INT_VAR `fj_dlg_strref` to the dialogue string reference (default -1);\n- STR_VAR `fj_dlg_resref` to the door's dialogue file;\n\nAnimation structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the animation name^*^;\n- INT_VAR `fj_loc_x` to the X coordinate^*^;\n- INT_VAR `fj_loc_y` to the Y coordinate^*^;\n- INT_VAR `fj_schedule` to the hourly appearance schedule (bits 0-23, default -1 or always);\n- STR_VAR `fj_bam_resref` to the animation resource reference (filename)^*^;\n- INT_VAR `fj_bam_seq` to the BAM sequence number;\n- INT_VAR `fj_bam_frame` to the BAM frame number;\n- INT_VAR `fj_flags` to the bitwise animation flags^*^;\n- INT_VAR `fj_loc_z` to the height;\n- INT_VAR `fj_transparent` to the BAM transparency;\n- INT_VAR `fj_init_frame` to the starting frame;\n- INT_VAR `fj_loop_chance` to the chance of looping;\n- INT_VAR `fj_skip_cycles` to start delay in frames;\n- STR_VAR `fj_bmp_resref` to the palette bitmap;\n\nBitmask structure variables\\\":\\\"\n\n- STR_VAR `fj_bitmask` to path/to/binary.file ^*^;\n\nSonglist structure variables\\\":\\\"\n\n- INT_VAR `fj_song_day` to the day SONGLIST.2DA entry;\n- INT_VAR `fj_song_night` to the night SONGLIST.2DA entry;\n- INT_VAR `fj_song_victory` to the victory SONGLIST.2DA entry;\n- INT_VAR `fj_song_battle` to the battle SONGLIST.2DA entry;\n- INT_VAR `fj_song_defeat` to the defeat SONGLIST.2DA entry;\n- STR_VAR `fj_song_day0` to the day song WAV resref;\n- STR_VAR `fj_song_day1` to the night song WAV resref;\n- INT_VAR `fj_song_day_vol` to the day songs volume (default 100);\n- STR_VAR `fj_song_night0` to the night song WAV resref;\n- STR_VAR `fj_song_night1` to the second night song WAV resref;\n- INT_VAR `fj_song_night_vol` to the night songs volume (default 100);\n\nRest interrupt structure variables\\\":\\\"\n\n- STR_VAR `fj_name` to the name of the rest interrupts (for editor use only);\n- INT_VAR `fj_cre_strref0...fj_cre_strref9` to string displayed upon party ambush (default -1);\n- STR_VAR `fj_cre_resref0...fj_cre_resref9` to creature resref;\n- STR_VAR `fj_spawn_num` to the number of spawned attackers;\n- STR_VAR `fj_difficulty` to the difficulty of the encounter;\n- STR_VAR `fj_duration` to the creature's duration (default 1000);\n- STR_VAR `fj_wander_distance` to the creature's random walk distance limit (default 1000);\n- STR_VAR `fj_mvmt_distance` to the creature's movement distance limit (default 1000);\n- STR_VAR `fj_max_num` to maximum number of spawned creatures;\n- STR_VAR `fj_enable` to whether rest interrupts are enabled (0=no, 1=yes);\n- STR_VAR `fj_day_prob` to probability of daytime ambush;\n- STR_VAR `fj_night_prob` to probability of nightime ambush;\n\nMap note structure variables\\\":\\\"\n\n- INT_VAR `fj_loc_x` to the X coordinate^*^;\n- INT_VAR `fj_loc_y` to the Y coordinate^*^;\n- INT_VAR `fj_note_strref` to the note string reference (default -1, BGII only)^*^;\n- STR_VAR `fj_note_text` to the note text (PST only)^*^;\n- INT_VAR `fj_strref_loc` to the strref location (0=external, 1=dialog.tlk, default 1);\n- INT_VAR `fj_color` to the map marker color (0-7);\n- INT_VAR `fj_note_id` to the note ID;\n\nProjectile trap structure variables (not available on PST)\\\":\\\"\n\n- STR_VAR `fj_name` to the projectile filename^*^;\n- INT_VAR `fj_eff_off` to the effect block offset;\n- INT_VAR `fj_eff_size` to the effect block size;\n- INT_VAR `fj_missile_num` to the missile.ids reference (projectl.ids - 1);\n- INT_VAR `fj_frequency` to the explosion length (in frames);\n- INT_VAR `fj_duration` to the number of explosions;\n- INT_VAR `fj_loc_x` to the X coordinate^*^;\n- INT_VAR `fj_loc_y` to the Y coordinate^*^;\n- INT_VAR `fj_loc_z` to the height;\n- INT_VAR `fj_target` to the target ID;\n- STR_VAR `fj_embedded_eff0` to path/to/v2.eff or eff resref containing to projectile's effects^*^;\n"
2327
+ "value": "```weidu-tp2-tooltip\npatch function fj_are_structure\n```\n\n---\n\nAdds a structure to an area file. All variables are zero or blank by default unless otherwise indicated. Fields designated by an asterisk are typically required; all others are optional. This is a PATCH function.\n\nSee [full parameter reference](https://weidu.org/~thebigg/README-WeiDU.html#fj_are_structure).\n\n| | | | |\n|-:|:-|:-|:-|\n|**INT**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|fj_delete_mode|=&nbsp;0|&nbsp;&nbsp;the index of the structure to be deleted (if deleting rather than adding a new structure)|\n|[int](https://ielib.bgforge.net/types#int)|fj_debug|=&nbsp;0|&nbsp;&nbsp;set to 1 to enable feedback|\n|**STR**|**vars**|||\n|[string](https://ielib.bgforge.net/types#string)|fj_structure_type|_required_|&nbsp;&nbsp;the type of area structure to be added (actor, region, spawn, entrance, container, itm, ambient, variable, door, animation, explored bitmask, songlist, rest interrupt table, note or projectile)|\n|**RET**|**vars**|||\n|[int](https://ielib.bgforge.net/types#int)|fj_return_offset||&nbsp;&nbsp;the position of the structure in the area file|"
2328
2328
  }
2329
2329
  },
2330
2330
  "READ_LONG": {