mIRC Homepage
Posted By: jizzy /when - 06/10/06 03:07 AM
Not sure how hard this would be to implement but an awsome addition to the scripting language would be /when for example.
on *:connect:when ($me ison #test) msg chanop op #test $me
or a better way would be to use it as an event hander
when:$me ison #test:msg chanop op #test $me
Imagine the possibilities.
Posted By: darkrift Re: /when - 06/10/06 03:12 PM
what about a simple "on join" with the "me" prefix and an if $network == network ...
Posted By: jaytea Re: /when - 06/10/06 09:11 PM
you mean a 'when' statement that triggers something internally that will react when a specified event occurs? isn't that what mirc's existing events already do? laugh i really think this falls under the category of abstract ideas that add pretty much nothing useful to mirc's functionality
Posted By: cold Re: /when - 07/10/06 06:58 PM
jizzy's example is perfectly replaceable by mIRC's ON JOIN event, but his suggestion looks to me more like the temporary events in jIRCii (http://jirc.hick.org):
Code:
alias j
{
   if ($1 eq "#floods")
   {
      call("/msg JakieChan dude, what is the key to #floods?");
      wait privmsg
      {
         call("/join #floods $1");
      }
   }
   else
   {
      call("/join $1-");
   }
}


Edit: providing some info on the code above (from http://jirc.hick.org/jirc/tutorial.prl?scriptjirc):
In the above example the alias j is declared. The alias checks to see if I'm trying to join the channel #floods. If I am it messages a friend of mine asking for the key. When he responds (presumably with the key), jIRCii joins the channel.

Event specific variables from when the temp listeners was declared are not carried over to temporary events. They have there own set of variables just like any other event. Nothing inside of the { } curly braces is evaluated until the event occurs. As such watch out for using variables outside of a wait command and then expecting it to be available or be the same thing inside of it.



The "wait" command is something that I'd like to see in mIRC. To do something like the above, mIRC currently needs the use of 2 or more events and temporary variables to control them.
Posted By: jizzy Re: /when - 07/10/06 11:31 PM
Yes ok bad example, say for example I want to trigger something when mIRC is minimized:
Code:
when:$appstate == minimized:do this

This would save setting a timer to check this every 200ms or whatever.
Posted By: DaveC Re: /when - 08/10/06 02:42 AM
So its watch point events your meaning, i dont see a problem with that if its implementable.
Posted By: Om3n Re: /when - 08/10/06 04:02 AM
Didn't see the point when you first posted with an example in part of the event declaration, didn't make sense and wasn't something that couldn't already be done.

However after you gave a better example i like the idea, if would prove very useful for mirc to trigger any appropriate 'when' declarations at the point that the var/identifier/etc is changed, and as you said would make some things that usually require timers much easier.

a timer that calls an alias every xx minutes/etc then performs some tasks or messages could be made much simpler with something like when:$sometimedateidentifier // %varwithdelay:commands
of corse thats a simple use, but this type of thing would also avoid the need to start/stop/restart such timers.

a command (like /timers) to list these type of binds would be useful also
Posted By: cold Re: /when - 08/10/06 07:59 AM
I thought you were talking about something more IRC-related (just like the 'wait' suggestion in my reply), but now that you've come with a better example, I'm all for it.
Posted By: Mpdreamz Re: /when - 08/10/06 10:16 AM
awesome request definatly supporting this.
© mIRC Discussion Forums