Short answer: Yes, but it requires using timers or com statements and is a bit annoying to do correctly.

Longer answer: I'm only going to go over the timer method here. Below this I'll give you a snippet for /sleep which is incredibly handy, but shouldn't be used if it can be avoided.

Note: While you can do this with any key, you'd need to either use a DLL or a PicWin to work with non-function keys.

Code:
Alias F5 { set %var 1 }

Alias CheckKeyPress {
if %var == 1 { unset %var | Do Stuff here }
else { .timerCKP 1 1 CheckKeyPress }
}


This won't do exactly what you want, but it'll be close. Basically, the alias will call itself one a second until you hit F5. Upon hitting F5 it will do whatever command you tell it to.

The issue here is that it isn't instant. If you press F5, there is up to a second of lag before the command you want to happen happens.

If it need to be instant (or close to it) you can use /timerCKP -m 1 1 which will use milliseconds instead. This is naturally more CPU intensive (but most computers build in the past few years can handle it with ease).

Enjoy.

Edit: forgot to give the /sleep snippet. (I did not create this, so no credit goes to me.)

Code:
/sleep {
  var %a = $ticks $+ .wsf
  write %a <job id="js"><script language="jscript">WScript.Sleep( $+ $$1 $+ );</script></job>
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) }
  .remove %a
}


Usage: /sleep n (where n is the number of milliseconds you want the script to "sleep" for.)

When you use /sleep, Mirc will stop the execution of the current script and return control to the CPU. After the sleep ends, the CPU will go back to processing the rest of the script.

Code:
alias TestSleep {
echo -a Pausing for 5 seconds
sleep 5000
echo -a Unpaused.
}


Its VERY handy to use, though timers can generally be used to the same effect.

Last edited by Thrull; 28/09/09 11:42 AM.

Yar