Skip to content

[Quest API] Add GetTimers() and GetPausedTimers() to Perl/Lua#4965

Merged
Akkadius merged 2 commits intomasterfrom
quest_api/gettimers_getpausedtimers
Aug 3, 2025
Merged

[Quest API] Add GetTimers() and GetPausedTimers() to Perl/Lua#4965
Akkadius merged 2 commits intomasterfrom
quest_api/gettimers_getpausedtimers

Conversation

@Kinglykrab
Copy link
Copy Markdown
Contributor

@Kinglykrab Kinglykrab commented Jul 11, 2025

Description

  • Adds GetTimers() and GetPausedTimers() methods to Perl and Lua.
  • Returns a list of timer names.
  • These methods allow you to get the active and paused timers on a mob or zone, allowing you to determine the remaining time or total duration, stop the timer, pause the timer, or more.
  • Can be used in controllers to check if a mob has a current timer set for encounters or other interactions.

Type of change

  • New feature

Perl

Example

sub EVENT_SAY {
	if ($text=~/#a/i) {
		my @timers = $client->GetTimers();
		my @zone_timers = $zone->GetTimers();

		my $timer_string = join(", ", @timers);
		quest::message(315, $timer_string);

		my $zone_timer_string = join(", ", @zone_timers);
		quest::message(315, $zone_timer_string);
	} elsif ($text=~/#b/i) {
		for (my $i = 0; $i < 10; $i++) {
			my $duration = (($i + 1) * 1);
			quest::message(315, "Setting timer $i to duration $duration.");
			$client->SetTimer($i, $duration);
			$zone->SetTimer($i, $duration);
		}
	}
}

Image

image

Lua

Example

function event_say(e)
	if e.message:findi("#a") then
		local timers = e.self:GetTimers()
		local zone_timers = eq.get_zone():GetTimers()

		local timer_string = table.concat(timers, ", ")
		eq.message(315, timer_string)

		local zone_timer_string = table.concat(zone_timers, ", ")
		eq.message(315, zone_timer_string)
	elseif e.message:findi("#b") then
		for i = 0, 9 do
			local duration = (i + 1) * 1
			e.self:SetTimer(tostring(i), duration)
			eq.get_zone():SetTimer(tostring(i), duration)
			eq.message(315, "Setting timer " .. tostring(i) .. " to duration " .. tostring(duration) .. ".");
		end
	end
end

Image

image

Checklist

  • I have tested my changes
  • I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
  • I own the changes of my code and take responsibility for the potential issues that occur

@Akkadius Akkadius merged commit 0a1df5b into master Aug 3, 2025
2 checks passed
@Akkadius Akkadius deleted the quest_api/gettimers_getpausedtimers branch August 3, 2025 00:17
@Akkadius Akkadius mentioned this pull request Aug 3, 2025
@joligario joligario mentioned this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants