Thread Tools Display Modes
10-03-16, 01:43 PM   #1
gomjabar
A Defias Bandit
Join Date: Oct 2016
Posts: 3
Add timer to function for macros

Im trying to change a function to add a timer that resets the variable step to 1 after 2 seconds. So far the only thing ive been able to add and still have it work is print(step). It needs to work in combat. This is what im working on:

StepFunction = [[
limit = limit or 1
if step == limit then
limit = limit % #macros + 1
step = 1
else
step = step % #macros + 1
end
]],
  Reply With Quote
10-03-16, 01:51 PM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
If you're trying to use this to make some sort of spell queue you can give up now. That is not possible, beyond what /castsequence can do.

If not, there are a couple of ways to do something like this. If you could elaborate what you're trying to do it would be easier to suggest the appropriate solution.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
10-03-16, 02:41 PM   #3
gomjabar
A Defias Bandit
Join Date: Oct 2016
Posts: 3
The addon Gnomesequencer will process this step fuction at the top of a macro import. Im trying to edit this import so that it will reset the value of step to 1 after a duration. Ive tried C_timer and onUpdate so far but they dont work. An import looks like this:

Sequences['Rip/FB2'] = {
StepFunction = [[
limit = limit or 1
if step == limit then
limit = limit % #macros + 1
step = 1
print(step)
else
step = step % #macros + 1
print(step)
end
]],
PreMacro = [[
/console Sound_EnableSFX 0
/cast [noform:2] !Cat Form
/cast [nostealth,nocombat] !Prowl
/targetenemy [noexists][dead]
/console autounshift 0
]],
"/castsequence reset=target Rake,null",
"/castsequence [nostealth,combat] reset=combat/30 Shred,Tiger's Fury",
"/castsequence [nostealth,combat] reset=combat/15 Shred,Shred,Savage Roar,Thrash,Rake,Shred,Shred,Rip,Thrash,Rake,",
"/castsequence [@focus,exists,nodead,combat][@player,combat] reset=12 Healing Touch",
"/castsequence [combat] reset=target Brutal Slash",
PostMacro = [[
/console autounshift 1
/console Sound_EnableSFX 1
]],
}
  Reply With Quote
10-04-16, 11:17 PM   #4
TimothyLuke
A Fallenroot Satyr
 
TimothyLuke's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 24
GS and GS-E Macros work in a very tight sandbox and don't have access to a lot of API functions like Timer.

The list of what you DO have access to is available Here
__________________
BattleNet: TimothyLuke#1860
WowLazyMacros/Curse/GitHub/WowInterface: TimothyLuke

Most Commonly Played Characters:
Huldrych@Dath'Remar
Draik@Nagrand
  Reply With Quote
10-05-16, 12:18 AM   #5
gomjabar
A Defias Bandit
Join Date: Oct 2016
Posts: 3
Thanks! This is what I needed to know.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Add timer to function for macros


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off