Task - ID (Expression) — SkBee

Addon: SkBee · Category: Expression · Since: 3.3.0

Syntax

(current|last [created]) task id

Description

Get the current task ID. This will only be tasks created with the task section. If running Folia, tasks do not have IDs and this will always return `-1`.

You can optionally get the `last task id` which will return the ID of the last created task, this is useful when used outside of the section.

Examples

set {_id} to current task id

run 0 ticks later repeating every second:
	set {-id} to current task id
	add 1 to {_a}
	if {_a} > 10:
		exit loop

on unload:
	stop all tasks

on break:
	stop task with id {-id}

on place:
	run task 1 minute later:
		do some stuff
	set {_id} to last created task id

View source