delays explanation to a total beginner

Cromm said:
Eiredhel said:
I was always a little confused as to how to set up delays on it... But I'm not very savvy with this stuff at all, so that may be why... I read the manual and tried what it suggested and it didn't work. (this was about two months or so ago though)
Assuming you just mean "do something in 2.5 seconds" or something similar, you can do something as simple as this (in a function or trigger's script block):

setTimeout(function () {
     // Do something useful here //
     send_direct("em drops it to the flo'."); // Send a command to the game //     
     print("You just dropped it to the flo'.", "red"); // Print something locally (in red) //     
     run_function("apply_frost"); // Cause it's getting hot in here //    
}, 2500); // That's 2500 milliseconds, or 2.5 seconds //

Likewise, if you want to run something every 2.5 seconds, just do something like this:

var health_timer = setInterval(function () {
     // Check your current health, send a sip command if necessary, etc. //          
}, 2500);

Then, if you want to stop that function from running every 2.5 seconds, run:

clearInterval(health_timer);


Could someone please carefully explain this to a complete newbie. Do I just paste all of this in somewhere? I want to create a battle trigger that sends out a timed response while I work on other stuff. I am super green at all of this and just need delays on the Achaea HTML5 client explained in very basic terms. Thanks
Sign In or Register to comment.