Functions (Tasks) - ShadowBonnieRUS/GMOD-SB_Advanced_Nextbots_Base GitHub Wiki

Here are descriptions for functions used in base in tasks.lua file.

Marks help


🔹 NEXTBOT:SetupTaskList

Used to setup bot's list of tasks.

Arguments: 1

  1. table | List of tasks add new tasks to.

Returns: 0


🔹 NEXTBOT:SetupTasks

Used to start behaviour tasks on spawn. Called from NEXTBOT:BehaveStart.

Arguments: 0
Returns: 0


🔹 NEXTBOT:RunTask

Runs active tasks callbacks with given event.

Arguments: *

  1. string | Event of hook.
  2. ⭕ vararg | Arguments to callback. NOTE: In callback, first argument is always bot entity, second argument is always task data, passed arguments from NEXTBOT:RunTask starts at third argument.

Returns: *

  1. vararg | Callback return.

🔹 NEXTBOT:RunCurrentTask

Runs one given task callback with given event.

Arguments: *

  1. any | Task name.
  2. string | Event of hook.
  3. ⭕ vararg | Arguments to callback. NOTE: In callback, first argument is always bot entity, second argument is always task data, passed arguments from NEXTBOT:RunTask starts at third argument.

Returns: *

  1. vararg | Callback return.

🔹 NEXTBOT:StartTask

Starts new task with given data and calls 'OnStart' task callback. Does nothing if given task is already started.

Arguments: 2

  1. any | Task name.
  2. ⭕ table | Task data.

Returns: 0


🔹 NEXTBOT:TaskComplete

Calls 'OnComplete' and 'OnDelete' task callbacks and deletes task. Does nothing if given task is not started.

Arguments: 1

  1. any | Task name.

Returns: 0


🔹 NEXTBOT:TaskFail

Calls 'OnFail' and 'OnDelete' task callbacks and deletes task. Does nothing if given task is not started.

Arguments: 1

  1. any | Task name.

Returns: 0


🔹 NEXTBOT:IsTaskActive

Returns whenever given task is started or not.

Arguments: 1

  1. any | Task name.

Returns: 1

  1. bool | Returns true if task is started, false otherwise.