Mage's might wait

Codecombat does not provide the time module, and Mages’ Might does not provide the .wait() function.

CodeCombat intercepts your while loops and artifically adds a one-tick delay between iterations. That’s why the code forever: do nothing runs fine.

To wait time, just cycle through a while-true loop doing nothing, and the one-tick delays add up. You can either do this in your main loop as JWH suggests or with a utility function to wait inline:

// JS
function delay(ticks) {
  while (true)
    if (!(ticks --))
      break;
}