Maptool Animations

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Maptool Animations

Post by aliasmask »

I guess what I meant to say was not a delay before animations but between animations. So, there is no need of a delay before the animation begins. When creating the macro to run, you can't use currentToken especially if you're trying to apply the animation to unowned tokens. That's why I used getSelected. Of course the way I wrote it, it would only effect one token, but you can toss a loop in there to have it work for multiple tokens selected.

The blink rate is controlled by the thisSecond where 1000 is 1 second and 100 is 10 times per second, which I find to be way to fast for clients to ever see. All they see is the token turning off in the beginning and on at the end of timer.

Code: Select all

[H: time = json.get(getInfo("client"),"timeInMs")]
[H: endTime = 3000]
[H, if(json.isEmpty(macro.args)), code: {
   [H: startTime = time]
   [H: lastSecond = 0]
   [H: ids = getSelected()]
};{
   [H: startTime = getStrProp(macro.args,"startTime")]
   [H: lastSecond = getStrProp(macro.args,"lastSecond")]
   [H: ids = getStrProp(macro.args,"ids")]
}]
[H: elapsedTime = time - startTime]
[H: thisSecond = floor(elapsedTime/500)]
[H, foreach(id,ids), code: {
   [H, if(thisSecond > lastSecond), code: {
      [H: setVisible(1 - getVisible(id),id)]
      [H: setState("Hidden",1 - getState("Hidden",id),id)]
   };{}]
}]
[H, if(elapsedTime < endTime), code: {
   [H: args = strformat("startTime=%{startTime};lastSecond=%{thisSecond};ids=%{ids}")]
   [H: link = macroLinkText("blink@this","none",args)]
   [H: execLink(link,1)]
};{
   [H, foreach(id,ids), code: {
      [H: setVisible(1,id)]
      [H: setState("Hidden",0,id)]
   }]
}]
 

User avatar
emirikol
Dragon
Posts: 708
Joined: Sun Jan 13, 2008 5:52 pm
Location: Lakewood, CO North America
Contact:

Re: Maptool Animations

Post by emirikol »

This is exceptionally cool!


jh
Yes, I'm a chiropractor. Gamer fitness at Hafner Chiropractic in Lakewood, CO: http://www.HafnerChiropractic.com


Post Reply

Return to “Macros”