mIRC Home    About    Download    Register    News    Help

Print Thread
/when #161345 06/10/06 03:07 AM
Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
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.


If only women came with popup menus and online help.
Re: /when #161346 06/10/06 03:12 PM
Joined: Oct 2004
Posts: 24
D
darkrift Offline
Ameglian cow
Offline
Ameglian cow
D
Joined: Oct 2004
Posts: 24
what about a simple "on join" with the "me" prefix and an if $network == network ...


the way it's supposed to be !

UnderNet #scripting - #mircscripting
Re: /when #161347 06/10/06 09:11 PM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: /when #161348 07/10/06 06:58 PM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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.

Last edited by cold; 07/10/06 07:28 PM.
Re: /when #161349 07/10/06 11:31 PM
Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
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.


If only women came with popup menus and online help.
Re: /when #161350 08/10/06 02:42 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
So its watch point events your meaning, i dont see a problem with that if its implementable.

Re: /when #161351 08/10/06 04:02 AM
Joined: Jul 2003
Posts: 655
Om3n Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
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


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Re: /when #161352 08/10/06 07:59 AM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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.


* cold edits his posts 24/7
Re: /when #161353 08/10/06 10:16 AM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
awesome request definatly supporting this.


$maybe