mIRC Homepage
Posted By: noscriptskills Sound File Events Trigger Problem - 06/11/06 06:54 PM
Hi All,

I'm having a problem with a custom sounds dialog. Everything is working fine, with the exception of the actual events triggers. It appears as though the intended events aren't actually tiggering the sound files which are properly listed in the .ini file. Here's the current text that isn't working:

Code:
 
; ~~~ IRC Events ~~~

on *:OP:*: {
  if ($readini(FTCSounds.ini,Enabled,OP) == 1) && ($readini(FTCSounds.ini,Sounds,OP) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,OP) $+ "
}

on *:DeOP:*: {
  if ($opnick == $me) && ($readini(FTCSounds.ini,Enabled,DeOP) == 1) && ($readini(FTCSounds.ini,Sounds,DeOP) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,DeOP) $+ "
}

on *:HOP:*: {
  if ($hnick == $me) && ($readini(FTCSounds.ini,Enabled,HOP) == 1) && ($readini(FTCSounds.ini,Sounds,HOP) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,HOP) $+ "
}

on *:DeHOP:*: {
  if ($Hnick == $me) && ($readini(FTCSounds.ini,Enabled,DeHOP) == 1) && ($readini(FTCSounds.ini,Sounds,DeHOP) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,DeHOP) $+ "
}

on *:Voice:*: {
  if ($Vnick == $me) && ($readini(FTCSounds.ini,Enabled,Voice) == 1) && ($readini(FTCSounds.ini,Sounds,Voice) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Voice) $+ "
}

on *:DeVoice:*: {
  if ($Vnick == $me) && ($readini(FTCSounds.ini,Enabled,DeVoice) == 1) && ($readini(FTCSounds.ini,Sounds,DeVoice) != $null)  play " $+ $readini(FTCSounds.ini,Sounds,DeVoice) $+ "
}

on *:kick:*: {
  if ($knick == $me) && ($readini(FTCSounds.ini,Enabled,Kick) == 1) && ($readini(FTCSounds.ini,Sounds,Kick) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Kick) $+ "
}

on *:Ban:*: {
  if ($bnick == $me) || ($address($me,2) isin $banmask) {
    if ($readini(FTCSounds.ini,Enabled,Ban) == 1) && ($readini(FTCSounds.ini,Sounds,Ban) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Ban) $+ "
  }
}

on *:Whisper:*: {
  if ($bnick == $me) || ($address($me,2) isin $banmask) {
    if ($readini(FTCSounds.ini,Enabled,Whisper) == 1) && ($readini(FTCSounds.ini,Sounds,Whisper) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Whisper) $+ "
  }
}

on *:Connect: {
  if ($readini(FTCSounds.ini,Enabled,Connect) == 1) && ($readini(FTCSounds.ini,Sounds,Connect) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Connect) $+ "
}

on *:Disconnect: {
  if ($readini(FTCSounds.ini,Enabled,Disconnect) == 1) && ($readini(FTCSounds.ini,Sounds,Disconnect) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Disconnect) $+ "
}

on *:Join: {
  if ($readini(FTCSounds.ini,Enabled,Join) == 1) && ($readini(FTCSounds.ini,Sounds,Join) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,Join) $+ "
}


 


I know the sound files are otherwise recognized by the script because it has the ability to test each sound, and they work properly. However, when the triggering events occurs, the sounds don't play. If anyone can clue me in to why this code is not working, I'd sure appreciate it.

Thanks very much!
Posted By: Riamus2 Re: Sound File Events Trigger Problem - 06/11/06 10:34 PM
I'd do a little debugging, if I were you, because it looks okay from here...
Code:
on *:OP:*: {
  echo -a Enabled: $readini(FTCSounds.ini,Enabled,OP) -- Sound: $readini(FTCSounds.ini,Sounds,OP)
  if ($readini(FTCSounds.ini,Enabled,OP) == 1) && ($readini(FTCSounds.ini,Sounds,OP) != $null) splay " $+ $readini(FTCSounds.ini,Sounds,OP) $+ "
}


