|
Joined: Sep 2004
Posts: 237
Fjord artisan
|
OP
Fjord artisan
Joined: Sep 2004
Posts: 237 |
I have a Dialog box for sounds...... now i need to associate the sounds to the Dialog box.
on *:JOIN:#:{ if (%sounds.checkthree == on ($nick == $me)) /splay -wq Join.wav }
Thats one of the sounds....... what am i doing wrong? Do i need an Else statement.... seems to me that if the checkbox is off it wont do anything anyway. And where exactly do i place these commands?
|
|
|
|
Joined: Dec 2002
Posts: 788
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 788 |
Don't know exactly what your doing, whether you just have a single wav to play when you join and thats it.. but the syntax for an if-then-else, is;
if ([color:red]arguments) { commands } elseif (arguments) { commands } else { commands } [/color] However, if your checking to arguments, i.e. if a variable is on, and the person joining is you,
if ((%var == on) && ($nick == $me)) { [color:red]commands } [/color] Also just to mention you are right, if you have an if statement to check if the var is on and dont wish to perform any command if the var is not, you dont require any if-then's.
Eamonn.
|
|
|
|
Joined: Sep 2004
Posts: 237
Fjord artisan
|
OP
Fjord artisan
Joined: Sep 2004
Posts: 237 |
Worked GREAT Thanks! Anyone please have a look at this and keep in mind, this is my first ever attempt. I am certain there could be easier ways of doing things or of cleaning things up .......... so any opinions or pointers would be more than welcome! Oh..... I made this to control some fancy sounds a friend sent me........ mostly just to learn though. dialog sounds {
title "Sound Controls"
size -1 -1 115 100
option dbu
box "Check Boxes",1,5 5 105 70
check "Connect ",2,8 12 40 11
check "Disconnect",3,8 22 40 11
check "Join Chan",4,8 32 40 11
check "DCC Send",5,8 42 40 11
check "DCC Fail",6,8 52 40 11
check "Gain +",7,8 62 40 11
check "Gain @",8,63 12 40 11
check "Lose +",9,63 22 40 11
check "Lose @",10,63 32 40 11
check "Blank",11,63 42 40 11
check "Blank2",12,63 52 45 11
check "Blank3",13,63 62 45 11
button "Accept",100,48 85 30 11,ok
button "Cancel",101,80 85 30 11,cancel
}
On *:Dialog:Sounds:init:0:{
if (%Sounds.checkone == On) { did -c Sounds 2 }
if (%Sounds.checktwo == On) { did -c Sounds 3 }
if (%Sounds.checkthree == On) { did -c Sounds 4 }
if (%Sounds.checkfour == On) { did -c Sounds 5 }
if (%Sounds.checkfive == On) { did -c Sounds 6 }
if (%Sounds.checksix == On) { did -c Sounds 7 }
if (%Sounds.checkseven == On) { did -c Sounds 8 }
if (%Sounds.checkeight == On) { did -c Sounds 9 }
if (%Sounds.checknine == On) { did -c Sounds 10 }
if (%Sounds.checkten == On) { did -c Sounds 11 }
if (%Sounds.checkeleven == On) { did -c Sounds 12 }
if (%Sounds.checktwelve == On) { did -c Sounds 13 }
}
on *:dialog:sounds:sclick:100:{
if ($did(sounds,2).state == 1) { set %sounds.checkone On }
else { set %sounds.checkone Off }
if ($did(sounds,3).state == 1 ) { set %sounds.checktwo On }
else { set %sounds.checktwo Off }
if ($did(sounds,4).state == 1) { set %sounds.checkthree On }
else { set %sounds.checkthree Off }
if ($did(sounds,5).state == 1) { set %sounds.checkfour On }
else { set %sounds.checkfour Off }
if ($did(sounds,6).state == 1) { set %sounds.checkfive On }
else { set %sounds.checkfive Off }
if ($did(sounds,7).state == 1) { set %sounds.checksix On }
else { set %sounds.checksix Off }
if ($did(sounds,8).state == 1) { set %sounds.checkseven On }
else { set %sounds.checkseven Off }
if ($did(sounds,9).state == 1) { set %sounds.checkeight On }
else { set %sounds.checkeight Off }
if ($did(sounds,10).state == 1) { set %sounds.checknine On }
else { set %sounds.checknine Off }
if ($did(sounds,11).state == 1) { set %sounds.checkten On }
else { set %sounds.checkten Off }
if ($did(sounds,12).state == 1) { set %sounds.checkeleven On }
else { set %sounds.checkeleven Off }
if ($did(sounds,13).state == 1) { set %sounds.checktwelve On }
else { set %sounds.checktwelve Off }
}
on *:CONNECT: {
if (%sounds.checkone == on ) /splay -w Connect.wav
}
on *:DISCONNECT: {
if (%sounds.checktwo == on ) /splay -w Disconn.wav
}
on *:JOIN:#:{
if ((%sounds.checkthree == on) && ($nick == $me)) /splay -wq Join.wav
}
on *:FileSent:*,*: {
if (%sounds.checkfour == on ) /splay -w DCCSend.wav
}
on *:SENDFAIL:*,*: {
if (%sounds.checkfive == on ) /splay -w DCCFAIL.wav
}
on 1:Voice:#: {
if ((%sounds.checksix == on ) && ($vnick == $me)) /splay -wq Voiced.wav
}
on 1:Op:#: {
if ((%sounds.checkseven == on ) && ($opnick == $me)) /splay -wq Opped.wav
}
on 1:Devoice:#: {
if ((%sounds.checkeight == on ) && ($vnick == $me)) /splay -wq Devoiced.wav
}
on 1:Deop:#: {
if ((%sounds.checknine == on ) && ($opnick == $me)) /splay -wq Deopped.wav
}
|
|
|
|
Joined: Dec 2002
Posts: 788
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 788 |
Personally, I'd find not using 'one/two/three' but using '1/2/3' instead, purely because they are easier to work with as you can use them easily in a loop, for example;
The following, for the INIT, just loops from 2 till 13 (your check ids), checks the var (%sounds.N) if they are set, if so, check the checkbox
On *:Dialog:Sounds:init:0:{ var %i = 2 while (13 >= %i) { if ($eval($+(%,sounds.,%i),2) == on) { did -c sounds %i } inc %i } }
and for the 'accept button, we do this, loop around the ids again (2-13) if the state is 1, set the var on, else off.
on *:dialog:sounds:sclick:100:{ var %i = 2 while (13 >= %i) { if ($did(sounds,%i).state == 1) { set $+(%,sounds.,%i) on } else { set $+(%,sounds.,%i) off } inc %i } }
Will do exactly what your 2 events above do, but looks alot bette, however, that isnt to say yours is wrong, as it isnt, it purely comes down to what you find easier and confortable.
The rest of your coding, isnt worth touching really they look find, except to mention you can do;
On [color:red]me:*:Join:#:{ [/color] and not have to use, if ($nick == $me), lil tip for you, note that it doesnt replace the userlevel, but prefixes it.
Eamonn.
|
|
|
|
|