mIRC Home    About    Download    Register    News    Help

Print Thread
if's with /play #226010 15/09/10 08:17 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
is it possible to use if's on the lines messaged to a channel using /play i.e. if $1 = Error set colour of line red?

or would I have to use $read?

Re: if's with /play [Re: firefox] #226011 15/09/10 08:29 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
You can use /play -a that will call the specified alias for each line with $1- containing the line.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: if's with /play [Re: Wims] #226014 15/09/10 09:16 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
ok so I did:
Code:
alias playclr {

  /msg #chan 9 $+ $1-

}

and then

/play -a playclr #chan test.txt
this makes it message

#chan $1- to the channel

if I change it to
Code:
alias playclr {

  /msg 9 $+ $1-

}
it sends msg to #chan but seems to colour the channel name and not $1-

[22:23:10] -> ** #chan test1
[22:23:11] -> ** #chan test2
[22:23:12] -> ** #chan test3

where am I going wrong?

edit: I haven't added the if yet just trying to get -a and colour working properly

Last edited by firefox; 15/09/10 09:23 PM.
Re: if's with /play [Re: firefox] #226015 15/09/10 09:32 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
The only thing you need to specify in the /play command is the alias name, use "/play -a playclr test.txt" with :
Code:
alias playclr {
 msg #chan 9 $+ $1-
}




Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: if's with /play [Re: Wims] #226016 15/09/10 09:42 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
thanks wims but that is giving me:

[22:37:29] <firefox> #chan test1
[22:37:30] <firefox> #chan test2
[22:37:31] <firefox> #chan test3

in colour - I don't want the word #chan to show in the msg

if I change it to msg 9 $+ $1-

it shows to others

[22:38:49] <firefox> test1
[22:38:50] <firefox> test2
[22:38:51] <firefox> test3

but not in colour

and gives me

[22:38:49] -> *#chan* test1
[22:38:50] -> *#chan* test2
[22:38:51] -> *#chan* test3

msg 9 $1-
gives me:

[22:41:36] -> ** #chan test1
[22:41:37] -> ** #chan test2
[22:41:38] -> ** #chan test3

which then leads to in status:

No such nick/channel
-
No such nick/channel
-
No such nick/channel
- (in colour)

Re: if's with /play [Re: firefox] #226020 15/09/10 11:06 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
try
Code:
/play -a playexample <chan or nick> test.txt

basic coloring:
Code:
alias playexample { msg $1 09 $+ $2- }

added if-condition:
Code:
alias playexample {
  if ($2 == Error) { msg $1 04 $+ $2- }
  else { msg $1 09 $+ $2- }
}

or shorter:
Code:
alias playexample { msg $1  $+ $iif($2 == Error,04,09) $+ $2- }

You may as well use $pnick in place of $1

Re: if's with /play [Re: Horstl] #226036 16/09/10 10:09 AM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
it works great thanks Horstl