mIRC Home    About    Download    Register    News    Help

Print Thread
#235431 17/12/11 11:40 AM
Joined: Dec 2011
Posts: 4
U
Uragano Offline OP
Self-satisified door
OP Offline
Self-satisified door
U
Joined: Dec 2011
Posts: 4
Hello,

it would be very helpfull to indroduce a comand /wait seconds
so when it is necessary in a script you can have a "pause".

I know there is a similar comand... /timer but I think /wait is a great idea.

P.S: Sorry for my english.

Uragano #235434 17/12/11 03:51 PM
Joined: Feb 2004
Posts: 79
M
Babel fish
Offline
Babel fish
M
Joined: Feb 2004
Posts: 79
How do I Pause a script. Will you can't. But there is a work around.
You need to use a alias. And pass the info to that alias on a timer.

Example 1: I wish to see if the person is still in the channel 5 sec
after they say something

The timer passes on the users nick as $1 and the channels name as $2


;Remote
on *:text:*:#: {
.timer 1 5 usercheck $nick #
}

;Alias
userscheck {
if ($1 ison $2) {
commands
}
}



Example 2: You wish to pass on the name of the person the channel And what the person sead.

The timer passes on the users nick as $1 and the channels name as $2 And the Text is $3-

;Remote
on *:text:*:#: {
.timer 1 5 usersecho $nick # $1-
}

;Alias
usersecho {
if ($1 ison $2) {
echo 12 $2 $1 sead $3-
}
}

I hope this helps you out with adding a pause in your scripts.

You should note the rest of the script will fire. You are not halting anything just delaying it.


Modoc Efnet @#mIRC


My point is, BLACK HOLE GENERATORS ARE NOT SAFE!
Modoc #235437 17/12/11 06:43 PM
Joined: Dec 2011
Posts: 4
U
Uragano Offline OP
Self-satisified door
OP Offline
Self-satisified door
U
Joined: Dec 2011
Posts: 4
Thanks for the examples.
Well, I use alias but in many cases I need "really" to pause the script.
There isn't always the possibility to use aliases to work around the problem...

Sometimes, imho, I think it is much pretty to have a command like /wait 5 so that the script waits 5 seconds and then go on....

Anyway thanks you again for answering. wink

Uragano #235438 17/12/11 07:16 PM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
To start off, mIRC is a single process single threaded program. If a command such as /wait were introduced then one of two things would occur:

A: mIRC would save the state prior to waiting, remember where in the script mIRC is, then start an internal timer to pick up where it left off when the timer expires. Essentially the timer/alias approach but done internally.

or

B: mIRC would freeze for the duration of the /wait, sort of like what happens in a very long loop.

Neither is a good option, 'A' can be scripted, and 'B' having the fault of mIRC freezing

Last edited by FroggieDaFrog; 17/12/11 07:17 PM.

I am SReject
My Stuff
Uragano #235440 17/12/11 10:08 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
You don't "really" need to pause the script. You most likely need a timer, but you just don't understand how a /wait would translate into a timer command. There *is* always a possibility to use aliases to workaround this waiting problem.

For instance:

Code:
alias foo {
  command1
  wait 5
  command2
}


Would just be:

Code:
alias foo {
  command1
  .timer 1 5 command2
}


If you had more than one command, it would be:

Code:
alias foo {
  command1
  .timer 1 5 foo_continue
}

alias foo_continue {
  command2
  command3
  command4
  ...
}


As shown, there is always a way to replace a hypothetical /wait with /timers. You most likely want to do this in all cases anyway, since it allows mIRC to process events while "waiting". Something a /wait could never do.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Modoc #244692 20/03/14 05:56 PM
Joined: Mar 2014
Posts: 3
W
Self-satisified door
Offline
Self-satisified door
W
Joined: Mar 2014
Posts: 3
You can make a timer of your own and call it as you like. Be careful though; test your scripts thoroughly to make sure this doesn't conflict with other scripts that might be running. It will stop the normal processing of some events like ON CONNECT. mIrc does not join your auto join channels until any ON CONNECT scripts are finished.

This Alias accepts time in milliseconds
e.g. ]Wait 1000] will wait for 1 second before returning to the script.

Code:
Remote:
Alias Wait {
  Var %compairTime = $uptime(mirc) + $1
  While ($uptime(mirc) < %compairTime) {
  }
  Return $null
}


Link Copied to Clipboard