|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
I made a alias for amsg, and now i have the problem that it loops untill mirc crash, i need to add a "halt" somwhere, for now i have added a "haltdef", but if i add that halt to the code, then mirc halt the event befor sending it to the rest of the channel, so it only sends my amsg to 1 channel.
alias amsg {
if (%timestamp == 1) { timeset }
var %i 1
set %inptext $1-
while (%i <= $chan(0)) {
.msg $chan(%i) %inptext
if (%close == 1) { goto next }
if ($me isop $chan) { goto op }
if ($me isvo $chan) { goto vo }
else { goto normal }
:op
echo -a %tstmp $+ $+ %cbrackets $+ %right $+ $+ %opcolor $+ @ $+ $+ $me $+ %cbrackets $+ %left $+ %inptext | haltdef
:vo
echo -a %tstmp $+ $+ %cbrackets $+ %right $+ $+ %voiccolor $+ + $+ $+ $me $+ %cbrackets $+ %left $+ %inptext | haltdef
:normal
echo -a %tstmp $+ $+ %cbrackets $+ %right $+ $me $+ %cbrackets $+ %left $+ %inptext | haltdef
:next
if ($me isop $chan) { goto op1 }
if ($me isvo $chan) { goto vo1 }
else { goto normal1 }
:op1
echo -a %tstmp $+ $+ %cbrackets $+ %right $+ $+ $+ %opcolor @ $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext | haltdef
:vo1
echo -a %tstmp $+ $+ %cbrackets $+ %right $+ $+ $+ %voiccolor + $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext | haltdef
:normal1
echo -a %tstmp $+ $+ %cbrackets $+ %right $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext | haltdef
}
}
the char is color, i coloring the brackets.. i know its a bit messy code, and i know i should replace "-a" in the echo with $chan(%i), but havent got that far yet any ideas? :tongue:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 43
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 43 |
did you try /break example
var %cnt = 1
while (%cnt) {
if (%cnt >= 100) { break }
inc %cnt
}
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
sorry, you lost me there.. break ? :tongue:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
break, breaks a current command.., useful for stopping never-ending loops ^_^
new username: tidy_trax
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
var %cnt = 1while (%cnt) { if (%cnt >= 15) { break } inc %cnt }
so i add that code. then if the %cnt go to 16 it breaks? but it feels a bit wierd to do it that way.. the loop dont need to go any higher then %i, cos if im only on 3 channels.. then why loop it 16 times? or like in your example 100 times? and if i add the break to execute when %i == $chan(0) it do the break right away.. so it only sending the msg to 1 channel.. :tongue:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
No one that have any idea for this one? :tongue:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: May 2003
Posts: 730
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 730 |
u can /inc %i in your command at the end (after the last /echo) so it will go through all channels
Last edited by ScatMan; 18/08/03 07:05 PM.
|
|
|
|
Joined: Dec 2002
Posts: 43
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 43 |
replace haltdef with return or break return will return from the alias to the calling script break will stop the while loop and goto the next instruction following it. btw, like the smiley
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
Now it looks like this:
alias amsg {
if (%timestamp == 1) { timeset }
var %i 1
set %inptext $1-
while (%i <= $chan(0)) {
.msg $chan(%i) %inptext
if (%close == 1) { goto next }
if ($me isop $chan(%i)) { goto op }
if ($me isvo $chan(%i)) { goto vo }
else { goto normal }
:op
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ %opcolor $+ @ $+ $+ $me $+ %cbrackets $+ %left $+ %inptext | return
:vo
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ %voiccolor $+ + $+ $+ $me $+ %cbrackets $+ %left $+ %inptext | return
:normal
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $me $+ %cbrackets $+ %left $+ %inptext | return
:next
if ($me isop $chan(%i)) { goto op1 }
if ($me isvo $chan(%i)) { goto vo1 }
else { goto normal1 }
:op1
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ $+ %opcolor @ $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext | return
:vo1
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ $+ %voiccolor + $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext | return
:normal1
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext | return
}
}
and now i dont excess flood, but it only sending the echo to one channel, and only sending the msg to one channel.. and thats the active one.. it still dont send to all open channels :tongue:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 43
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 43 |
I'll remember to look at the code a little closer next time You forgot to inc %i at the end of the loop, didnt need haltdef, halt, return, or break. you just need inc %i
alias amsg {
if (%timestamp == 1) { timeset }
var %i 1
set %inptext $1-
while (%i <= $chan(0)) {
.msg $chan(%i) %inptext
if (%close == 1) { goto next }
if ($me isop $chan(%i)) { goto op }
if ($me isvo $chan(%i)) { goto vo }
else { goto normal }
:op
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ %opcolor $+ @ $+ $+ $me $+ %cbrackets $+ %left $+ %inptext
:vo
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ %voiccolor $+ + $+ $+ $me $+ %cbrackets $+ %left $+ %inptext
:normal
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $me $+ %cbrackets $+ %left $+ %inptext
:next
if ($me isop $chan(%i)) { goto op1 }
if ($me isvo $chan(%i)) { goto vo1 }
else { goto normal1 }
:op1
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ $+ %opcolor @ $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext
:vo1
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ $+ %voiccolor + $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext
:normal1
echo $chan(%i) %tstmp $+ $+ %cbrackets $+ %right $+ $+ $me $+ $+ %cbrackets $+ %left $+ %inptext
inc %i
}
}
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
Nope dosent work.. it ecjho every mode in the channel, it dont filter out if im op or not.. just echoing them all.. and i used
if (%timestamp == 1) { timeset }
var %i 1
set %inptext $1-
while (%i <= $chan(0)) {
.msg $chan(%i) %inptext
set %echochannel $chan(%i)
cos then i could use: echo %echochannel :tongue:
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
I solved it.. i added a | goto end after every echo.. then the end was: :end inc %i thnx for the help.. and yes, my smiley is nice and good looking dude, the rock king among smileys
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 43
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 43 |
Here is an example, of course you will have to change the style, that it displays, to fit your taste.
amsg {
var %i = 1
while (%i <= $chan(0)) {
var %c = $chan(%i)
if ($me ison %c) {
echo %c < $+ $left($nick(%c,$me).pnick,1) $+ $me $+ > $1-
.msg %c $1-
}
inc %i
}
}
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
I think i stick with the first one, it works and im glad it does but thanx anyway
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
|