counter

Methods

(inner) counter(numopt, use_idopt, persistentopt, timeropt) → {counter}

Description:
  • Creates a counter, which has methods for editing items
Source:
Parameters:
Name Type Attributes Default Description
num number | boolean <optional>
0 Number or boolean to be represented by counter
use_id boolean <optional>
false Whether to use an existing item ID as a counter instead of creating a new item
persistent boolean <optional>
false Whether to make the counter persistent between attempts
timer boolean <optional>
false Whether to make the counter a timer
Returns:
Resulting counter
Type
counter

(inner) float_counter(numopt) → {counter}

Description:
  • Creates a floating-point counter
Source:
Parameters:
Name Type Attributes Default Description
num number | boolean <optional>
0 Number or boolean to be represented by counter
Returns:
Resulting counter
Type
counter

Type Definitions

add(amount)

Description:
  • Adds a specific amount (or another counter) to the current counter
Source:
Parameters:
Name Type Description
amount number | counter Counter or number to add to the current counter

add_to(counter)

Description:
  • Adds the current counter to another and resets the current counter
Source:
Parameters:
Name Type Description
counter counter Counter to add the current counter to

copy_to(counter)

Description:
  • Copies the current counter to another counter
Source:
Parameters:
Name Type Description
counter counter Counter to copy the current counter to

counter

Description:
  • Represents a counter, which is a wrapper around item IDs
Source:
Properties:
Name Type Description
item item Item ID of a counter
type item_type Type of a counter
add add Adds a specific amount (or another counter) to the current counter
subtract subtract Subtracts a specific amount (or another counter) from the current counter
multiply multiply Multiplies the current counter by a specific amount (or another counter)
divide divide Divides the current counter by a specific amount (or another counter)
set set Sets the current counter to a specific amount or another counter
reset reset Resets the current counter to 0
if_is if_is Checks if a comparison is true, and if so calls a group (SMALLER_THAN/EQUAL_TO_LARGER_THAN)
to_const to_const Converts the current counter to a plain number by taking in a range of possible values and a function
copy_to copy_to Copies the current counter to another counter
display display Displays the current counter at a specific position
to_obj to_obj Returns item display for current counter as an object
add_to add_to Adds the current counter to another and resets the current counter
subtract_from subtract_from Subtracts the current counter from another and resets the current counter
abs function Gets absolute value from counter
neg function Converts value to negative value
Represents a counter, which is a wrapper around item IDs
Type:
  • object

display(x, y)

Description:
  • Displays the current counter at a specific position
Source:
Parameters:
Name Type Description
x number X position of item display
y number Y position of item display

divide(amount)

Description:
  • Divides the current counter by a specific amount (or another counter)
Source:
Parameters:
Name Type Description
amount number | counter Counter or number to divide the current counter by

float_counter

Description:
  • Version of counter that supports floating point values
Source:
Properties:
Name Type Description
item item Item ID of a counter
type item_type Type of a counter
add add Adds a specific amount (or another counter) to the current counter
subtract subtract Subtracts a specific amount (or another counter) from the current counter
multiply multiply Multiplies the current counter by a specific amount (or another counter)
divide divide Divides the current counter by a specific amount (or another counter)
set set Sets the current counter to a specific amount or another counter
reset reset Resets the current counter to 0
copy_to copy_to Copies the current counter to another counter
display display Displays the current counter at a specific position
to_obj to_obj Returns item display for current counter as an object
add_to add_to Adds the current counter to another and resets the current counter
subtract_from subtract_from Subtracts the current counter from another and resets the current counter
abs function Gets absolute value from counter
neg function Converts value to negative value
round function Rounds the floating point value into an integer
Version of counter that supports floating point values
Type:
  • object

if_is(comparison, other, trig_func)

Description:
  • Checks if a comparison is true, and if so calls a group (SMALLER_THAN/EQUAL_TO_LARGER_THAN)
Source:
Parameters:
Name Type Description
comparison comparison Condition to check for between the counter and number
other number Number to compare the current counter to
trig_func group Trigger function or group to run if the comparison is true

multiply(amount)

Description:
  • Multiplies the current counter by a specific amount (or another counter)
Source:
Parameters:
Name Type Description
amount number | counter Counter or number to multiply the current counter by

reset()

Description:
  • Resets the current counter to 0
Source:

set(amount)

Description:
  • Sets the current counter to a specific amount (or another counter)
Source:
Parameters:
Name Type Description
amount number | counter Counter or number to set the current counter to

subtract(amount)

Description:
  • Subtracts a specific amount (or another counter) from the current counter
Source:
Parameters:
Name Type Description
amount number | counter Counter or number to subtract from the current counter

subtract_from(counter)

Description:
  • Subtracts the current counter from another and resets the current counter
Source:
Parameters:
Name Type Description
counter counter Counter to be subtracted from

to_const(range, func)

Description:
  • Converts the current counter to a plain number by taking in a range of possible values and a function
Source:
Parameters:
Name Type Description
range array Possible range of values that the current counter is equal to
func function Callback function to run that takes the plain numerical value as input

to_obj() → {object}

Description:
  • Returns item display for current counter as an object
Source:
Returns:
Resulting item display
Type
object