mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
on TEXT play sound #160482 27/09/06 04:50 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
I found this in the forum announce

I would like something similar but istead of announce TEXT to a different channel I want to play a sound (.wav file) when some user on a channel type a certain TEXT

something like
Code:
on 1:call me:*:#CHAN1: {
  if ($nick == billgates) { sound/ PlayThisSoundfile.wav $1- }
}  


I know this i completly wrong but I think youīll understand

billgates say "call me" in #CHAN-1
and
mom say "hello" in #CHAN-2

in booth cases I want to hear a soundfile played, but not when they or any other person say something.

Re: on TEXT play sound #160483 27/09/06 04:56 PM
Joined: Sep 2003
Posts: 261
S
Scorpwanna Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
Well syntax is ok on the sound line just take out the /

on *:TEXT:call me:#chan:


We don't just write the scripts, we put them to the test! (ScriptBusters)
Re: on TEXT play sound #160484 27/09/06 05:09 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
Thanks!

Is this correct to add more rules:

Code:
on *:TEXT:call me:#chan1: {
  if ($nick == billgates) { sound/ PlayThisSoundfile.wav $1- }
} 
on *:TEXT:hello:#chan2: {
  if ($nick == mom) { sound/ PlayThisSoundfile.wav $1- }
}

Re: on TEXT play sound #160485 27/09/06 05:54 PM
Joined: Sep 2003
Posts: 261
S
Scorpwanna Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
on text yourself crazy smile. I usually if i use on text for things, place everything under 1 like so

Code:
on *:text:*:#: {
  if ($chan == #chan1) {
    if ($nick == whoever) { 
      if (call me == $1-2) { do this }
    }
  }
  if ($chan == #chan2) { etc... }
}


We don't just write the scripts, we put them to the test! (ScriptBusters)
Re: on TEXT play sound #160486 27/09/06 07:07 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
What am I doing wrong? Iīt wont work

Code:
on *:text:*:#: {
  if ($chan == #chan1) {
    if ($nick == billgates) { 
      if (call me == $1-2) { sound PlayMe.wav $1- }
    }
  }
  if ($chan == #chan2) {
    if ($nick == mom) { 
      if (hello == $1-2) { sound PlayMe2.wav $1- }
    }

Re: on TEXT play sound #160487 27/09/06 07:40 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
I would try something like this:

Code:
on *:text:*:#:{
  if ($chan == #chan1) {
    if ($nick == billgates) {
      var %string = call me
      if (%string isin $2-) { splay song1.wav }
    }
  }
  elseif ($chan == #chan2) {
    if ($nick == mom) { 
      var %string = hello
      if (%string isin $2-) { splay song2.wav }
    }
  }
}


I tested this code, and it should work.
Just make sure that the sound that you want to play is in your sounds directory:
C:\Program Files\mIRC\Sounds\
for example.

Re: on TEXT play sound #160488 27/09/06 07:43 PM
Joined: Sep 2003
Posts: 261
S
Scorpwanna Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
Bad thing about isin is it matches any occurance of "call me". Use $1- if you use his. Though there are better ways to solve these examples are for beginners smile.


We don't just write the scripts, we put them to the test! (ScriptBusters)
Re: on TEXT play sound #160489 27/09/06 07:45 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
yeah, but only when billgates says it.
which is what he wanted I think.

Re: on TEXT play sound #160490 27/09/06 07:50 PM
Joined: Sep 2003
Posts: 261
S
Scorpwanna Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
True, billgates could say :hello there call me a small guy. or he could just say:call me. isin is good for that kind of matching. I was just basing what i showed him from his example of text frown.


We don't just write the scripts, we put them to the test! (ScriptBusters)
Re: on TEXT play sound #160491 27/09/06 08:03 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
Still nothing:(

Canīt understand whats wrong

note!
I use mirc in D:\Program Files\mIRC
and the .wav in D:\Program Files\mIRC\sounds

That should not matter right?

Re: on TEXT play sound #160492 27/09/06 08:07 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
No, that shouldn't matter.
Can you paste the code that you use?
The last time you pasted your code, you missed some brackets }

Also, rename the sound file, to a 1 word name like:
song.wav
I'm not sure if that makes a difference.

Also, make sure that you have this code only 1 time.
And there can be only one on:TEXT: event per script file.

Re: on TEXT play sound #160493 27/09/06 08:11 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
Still nothing:(

Canīt understand whats wrong

note!
I use mirc in D:\Program Files\mIRC
and the .wav in D:\Program Files\mIRC\sounds

That should not matter right?


Code:
on *:TEXT:*:#:{
if ($nick == whatevernick) && ($1-$2 == Call me) && ($len($1-) == 7) { splay $mircdirsounds\filename.wav }
}


