Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Can i set the 'timer' with lua?

Featured Replies

Hey all! Is there any way that i can set the "timer" for an ability with lua?
Example: I want to be able to change the timer on steady shot, so it matches gun/bow/crossbow speed. Instead of having to adjust the Class Profile, i'd like to make it so you can set your speed with lua. Now this can be edited in many ways an example could be if i set the timer as a variable: timer = WeaponSpeed

Then one would be able to change the weapon speed in-game with /run WeaponSpeed = 3.5

CS rotation only perhaps. Some kind of pseudo code ( to prevent double cast of immolate in this example )
 

public long immolate_StartTime;
public bool immolate_ResetTimer = true;
public bool immolate_CanCast = true;
public long immolate_Time = 1500;
.....
wManager.wManagerSetting.CurrentSetting.EventsLuaWithArgsWaitTime = 1;
EventsLuaWithArgs.OnEventsLuaWithArgs += (id, args) =>
{
if (id == wManager.Wow.Enums.LuaEventsId.UNIT_SPELLCAST_START)
{
if (args.Count >= 2 && args[0] == "player" && args[1] == "Immolate")
{
if (immolate_ResetTimer == true)
{
immolate_StartTime = GetTime();
immolate_ResetTimer = false;
}
}

}

if ((GetTime() - immolate_StartTime) > immolate_Time)
{
immolate_CanCast = true;
immolate_ResetTimer = true;
}
else
{
immolate_CanCast = false;
}

public long GetTime()
{
long startTick = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
return startTick;
}

In this example the immolate will be casted again only after 1500 ms ( and this is preventing to overcasting ) To check when something start and count the time to push the event again. Well. IDK :) Or maybe its not about that at all :)

  • Author
3 minutes ago, forerun said:

CS rotation only perhaps. Some kind of pseudo code ( to prevent double cast of immolate in this example )
 


public long immolate_StartTime;
public bool immolate_ResetTimer = true;
public bool immolate_CanCast = true;
public long immolate_Time = 1500;
.....
wManager.wManagerSetting.CurrentSetting.EventsLuaWithArgsWaitTime = 1;
EventsLuaWithArgs.OnEventsLuaWithArgs += (id, args) =>
{
if (id == wManager.Wow.Enums.LuaEventsId.UNIT_SPELLCAST_START)
{
if (args.Count >= 2 && args[0] == "player" && args[1] == "Immolate")
{
if (immolate_ResetTimer == true)
{
immolate_StartTime = GetTime();
immolate_ResetTimer = false;
}
}

}

if ((GetTime() - immolate_StartTime) > immolate_Time)
{
immolate_CanCast = true;
immolate_ResetTimer = true;
}
else
{
immolate_CanCast = false;
}

public long GetTime()
{
long startTick = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
return startTick;
}

In this example the immolate will be casted again only after 1500 ms ( and this is preventing to overcasting ) To check when something start and count the time to push the event again. Well. IDK :)

Thank you for the quick answer!
If i use lua script to cast my spell with SpellInfo, couldn't i in theory also use the GetTime in lua to achieve this? :)

if vUAflag==nil then vUAflag=0 end; 
-- If we're CURRENTLY casting UA and the timestamp isn't already set...
if ({UnitCastingInfo("player")})[1]=="Unstable Affliction" and vUAts==nil then 
	-- Record that UA is being cast and record the time at which we observed the ongoing cast.
	-- Setting the flag to 1 will prevent UA from being cast again.
	vUAflag=1 vUAts=GetTime() 
end;
-- If the flag is set...but the time at which it was set was more than 2 seconds ago...
if vUAflag==1 and GetTime()-vUAts>2 then 
	-- Reset the flag and timestamp to allow UA again.
	vUAflag=0 vUAts=nil 
end

Ripped example - here you see how to cast Unstable Affliction when the time difference between start and now is > 2.

If vUaFlag=0 then cast

  • Author
6 minutes ago, forerun said:

if vUAflag==nil then vUAflag=0 end; 
-- If we're CURRENTLY casting UA and the timestamp isn't already set...
if ({UnitCastingInfo("player")})[1]=="Unstable Affliction" and vUAts==nil then 
	-- Record that UA is being cast and record the time at which we observed the ongoing cast.
	-- Setting the flag to 1 will prevent UA from being cast again.
	vUAflag=1 vUAts=GetTime() 
end;
-- If the flag is set...but the time at which it was set was more than 2 seconds ago...
if vUAflag==1 and GetTime()-vUAts>2 then 
	-- Reset the flag and timestamp to allow UA again.
	vUAflag=0 vUAts=nil 
end

Ripped example - here you see how to cast Unstable Affliction when the time difference between start and now is > 2.

If vUaFlag=0 then cast

Perfect! Thank you so much! <3

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.