See what values you have there and make sure that you have 1 and a valid sound. Just have someone be opped and see if what's displayed.

Just a note... I'd really recommend {}'s... but it's up to you.

Example:
Code:
  if ($readini(FTCSounds.ini,Enabled,OP) == 1 && $readini(FTCSounds.ini,Sounds,OP) != $null) { splay " $+ $readini(FTCSounds.ini,Sounds,OP) $+ " }


Notice that I also adjusted the ()'s so there is one set around the entire IF and none around the individual $readini's. Your way isn't wrong, but it's better imho to write scripts following standard formatting rules. smile
Posted By: deegee Re: Sound File Events Trigger Problem - 06/11/06 10:45 PM
Plus save on a file read by reusing the second $readini()...
Code:
  if ($readini(FTCSounds.ini,Enabled,OP) == 1 && $readini(FTCSounds.ini,Sounds,OP)) { splay $+(",$v1,") }
Posted By: Riamus2 Re: Sound File Events Trigger Problem - 06/11/06 10:49 PM
Good point. Just to make a note about $v1... it is relatively new. If you want your script to be compatible with versions older than 6.14 (I think $v1 was added somewhere around then, though it may be a different version), then you wouldn't want to use $v1. It's up to you how compatible you'd like it to be. Most people use 6.14 or higher, so it shouldn't be an issue for the majority of users. I just thought I'd point it out so you don't wonder why it won't work for someone.
Posted By: deegee Re: Sound File Events Trigger Problem - 06/11/06 10:54 PM
New? C'mon its over two years since $v1 was added. laugh
I also ONLY use up to date version and script for the same, if a user has an old version they should say so! wink
Posted By: Riamus2 Re: Sound File Events Trigger Problem - 06/11/06 11:53 PM
Yeah, I know. Some people do still use older versions because they really like a particular script that doesn't work on newer versions. Just wanted to throw it out there. I also use the latest version of mIRC. But I do tend to weigh in the compatibility issue when deciding whether to use $v1 or not. For a script that I *really* want to have available for everyone, I won't use it. For any that I don't care so much about, I will use it. smile

Besides, not using $v1 doesn't slow things down enough to matter unless you're doing it a LOT in a script.
Posted By: noscriptskills Re: Sound File Events Trigger Problem - 07/11/06 12:11 AM
Thank you both for your help with this. I used the following code:

Code:
 

; ~~~ IRC Events ~~~

on *:OP:*: {
  if ($readini(FTCSounds.ini,Enabled,OP) == 1 && $readini(FTCSounds.ini,Sounds,OP)) { splay $+(",$v1,") }
}


 


However, it still doesn't work. I know the sounds all work and the script plays the correct sound from the .ini when I click on the sound test button. It just doesn't seem to trigger from the event.

In the past I have used the following code to trigger sounds:

Code:
 

on 1:op:#: /splay op.wav

 


I was wondering if the on 1:op:#: part could be the problem.

Thanks again!
Posted By: deegee Re: Sound File Events Trigger Problem - 07/11/06 02:11 AM
No that shouldnt make any difference.
type (copy/paste) this...
//echo -a $readini(FTCSounds.ini,Enabled,OP) -- $readini(FTCSounds.ini,Sounds,OP)
and see what the returned info is

You can also try these
//echo -a $isfile($readini(FTCSounds.ini,Sounds,OP))
and
//splay $qt($readini(FTCSounds.ini,Sounds,OP))
Posted By: Riamus2 Re: Sound File Events Trigger Problem - 07/11/06 02:59 AM
Just what I said to try as well (basically). smile
Posted By: noscriptskills Re: Sound File Events Trigger Problem - 07/11/06 05:22 AM
Hi Again,

OK, I tried all three, and here are the results. The first one, which was:

Code:
 

//echo -a $readini(FTCSounds.ini,Enabled,OP) -- $readini(FTCSounds.ini,Sounds,OP) 

 


Resulted in NO sound and the following on screen message: -- C:\Program Files\FTC Chat Commander v.6.2\sounds\op.wav

The second, which was:

Code:

