mIRC Home    About    Download    Register    News    Help

Print Thread
#135566 13/11/05 04:21 PM
Joined: Mar 2005
Posts: 14
T
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2005
Posts: 14
How can I make a script, which checks the first letter of a joining user's nickname and accordingly to the first letter of the nickname starts a sound via /splay? Example: If a user's nickname starts with F, /splay should start a .wav which says "F".

Any idea?

#135567 13/11/05 05:43 PM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
Code:
on *:JOIN:#channelnamehere: {
  if ($left($nick,1) == a) { splay filenamehere }
}



there are always more advanced scripts to do this with but this will give you an idea


If it ain't broken, don't fix it!
#135568 13/11/05 06:06 PM
Joined: Mar 2005
Posts: 14
T
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2005
Posts: 14
Okay, thanks. And how can I combine two scripts of that kind, so that mIRC "reads" the first three letters of the nickname? Example: User Tilvaltar joins the channel, and mirc tells me T, I, L using the /splay command.

#135569 13/11/05 06:27 PM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
given that each sound file is named '<char>.wav' e.g. a.wav:

Code:
on *:JOIN:#channelnamehere: {
  var %i = 0
  while ((%i &lt; 3) &amp;&amp; (%i &lt; $len($nick))) {
    if ($mid($nick,%i,1) isalpha) { splay $+(",folder of the wav files,$v1,.wav") | inc %i }
  }
}


If it ain't broken, don't fix it!
#135570 13/11/05 06:47 PM
Joined: Mar 2005
Posts: 14
T
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2005
Posts: 14
Hmm, it doesn't work. I have 26 .wav files like a.wav, b.wav, c.wav in the mirc\sounds directory. How must I change "folder of the wav files"? What about the commas?

Last edited by Tilvaltar; 13/11/05 06:48 PM.
#135571 14/11/05 07:01 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On !*:Join:#: {
  if ($len($nick) &gt;= 3) {
    var %x = 1
    while (%x &lt;= $len($nick)) {
      .timer 1 %x splay $+($mid($nick,%x,1),.wav)
      inc %x
    }
  }
}


-Andy

#135572 14/11/05 08:17 PM
Joined: Mar 2005
Posts: 14
T
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2005
Posts: 14
Cool, thanks! :-)

#135573 15/11/05 06:42 PM
Joined: Mar 2005
Posts: 14
T
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2005
Posts: 14
Code:
on *:JOIN:#channelnamehere: {
  var %i = 0
  while ((%i &lt; 3) &amp;&amp; (%i &lt; $len($nick))) {
    if ($mid($nick,%i,1) isalpha) { splay $+(",folder of the wav files,$v1,.wav") | inc %i }
  }
}


This script works very good; with this script mIRC reads the joining user's nicknames. But how should I change the script, if I wanted to add another sound on join? Example: User "Tester" joins "Testchannel". mIRC should now play the wav file testchannel.wav, and after this tell me the user's nickname letter by letter.

If I put another line to my remotes.ini (on !*:join:#testchannel:/splay testchannel.wav), the above script doesn't work anymore. Why?

And how can I accellerate the reading speed? The script starts one wav file per second, but the wav files are shorter than a second...

#135574 15/11/05 06:57 PM
Joined: Mar 2005
Posts: 14
T
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2005
Posts: 14
I found a solution (learning by doing wrong). ;-)

Code:
on !*:join:#testchannel: {
  if ($len($nick) &gt;= 3) {
    var %x = 1
    while (%x &lt;= $len($nick)) {
      .splay testchannel.wav
      .splay -q $+($mid($nick,%x,1),.wav)
      inc %x
    }
  }
}

#135575 15/11/05 07:10 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You may want to include some form of check to make sure it's not going to queue 10-20 nicks when a netsplit rejoins. Think of how that sounds...

*Net split ends ... 10 users join at once*
* Nick1 joins channel.
/splay testchannel.wav
/splay N.wav i.wav c.wav k.wav 1.wav
* Nick2 joins channel.
/splay testchannel.wav
/splay N.wav i.wav c.wav k.wav 2.wav

Consider how that will sound. laugh

On a really large channel, it could be much worse. Having a check to make it only play sound for a maximum of one nick in a given interval (10 seconds, maybe).

Just use a variable to do it:

Code:
if (%nick.sound == $null) {
  set -u10 %nick.sound 1
  [color:red]your playing section of code[/color]
}


If you need help inserting that, let me know. I left it just as an example so you can try inserting it yourself... it's good practice. smile

One other thing... You should make sure that all letters and symbols and numbers have wav files for them. If they do not, then you may want to put an ELSE in there and play a default sound when a letter/symbol/number is missing a file. It will prevent errors. Or, just use the ELSE to skip playing any sound for those. If you need more help on how to do that, just ask.

------
EDIT:
If you really wanted to get creative and work hard on making it really "say" the nick rather than just spell it, you could basically create a script that decodes the nick and pronounces each letter based on letters surrounding it.

Example:
"ia" together should always make a "ee-uh" or "ee-ah" sound (basically you use a wav with an "ee" sound when you come to the "i" because the next letter is an "a". When you come to the "a", you look before and after and see how it should be affected.

Granted, this would take a LOT of work as there are many ways things can be pronounced and you'd have to take into account all possible ways to say a sound. It was just a comment on expanding it. I wouldn't expect it to actually be done. If you were making it say nicks in another language than English, it would be easier... English has way too many sounds for each letter. I think "a" makes something like 12 different sounds in the English (American English) language.

Last edited by Riamus2; 15/11/05 07:16 PM.

Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard