Loading...   

[Show Table of Contents]


The following commands are available from the Perl quest:: API.


ยงPerl API - quest::

  • taskselector(taskid1, taskid2, ... taskid40)
    • This brings up the Task selector window with the specified tasks available for selection (from 1 to 40). When the task selector is brought up via this method, no check is made as to whether the character has the tasks enabled or not (see enabletask, disabletask, istaskenabled).
  • tasksetselector(tasksetid)
    • Brings up the Task Selector window with the set of tasks from the tasksets table with id tasksetid for which the player is enabled in the character_enabledtasks table.
  • istaskactive(task)
    • Returns true if the client has the specified task amongst it's active tasks.
  • istaskactivityactive(task,activity)
    • Returns true if the client has the specified task active, and the specified activity is also active (i.e. not completed and not hidden).
  • updatetaskactivity(task, activity[, count])
    • If the specified task is active, the donecount of the specified activity is incremented by count. count defaults to 1 if not specified.
  • resettaskactivity(task, activity)
    • If the specified task is active, the donecount of the specified activity is set to 0.
  • taskexplorearea(exploreid)
    • Any explore (type 5) activities which have the numeric value exploreid in their goalid field, and for which the zoneid of the activity is either 0 or this zone, will be marked as completed.
  • assigntask(taskid)
    • Adds the specified task to the player's active tasks. Will fail if the player has the maximum number of active tasks. If successfully assigned, sub EVENT_TASKACCEPTED will be called.
  • failtask(taskid)
    • If the player has the specified task active, send the task failed message and remove the task.
  • tasktimeleft(taskid)
    • Return the number of seconds left before this task runs out of time (or -1 if no time limit, or the player does not have the task).
  • istaskcompleted(taskid)
    • Returns +1 if the player has previously completed the specified task, 0 otherwise. If RecordCompletedTasks is false, this function will return -1.
  • enabletask(taskid1 , ..., taskid10])
    • This is used in conjunction with the taskset selector. It enables the specified taskids (up to 10) for the quest initiator. This state is saved to the database.
  • disabletask(taskid1, ..., taskid10)
    • This is used in conjunction with the taskset selector. It disables the specified taskids (up to 10) for the quest initiator. This state is saved to the database.
  • istaskenabled(taskid)
    • This function returns true if the initiator has taskid enabled. Note that enabled is not the same as active. Enabled means that if a task selector is requested for a taskset, only tasks that the character has enabled will appear in the selector.
  • enabledtaskcount(taskset)
    • This function returns the number of tasks in the specified TaskSet that the initiator is enabled for. Possible uses could be to check if the player is not enabled for any of the tasks, and enabling the first one, or, if the player is enabled for them all, quest::say("I have no more tasks to offer you"); The function will return -1 if the Task System is not enabled, or the TaskSet number is out-of-range.
  • firsttaskinset(taskset)
    • This function returns the first (numerically lowest) task in a taskset, or 0 if the taskset does not exist.
  • lasttaskinset(taskset)
    • This function returns the last (numerically highest) task in a taskset, or 0 if the taskset does not exist.
  • nexttaskinset(taskset, taskid)
    • Returns the next TaskID in the specified taskset that is numerically higher than the specified taskid.
  • activespeaktask()
    • This function returns a TaskID if the quest initiator has an active task with an active (not hidden or completed) task to speak to the NPC, or 0 if the quest initiator does not have an active task/activity to speak to the NPC. If the initiator should happen to have more than one active task/activity to speak with the NPC, the TaskID of the task in the lowest numbered task slot will be returned.
  • activespeakactivity(taskid)
    • This function is designed to be used with the activespeaktask function. It returns the ActivityID of the lowest numbered active activity to speak with this NPC in the specified task. For example, if you have a task with activities like this:
    • Task 200:
    •  Activity 0: Kill 5 Rats
    •  Activity 1: Speak with Guard Philbin
    •  Activity 2: Kill 2 Snakes
    •  Activity 3: Speak with Guard Philbin
    • In sub EVENT_SAY, you could use quest::activespeakactivity(200) to determine whether the player was on activity 1 or 3 and tailor your response accordingly.
  • activetasksinset(taskset)
    • Returns the number of tasks in the given TaskSet that the player has active.
  • completedtasksinset(taskset)
    • Returns the number of tasks in the given TaskSet that the player has previously completed. 
  • sub EVENT_TASKACCEPTED
    • This sub is called with task_id set to the id of the task a player accepted by clicking on the 'Accept' button in the Task selector window.
    • If the assigntask(taskid) function is used to forcibly assign a task to a player, then this sub will also be called with task_id set to taskid if assigntask is successful.
  • sub EVENT_TASK_STAGE_COMPLETE
    • Exports $task_id and $activity_id.