//echo -a $isfile($readini(FTCSounds.ini,Sounds,OP)) 

 


resulted in NO sound and the following on screen message: $true

The third and final one, which was:

Code:

//splay $qt($readini(FTCSounds.ini,Sounds,OP))

 


resulted in the correct sound and NO onscreen message.

Does any of this give you a clue as to what's not working properly?

Thank you again for all your help!
Posted By: deegee Re: Sound File Events Trigger Problem - 07/11/06 05:40 AM
Quote:
Hi Again,

OK, I tried all three, and here are the results. The first one, which was:

Code:
//echo -a $readini(FTCSounds.ini,Enabled,OP) -- $readini(FTCSounds.ini,Sounds,OP)  


Resulted in NO sound and the following on screen message: -- C:\Program Files\FTC Chat Commander v.6.2\sounds\op.wav

OK, that doesn't show anything for the first readini call - $readini(FTCSounds.ini,Enabled,OP)
Check the ini file for that setting, either the section name or item name is wrong or its not set.
Your script relies on it being set to "1" (without quotes)
Posted By: noscriptskills Re: Sound File Events Trigger Problem - 07/11/06 06:32 AM
Hi Again,

I checked the .ini and you're right it wasn't showing anything under enabled. So I reset each of the sounds and this is what the .ini says now:

Code:
  

[Sounds]
OP=C:\Program Files\FTC Chat Commander v.6.2\sounds\op.wav
DeOP=C:\Program Files\FTC Chat Commander v.6.2\sounds\deop.wav
HOP=C:\Program Files\FTC Chat Commander v.6.2\sounds\op.wav
DeHOP=C:\Program Files\FTC Chat Commander v.6.2\sounds\deop.wav
Voice=C:\Program Files\FTC Chat Commander v.6.2\sounds\whisper.wav
Kick=C:\Program Files\FTC Chat Commander v.6.2\sounds\kick.wav
Whisper=C:\Program Files\FTC Chat Commander v.6.2\sounds\ChatWhsp.wav
Connect=C:\Program Files\FTC Chat Commander v.6.2\sounds\connect.wav
Disconnect=C:\Program Files\FTC Chat Commander v.6.2\sounds\dis.WAV
Join=C:\Program Files\FTC Chat Commander v.6.2\sounds\Join.wav
[Enabled]
OP=1
DeOP=1
HOP=1
DeHOP=1
Voice=1
DeVoice=1
Kick=1
Ban=1
Whisper=1
Connect=1
Disconnect=1
Join=1



In addition, now the first one shows: 1 -- C:\Program Files\FTC Chat Commander v.6.2\sounds\op.wav

However, even with the .ini saying "1" for each of the sounds, there is no sound.

Thanks again for all your help smile
Posted By: noscriptskills Re: Sound File Events Trigger Problem - 07/11/06 06:46 AM
WOW!

My error. I went ahead and changed back to the code:

Code:
  
if ($readini(FTCSounds.ini,Enabled,OP) == 1 && $readini(FTCSounds.ini,Sounds,OP)) { splay $+(",$v1,") }



and it worked!

Thank you VERY much, very much!
Posted By: deegee Re: Sound File Events Trigger Problem - 07/11/06 06:58 AM
Good to hear smile


One other error i see though is
on *:Join:#: {
^^ is missing the #:
Posted By: noscriptskills Re: Sound File Events Trigger Problem - 07/11/06 06:59 AM
Ooops,

Op works, but the others still don't work. Is there something else I need to change on each of the sounds? Here's what I have now:

Code:

; ~~~ IRC Events ~~~

on *:OP:*: {
  if ($readini(FTCSounds.ini,Enabled,OP) == 1 && $readini(FTCSounds.ini,Sounds,OP)) { splay $+(",$v1,") } 
}

on *:DeOP:*: {
  if ($readini(FTCSounds.ini,Enabled,DeOP) == 1 && $readini(FTCSounds.ini,Sounds,DeOP)) { splay $+(",$v1,") }
}

on *:HOP:*: {
  if ($readini(FTCSounds.ini,Enabled,HOP) == 1 && $readini(FTCSounds.ini,Sounds,HOP)) { splay $+(",$v1,") }
}

