Delaying output to chat window

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

Post Reply
xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Delaying output to chat window

Post by xavram »

I was trying to come up with a way to set a delay between multiple broadcasts to the chat window, so that you could get something like...

Player needs to roll a 5 or better...
(pause for 2 seconds)
...and get a 4! Fails!

So I tried this

Code: Select all

[H:currentTime = json.get(getInfo("client"),"timeInMs")]
[h : currentPlus = sum(currentTime,700)]
[h:ok=0]
[broadcast("Start")]
[h,while (!ok), CODE:{
    [newTime = json.get(getInfo("client"),"timeInMs")]
    [if(currentPlus < newTime):ok=1]
}] 
[broadcast("Over!")]
2 things i noticed.
1. If I used a value greater than 700, I got an error. Not sure why in the world 700 would be threshold for this..
2. Instead of a 700 millisecond delay between the "Start" being broadcast and the "Over!" being broadcast, I got the delay when I first called the macro, but the Start/Over! get broadcast one right after the other, no delay.

Is there a way to achieve what I'm talking about? Thanks!


xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Re: Delaying output to chat window

Post by xavram »

Hmmm...I see the stuff related to defer in the execLink section, but I guess I don't understand it.

Any ideas why it would balk at a value greater than 700?

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Delaying output to chat window

Post by aliasmask »

xavram wrote:Hmmm...I see the stuff related to defer in the execLink section, but I guess I don't understand it.

Any ideas why it would balk at a value greater than 700?
Took me a second to think of why, but 700 is probably the time it takes that loop to go around 1000 times which is when it errors out of the loop. Using execlink and deferring creates a new execution thread and is a way to avoid the loop limit. The loop limit was recently increased in the newer build so I suspect you're still using an older version. Went from 1,000 to 10,000.

xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Re: Delaying output to chat window

Post by xavram »

haha, okay, that makes sense! I think I saw the post about the loop limit getting increased in one of the 1.4.x versions.

Post Reply

Return to “Macros”