So if $nick would == whatevernick and his text would be call me it would play the filename.wav in the SOUNDS dir

also a LENGHT checker to make sure only CALL ME should be there


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: on TEXT play sound #160494 27/09/06 08:21 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
This is what I have in tab "Remote"

Code:
 on *:text:*:#:{
  if ($chan == #chan1) {
    if ($nick == billgates) {
      var %string = call
      if (%string isin $1-) { splay notice.wav }
    }
  }
  elseif ($chan == #chan2) {
    if ($nick == mom) { 
      var %string = hello
      if (%string isin $1-) { splay notice.wav }
    }
  }
} 



Also, rename the sound file, so a 1 word name like:
DONE

Also, make sure that you have this code only 1 time:
DONE

And there can be only one on:TEXT: event per script file
DONE

Re: on TEXT play sound #160495 27/09/06 08:23 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Weird, that should work.
At least for me it does.

I presume you are sure that it is billgates in #chan1 saying call
and its mom in #chan2 saying hello

Well, I wouldn't know in that case.
The code works in any case, so that shouldn't be the problem.

Re: on TEXT play sound #160496 27/09/06 09:03 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Did you change #chan1 and #chan2 to the channels you want to use it in? You don't want to leave those as they are unless you're actually in #chan1 and #chan2.


Invision Support
#Invision on irc.irchighway.net
Re: on TEXT play sound #160497 27/09/06 09:20 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
Yes. in those channels
correct nicknames
correct messages
tried both $1- and $2-
changed .wav file to see if the problem was there both used long (100kb) and short (20kb)

what else have I done?
restart of mirc and pc


here is the funny part! it worked one time then it sudenly stop working again???

THIS IS THE EXACT CODE I HAVE
Code:
on *:text:*:#:{
  if ($chan == #chan1) {
    if ($nick == billgates) {
      var %string = call
      if (%string isin $1-) { splay notice.wav }
    }
  }
  elseif ($chan == #chan2) {
    if ($nick == mom) { 
      var %string = hello
      if (%string isin $1-) { splay notice.wav }
    }
  }
}   

Re: on TEXT play sound #160498 27/09/06 09:29 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
One more thing you could try, is just remove all the code from the remote file that you have.
Then go to File - New
Save the new remote file with a new name.
Paste the code again.
And try it again.

Re: on TEXT play sound #160499 27/09/06 09:43 PM
Joined: Sep 2006
Posts: 14
R
Ratoko Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2006
Posts: 14
I think I found where the problem begin

If I only use this itīs OK an working fine
Code:
 on *:text:*:#:{
  if ($chan == #chan1) {
    if ($nick == billgates) {
      var %string = call
      if (%string isin $1-) { splay notice.wav }
    } 



BUT! when i use the whole code itīs NOT working
Code:
on *:text:*:#:{
  if ($chan == #chan1) {
    if ($nick == billgates) {
      var %string = call
      if (%string isin $1-) { splay notice.wav }
    }
  }
  elseif ($chan == #chan2) {
    if ($nick == mom) { 
      var %string = hello
      if (%string isin $1-) { splay notice.wav }
    }
  }
}   

Re: on TEXT play sound #160500 27/09/06 09:57 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
I think I found where the problem begin

If I only use this itīs OK an working fine
Code:
 on *:text:*:#:{
  if ($chan == #chan1) {
    if ($nick == billgates) {
      var %string = call
      if (%string isin $1-) { splay notice.wav }
    } 



BUT! when i use the whole code itīs NOT working
Code:
on *:text:*:#:{
[color:red]if ($nick == billgates) && ($nick ison #chan1) {    [/color]
      if (call isin $1-) { splay notice.wav }
  }
[color:red]elseif ($nick == mom) && ($nick ison #channel2) { [/color]
      if (hello isin $1-) { splay notice.wav }
    }
}   


Btw i edited the code a little just above here

The problem i usee with that script is that IF $chan == CHAN1 and then else if $chan == chan2

well it should start by evaluatiing the nicknames first and at same time evaluating weather this nick is on channel 1 or 2

the code obviously wont work if mom ison channel 1 or if billgates ison #channel 2

but start by evaluating the $nicks in that method

as well has creating a var for the strings why not just use

if (word isin $1-) or if you need more then one word if (word word iswm $1-)

---

edited code to remove the uneccesary var

Re: on TEXT play sound #160501 27/09/06 10:15 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Yeah, I also like that new code better indead.
I originally added the variable, since I didnt get it to work when we started with detecting "call me" (two words).

But still, I don't think this will solve the problem, since the code I posted worked fine as well, although it was a little longer and contained an unneeded variable.

Page 1 of 3 1 2 3