The problem with this solution is that it doesn't take any account of how long userhost actually takes to return. It will always take 1 second before returning a value, no matter if userhost returned immediately or actually takes (say) 2 seconds.

In the former case, you're just sitting there waiting for a result you already have. In the latter case you get no result.

It's an OK workaround to the problem of not being able to do blocking calls in mIRC, but it's not what I'd call "nice" :|

In this case, I don't think there's much of an option. You could use a form of polling with a shorter sleep() until you get the result or reach an arbitrary timeout if you think the issues I mention above are important to you.

In other cases, you should really just wait on the raw reply (perhaps with a timeout set, too).

(Sorry - it's one of my bugbears - using timers and just crossing your fingers that the reply gets to you within that time. IM(NS)HO - very sloppy coding)