@paulbarmstrong/js-to-sqf 0.1.1-alpha → 0.1.2-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 (2) hide show
  1. package/index.d.ts +265 -1
  2. package/package.json +1 -1
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,270 @@ 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
+ * @returns string
5148
+ * @see {@link https://community.bistudio.com/wiki/lnbData}
5149
+ * @sqfsyntaxtype unary
5150
+ */
5151
+ export function lnbData(idc: number | Control, row: number, column: number): string
5152
+
5153
+ /**
5154
+ * Returns the additional text (invisible) in an item with the given position of
5155
+ * the 2D listbox.
5156
+ *
5157
+ * @returns string
5158
+ * @see {@link https://community.bistudio.com/wiki/lnbData}
5159
+ * @sqfsyntaxtype binary
5160
+ */
5161
+ export function lnbDataV2(ctrl: Control, row: number, column: number): string
5162
+
5163
+ /**
5164
+ * Sets the additional text (invisible) on the item with the given position of the
5165
+ * 2D listbox.
5166
+ *
5167
+ * @param data - the invisible text to add
5168
+ * @see {@link https://community.bistudio.com/wiki/lnbSetData}
5169
+ * @sqfsyntaxtype unary
5170
+ */
5171
+ export function lnbSetData(idc: number, row: number, column: number, data: string): void
5172
+
5173
+ /**
5174
+ * Sets the additional text (invisible) on the item with the given position of the
5175
+ * 2D listbox.
5176
+ *
5177
+ * @param data - the invisible text to add
5178
+ * @see {@link https://community.bistudio.com/wiki/lnbSetData}
5179
+ * @sqfsyntaxtype binary
5180
+ */
5181
+ export function lnbSetDataV2(ctrl: Control, row: number, column: number, data: string): void
5182
+
5183
+ /**
5184
+ * Sets the text in the item with the given position of the 2D listbox.
5185
+ *
5186
+ * @see {@link https://community.bistudio.com/wiki/lnbSetText}
5187
+ * @sqfsyntaxtype unary
5188
+ */
5189
+ export function lnbSetText(idc: number, row: number, column: number, data: string): void
5190
+
5191
+ /**
5192
+ * Sets the text in the item with the given position of the 2D listbox.
5193
+ *
5194
+ * @see {@link https://community.bistudio.com/wiki/lnbSetText}
5195
+ * @sqfsyntaxtype binary
5196
+ */
5197
+ export function lnbSetTextV2(ctrl: Control, row: number, column: number, data: string): void
5198
+
5199
+ /**
5200
+ * Parses the string, interpreting its content as a floating point number. ⚠This
5201
+ * command does not work with strings representing hexadecimal numbers (e.g
5202
+ * "0xCF"). parseNumber "512 + 0x2F"; // 512, WRONG! "512 + 0x2F" call
5203
+ * BIS_fnc_parseNumber // 559, CORRECT! ⓘStarting whitespaces are discarded, then
5204
+ * as many valid characters are used to be interpreted as a number until an invalid
5205
+ * character is found then the rest of the string is ignored.
5206
+ *
5207
+ * @returns the parsed number, 0 if no valid number was found; in the case of a passed Boolean, 0 if false, 1 if true
5208
+ * @see {@link https://community.bistudio.com/wiki/parseNumber}
5209
+ * @sqfsyntaxtype unary
5210
+ */
5211
+ export function parseNumber(value: string | boolean | any): number
5212
+
4949
5213
 
4950
5214
  export namespace bis {
4951
5215
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paulbarmstrong/js-to-sqf",
3
- "version": "0.1.1-alpha",
3
+ "version": "0.1.2-alpha",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"