mIRC Home    About    Download    Register    News    Help

Print Thread
#154067 26/07/06 06:48 PM
Joined: Mar 2003
Posts: 611
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 611
How about being able to use OR in event parsing, for example:

on 1:text:!update:#mirc: || on 1:input:!update:#mirc: { dostuff }

...or some variation

this would be good for long codes or existing scripts that would be a pain to split into aliases and parameter passed from each event.

I realise there might be some small conflicts with identifiers such as $nick in that example (if text $nick would be filled but if input it would need to be $me)

maybe i'm just being lazy! lol

btk

Last edited by billythekid; 26/07/06 06:49 PM.

billythekid
#154068 26/07/06 08:19 PM
D
DaveC
DaveC
D
on 1:text:!update:#mirc:{ dostuff.alias $1- }
on 1:input:!update:#mirc: { dostuff.alias $1- }
alias -l dostuff.alias { dostuff }

2 extra lines is to hard?

IMO If you have things that mihght get called from multiple places then u should use alias's. An alias even allows you to test them to see if they work. And allows you to overcome problems with things like $nick and $me (PS in ON INPUT $nick is actually filled out with your nick, but lets assume its not for arguements sake) You can do this.
Code:
on 1:text:!update:#mirc:{ dostuff.alias $nick $1- }
on 1:input:!update:#mirc: { dostuff.alias $me $1- }
alias -l dostuff.alias {
  var %nick = $1
  tokenize 32 $2-
  dostuff | ; using %nick and not $nick
}

^ This is also good for testing as it mans u can call the alias using any $1 to pass it the NICK and thus emulate people in channels etc and see how the script reacts.

Quote:
maybe i'm just being lazy!

just maybe smile

#154069 26/07/06 10:54 PM
Joined: Mar 2003
Posts: 611
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 611
yeah i totally agree with you that parameter passing is a far better way to code than doing everything twice.

Quote:
just maybe smile


yeah, thought so... lol

btk


billythekid
#154070 27/07/06 08:05 PM
Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
Alternative to DaveC's method would be signals.

Code:
on *:TEXT:!*:#mirc: { .signal command $chan $nick $1- }
on *:INPUT:#mirc: { if (!* iswm $1-) .signal command $active $me $1- }

on *:SIGNAL:command:{
  var %source = $1, %target = $2
  /tokenize 32 $3-

  if ($1 == !update) { ... }
}


Link Copied to Clipboard