on *:DeHOP:*: {
  if ($readini(FTCSounds.ini,Enabled,DeHOP) == 1 && $readini(FTCSounds.ini,Sounds,DeHOP)) { splay $+(",$v1,") }
}

on *:Voice:*: {
  if ($readini(FTCSounds.ini,Enabled,Voice) == 1 && $readini(FTCSounds.ini,Sounds,Voice)) { splay $+(",$v1,") }
}

on *:DeVoice:*: {
  if ($readini(FTCSounds.ini,Enabled,DeVoice) == 1 && $readini(FTCSounds.ini,Sounds,DeVoice)) { splay $+(",$v1,") }
}

on *:kick:*: {
  if ($readini(FTCSounds.ini,Enabled,kick) == 1 && $readini(FTCSounds.ini,Sounds,kick)) { splay $+(",$v1,") }
}

on *:Ban:*: {
  if ($bnick == $me) || ($address($me,2) isin $banmask) {
    if ($readini(FTCSounds.ini,Enabled,Ban) == 1 && $readini(FTCSounds.ini,Sounds,Ban)) { splay $+(",$v1,")  }
}

  on *:Whisper:*: {
    if ($bnick == $me) || ($address($me,2) isin $banmask) {
      if ($readini(FTCSounds.ini,Enabled,Whisper) == 1 && $readini(FTCSounds.ini,Sounds,Whisper)) { splay $+(",$v1,")  }
    }
  }

  on *:Connect: {
    if ($readini(FTCSounds.ini,Enabled,Connect) == 1 && $readini(FTCSounds.ini,Sounds,Connect)) { splay $+(",$v1,") }
  }

  on *:Disconnect: {
    if ($readini(FTCSounds.ini,Enabled,Discount) == 1 && $readini(FTCSounds.ini,Sounds,Discount)) { splay $+(",$v1,") }
  }

  on *:Join: {
    if ($readini(FTCSounds.ini,Enabled,Join) == 1 && $readini(FTCSounds.ini,Sounds,Join)) { splay $+(",$v1,") }
  }


 


Sorry about all this confusion, but I am really lost and appreciate all your help. smile

Thanks again
Posted By: deegee Re: Sound File Events Trigger Problem - 07/11/06 07:06 AM
And a missing brace in the ban event
Code:
on *:Ban:*: {
  if ($bnick == $me) || ($address($me,2) isin $banmask) {
    if ($readini(FTCSounds.ini,Enabled,Ban) == 1 && $readini(FTCSounds.ini,Sounds,Ban)) { splay $+(",$v1,")  }
  }
[color:red]}[/color]
on *:Whisper:*: {
  if ($bnick == $me) || ($address($me,2) isin $banmask) {
    if ($readini(FTCSounds.ini,Enabled,Whisper) == 1 && $readini(FTCSounds.ini,Sounds,Whisper)) { splay $+(",$v1,")  }
  }
}

on *:Connect: {
  if ($readini(FTCSounds.ini,Enabled,Connect) == 1 && $readini(FTCSounds.ini,Sounds,Connect)) { splay $+(",$v1,") }
}

on *:Disconnect: {
  if ($readini(FTCSounds.ini,Enabled,Discount) == 1 && $readini(FTCSounds.ini,Sounds,Discount)) { splay $+(",$v1,") }
}

on *:Join:[color:red]#:[/color] {
  if ($readini(FTCSounds.ini,Enabled,Join) == 1 && $readini(FTCSounds.ini,Sounds,Join)) { splay $+(",$v1,") }
}
Posted By: deegee Re: Sound File Events Trigger Problem - 07/11/06 07:09 AM
Hm, reading more, seeing more.. There is no "on whisper" event wink
on hop/on dehop should be 'on help' and 'on dehelp'
Posted By: noscriptskills Re: Sound File Events Trigger Problem - 07/11/06 07:55 AM
Yep, it's all working well now.

Thank you VERY, VERY much. You're terrific!
© mIRC Discussion Forums