@paulbarmstrong/js-to-sqf 0.1.1-alpha → 0.1.3-alpha

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.
Files changed (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -7
  3. package/index.d.ts +271 -1
  4. package/package.json +36 -36
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Paul B. Armstrong
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Paul B. Armstrong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- ### @paulbarmstrong/js-to-sqf
2
-
3
- This is a typescript types library defining SQF (Status Quo Format) commands and functions. The purpose is to make it easy to author code which can be transpiled to SQF by the [@paulbarmstrong/js-to-sqf-cli](https://github.com/paulbarmstrong/js-to-sqf-cli) tool.
4
-
5
- #### Usage
6
-
7
- See https://github.com/paulbarmstrong/js-to-sqf-cli
1
+ ### @paulbarmstrong/js-to-sqf
2
+
3
+ This is a typescript types library defining SQF (Status Quo Format) commands and functions. The purpose is to make it easy to author code which can be transpiled to SQF by the [@paulbarmstrong/js-to-sqf-cli](https://github.com/paulbarmstrong/js-to-sqf-cli) tool.
4
+
5
+ #### Usage
6
+
7
+ See https://github.com/paulbarmstrong/js-to-sqf-cli
package/index.d.ts CHANGED
@@ -761,7 +761,7 @@ export function addEditorObject(map: Control, typeNameSubtypeConfig: Array<any>)
761
761
  * @see {@link https://community.bistudio.com/wiki/addEventHandler}
762
762
  * @sqfsyntaxtype binary
763
763
  */
764
- export function addEventHandler(target: GameObject | Group, type: string, code: Function | string): number
764
+ export function addEventHandler(target: GameObject | Group, type: string, code: Function): number
765
765
 
766
766
  /**
767
767
  * Applies given force for one frame (essentially an impulse) to unit or given
@@ -4946,6 +4946,276 @@ export function weaponsTurret(vehicle: GameObject, turretPath: TurretPath): Arra
4946
4946
  */
4947
4947
  export function west(): Side
4948
4948
 
4949
+ /**
4950
+ * Add an event handler to the given control. ⚠
4951
+ * • Control event handlers are processed in reversed order, i.e. last added:
4952
+ * first, first added: last. So if you have an override it should be set up in the
4953
+ * 1st added EH.
4954
+ * • When using the event names listed here with the ctrlAddEventHandler,
4955
+ * ctrlSetEventHandler, displayAddEventHandler or displaySetEventHandler commands,
4956
+ * the prefix "on" in the event name must be removed (e.g. 'ButtonDown' instead of
4957
+ * 'onButtonDown').
4958
+ *
4959
+ * @param handler - event handler name (without the "on" prefix)
4960
+ * @param code - code to execute when the event fires
4961
+ * @returns handler ID or -1 if failed
4962
+ * @see {@link https://community.bistudio.com/wiki/ctrlAddEventHandler}
4963
+ * @sqfsyntaxtype binary
4964
+ */
4965
+ export function ctrlAddEventHandler(control: Control, handler: string, code: Function): number
4966
+
4967
+ /**
4968
+ * Enables or disables a control of the currently active user dialog. Disabled
4969
+ * controls cannot be clicked onto. Read Arma: GUI Configuration for more
4970
+ * information about user dialogs and controls.
4971
+ *
4972
+ * @param idc - control IDC
4973
+ * @param enable - true to enable the control, false to disable it
4974
+ * @see {@link https://community.bistudio.com/wiki/ctrlEnable}
4975
+ * @sqfsyntaxtype unary
4976
+ */
4977
+ export function ctrlEnable(idc: number, enable: boolean): void
4978
+
4979
+ /**
4980
+ * Enables or disables a control of the currently active user dialog. Disabled
4981
+ * controls cannot be clicked onto. Read Arma: GUI Configuration for more
4982
+ * information about user dialogs and controls.
4983
+ *
4984
+ * @see {@link https://community.bistudio.com/wiki/ctrlEnable}
4985
+ * @sqfsyntaxtype binary
4986
+ */
4987
+ export function ctrlEnableV2(controlName: Control, enable: boolean): void
4988
+
4989
+ /**
4990
+ * Returns if a control on the currently active user dialog is enabled. Disabled
4991
+ * controls cannot be focused. Read Arma: GUI Configuration for more information
4992
+ * about user dialogs and controls.
4993
+ *
4994
+ * @param idc - control's IDC
4995
+ * @returns true if the control is enabled, false if not
4996
+ * @see {@link https://community.bistudio.com/wiki/ctrlEnabled}
4997
+ * @sqfsyntaxtype unary
4998
+ */
4999
+ export function ctrlEnabled(idc: number): boolean
5000
+
5001
+ /**
5002
+ * Returns if a control on the currently active user dialog is enabled. Disabled
5003
+ * controls cannot be focused. Read Arma: GUI Configuration for more information
5004
+ * about user dialogs and controls.
5005
+ *
5006
+ * @returns true if the control is enabled, false if not
5007
+ * @see {@link https://community.bistudio.com/wiki/ctrlEnabled}
5008
+ * @sqfsyntaxtype unary
5009
+ */
5010
+ export function ctrlEnabledV2(controlName: Control): boolean
5011
+
5012
+ /**
5013
+ * Shows or hides a control, or group of controls together with all the controls
5014
+ * inside that group of controls. Read Arma: GUI Configuration for more information
5015
+ * about user dialogs and controls. ⓘUsing ctrlShow on a controls group will show
5016
+ * or hide all controls within the controls group (including controls that are
5017
+ * placed in nested controls groups).
5018
+ *
5019
+ * @param idc - control IDC
5020
+ * @param show - true to show the control, false to hide it
5021
+ * @see {@link https://community.bistudio.com/wiki/ctrlShow}
5022
+ * @sqfsyntaxtype unary
5023
+ */
5024
+ export function ctrlShow(idc: number, show: boolean): void
5025
+
5026
+ /**
5027
+ * Shows or hides a control, or group of controls together with all the controls
5028
+ * inside that group of controls. Read Arma: GUI Configuration for more information
5029
+ * about user dialogs and controls. ⓘUsing ctrlShow on a controls group will show
5030
+ * or hide all controls within the controls group (including controls that are
5031
+ * placed in nested controls groups).
5032
+ *
5033
+ * @param show - true to show the control, false to hide it
5034
+ * @see {@link https://community.bistudio.com/wiki/ctrlShow}
5035
+ * @sqfsyntaxtype binary
5036
+ */
5037
+ export function ctrlShowV2(control: Control, show: boolean): void
5038
+
5039
+ /**
5040
+ * Returns the text of a control of the currently active user dialog. This command
5041
+ * can be used on static texts, buttons, edit lines and active texts as well as for
5042
+ * images, where it returns the image path. Does not work on HTML control and
5043
+ * returns empty string "". Since 2.05 supported control types are: * CT_STATIC
5044
+ * • CT_EDIT
5045
+ * • CT_XKEYDESC
5046
+ * • CT_XBUTTON
5047
+ * • CT_SHORTCUTBUTTON
5048
+ * • CT_STRUCTURED_TEXT
5049
+ * • CT_BUTTON
5050
+ * • CT_ACTIVETEXT Since 2.20 CT_PROGRESS is also supported.
5051
+ *
5052
+ * @param idc - control ID
5053
+ * @returns the text or image path or texture is returned, dependent on the control type
5054
+ * @see {@link https://community.bistudio.com/wiki/ctrlText}
5055
+ * @sqfsyntaxtype unary
5056
+ */
5057
+ export function ctrlText(idc: number): string
5058
+
5059
+ /**
5060
+ * Returns the text of a control of the currently active user dialog. This command
5061
+ * can be used on static texts, buttons, edit lines and active texts as well as for
5062
+ * images, where it returns the image path. Does not work on HTML control and
5063
+ * returns empty string "". Since 2.05 supported control types are: * CT_STATIC
5064
+ * • CT_EDIT
5065
+ * • CT_XKEYDESC
5066
+ * • CT_XBUTTON
5067
+ * • CT_SHORTCUTBUTTON
5068
+ * • CT_STRUCTURED_TEXT
5069
+ * • CT_BUTTON
5070
+ * • CT_ACTIVETEXT Since 2.20 CT_PROGRESS is also supported.
5071
+ *
5072
+ * @param controlName - control
5073
+ * @returns the text or image path or texture is returned, dependent on the control type
5074
+ * @see {@link https://community.bistudio.com/wiki/ctrlText}
5075
+ * @sqfsyntaxtype unary
5076
+ */
5077
+ export function ctrlTextV2(controlName: Control): string
5078
+
5079
+ /**
5080
+ * Limit the speed of an AI-driven vehicle or AI person to given value. It has
5081
+ * continuous effect and AI will not break through the speed limitation until one
5082
+ * is contacted, engaged or regrouped.
5083
+ *
5084
+ * @param speed - in km/h; By default, it's 2 * maxSpeed of the vehicle/unit (which is defined in
5085
+ * config)
5086
+ * @see {@link https://community.bistudio.com/wiki/limitSpeed}
5087
+ * @sqfsyntaxtype binary
5088
+ */
5089
+ export function limitSpeed(objectName: GameObject, speed: number | boolean): void
5090
+
5091
+ /**
5092
+ * Adds a row of strings.
5093
+ *
5094
+ * @returns row index
5095
+ * @see {@link https://community.bistudio.com/wiki/lnbAddRow}
5096
+ * @sqfsyntaxtype unary
5097
+ */
5098
+ export function lnbAddRow(ctrl: number | Control, data: Array<string>): number
5099
+
5100
+ /**
5101
+ * Adds a row of strings.
5102
+ *
5103
+ * @returns row index
5104
+ * @see {@link https://community.bistudio.com/wiki/lnbAddRow}
5105
+ * @sqfsyntaxtype binary
5106
+ */
5107
+ export function lnbAddRowV2(ctrl: Control, data: Array<string>): number
5108
+
5109
+ /**
5110
+ * Clears all items in the given listbox or combobox.
5111
+ *
5112
+ * @see {@link https://community.bistudio.com/wiki/lnbClear}
5113
+ * @sqfsyntaxtype unary
5114
+ */
5115
+ export function lnbClear(idc: number): void
5116
+
5117
+ /**
5118
+ * Clears all items in the given listbox or combobox.
5119
+ *
5120
+ * @see {@link https://community.bistudio.com/wiki/lnbClear}
5121
+ * @sqfsyntaxtype unary
5122
+ */
5123
+ export function lnbClearV2(ctrl: Control): void
5124
+
5125
+ /**
5126
+ * Returns the index of the selected row id 2D listbox.
5127
+ *
5128
+ * @returns number
5129
+ * @see {@link https://community.bistudio.com/wiki/lnbCurSelRow}
5130
+ * @sqfsyntaxtype unary
5131
+ */
5132
+ export function lnbCurSelRow(idc: number): number
5133
+
5134
+ /**
5135
+ * Returns the index of the selected row id 2D listbox.
5136
+ *
5137
+ * @returns number
5138
+ * @see {@link https://community.bistudio.com/wiki/lnbCurSelRow}
5139
+ * @sqfsyntaxtype unary
5140
+ */
5141
+ export function lnbCurSelRowV2(ctrl: Control): number
5142
+
5143
+ /**
5144
+ * Returns the additional text (invisible) in an item with the given position of
5145
+ * the 2D listbox.
5146
+ *
5147
+ * @param cell - list item position in format [row, column]
5148
+ * @returns string
5149
+ * @see {@link https://community.bistudio.com/wiki/lnbData}
5150
+ * @sqfsyntaxtype unary
5151
+ */
5152
+ export function lnbData(idc: number | Control, cell: [number, number]): string
5153
+
5154
+ /**
5155
+ * Returns the additional text (invisible) in an item with the given position of
5156
+ * the 2D listbox.
5157
+ *
5158
+ * @param cell - list item position in format [row, column]
5159
+ * @returns string
5160
+ * @see {@link https://community.bistudio.com/wiki/lnbData}
5161
+ * @sqfsyntaxtype binary
5162
+ */
5163
+ export function lnbDataV2(ctrl: Control, cell: [number, number]): string
5164
+
5165
+ /**
5166
+ * Sets the additional text (invisible) on the item with the given position of the
5167
+ * 2D listbox.
5168
+ *
5169
+ * @param cell - list item position in format [row, column]
5170
+ * @param data - the invisible text to add
5171
+ * @see {@link https://community.bistudio.com/wiki/lnbSetData}
5172
+ * @sqfsyntaxtype unary
5173
+ */
5174
+ export function lnbSetData(idc: number, cell: [number, number], data: string): void
5175
+
5176
+ /**
5177
+ * Sets the additional text (invisible) on the item with the given position of the
5178
+ * 2D listbox.
5179
+ *
5180
+ * @param cell - list item position in format [row, column]
5181
+ * @param data - the invisible text to add
5182
+ * @see {@link https://community.bistudio.com/wiki/lnbSetData}
5183
+ * @sqfsyntaxtype binary
5184
+ */
5185
+ export function lnbSetDataV2(ctrl: Control, cell: [number, number], data: string): void
5186
+
5187
+ /**
5188
+ * Sets the text in the item with the given position of the 2D listbox.
5189
+ *
5190
+ * @param cell - list item position in format [row, column]
5191
+ * @see {@link https://community.bistudio.com/wiki/lnbSetText}
5192
+ * @sqfsyntaxtype unary
5193
+ */
5194
+ export function lnbSetText(idc: number, cell: [number, number], data: string): void
5195
+
5196
+ /**
5197
+ * Sets the text in the item with the given position of the 2D listbox.
5198
+ *
5199
+ * @param cell - list item position in format [row, column]
5200
+ * @see {@link https://community.bistudio.com/wiki/lnbSetText}
5201
+ * @sqfsyntaxtype binary
5202
+ */
5203
+ export function lnbSetTextV2(ctrl: Control, cell: [number, number], data: string): void
5204
+
5205
+ /**
5206
+ * Parses the string, interpreting its content as a floating point number. ⚠This
5207
+ * command does not work with strings representing hexadecimal numbers (e.g
5208
+ * "0xCF"). parseNumber "512 + 0x2F"; // 512, WRONG! "512 + 0x2F" call
5209
+ * BIS_fnc_parseNumber // 559, CORRECT! ⓘStarting whitespaces are discarded, then
5210
+ * as many valid characters are used to be interpreted as a number until an invalid
5211
+ * character is found then the rest of the string is ignored.
5212
+ *
5213
+ * @returns the parsed number, 0 if no valid number was found; in the case of a passed Boolean, 0 if false, 1 if true
5214
+ * @see {@link https://community.bistudio.com/wiki/parseNumber}
5215
+ * @sqfsyntaxtype unary
5216
+ */
5217
+ export function parseNumber(value: string | boolean | any): number
5218
+
4949
5219
 
4950
5220
  export namespace bis {
4951
5221
  /**
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "@paulbarmstrong/js-to-sqf",
3
- "version": "0.1.1-alpha",
4
- "type": "module",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "types": "index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./index.d.ts"
12
- }
13
- },
14
- "files": [
15
- "index.d.ts"
16
- ],
17
- "scripts": {
18
- "generate": "node generate.js"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/paulbarmstrong/js-to-sqf.git"
23
- },
24
- "keywords": [
25
- "sqf",
26
- "types",
27
- "typescript"
28
- ],
29
- "author": "",
30
- "license": "ISC",
31
- "bugs": {
32
- "url": "https://github.com/paulbarmstrong/js-to-sqf/issues"
33
- },
34
- "homepage": "https://github.com/paulbarmstrong/js-to-sqf#readme",
35
- "description": "Type definitions for the js-to-sqf ecosystem"
36
- }
1
+ {
2
+ "name": "@paulbarmstrong/js-to-sqf",
3
+ "version": "0.1.3-alpha",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "types": "index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "index.d.ts"
16
+ ],
17
+ "scripts": {
18
+ "generate": "node generate.js"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/paulbarmstrong/js-to-sqf.git"
23
+ },
24
+ "keywords": [
25
+ "sqf",
26
+ "types",
27
+ "typescript"
28
+ ],
29
+ "author": "",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/paulbarmstrong/js-to-sqf/issues"
33
+ },
34
+ "homepage": "https://github.com/paulbarmstrong/js-to-sqf#readme",
35
+ "description": "Type definitions for the js-to-sqf ecosystem"
36
+ }