mIRC Home    About    Download    Register    News    Help

Print Thread
#42766 18/08/03 05:19 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
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.

Code:
  

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 smirk
any ideas? :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#42767 18/08/03 05:31 PM
Joined: Dec 2002
Posts: 43
P
Ameglian cow
Offline
Ameglian cow
P
Joined: Dec 2002
Posts: 43
did you try /break
example
Code:
var %cnt = 1
while (%cnt) {
  if (%cnt >= 100) { break }
  inc %cnt
}

#42768 18/08/03 05:37 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
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,.) }
#42769 18/08/03 05:38 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
break, breaks a current command.., useful for stopping never-ending loops ^_^


new username: tidy_trax
#42770 18/08/03 05:43 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
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,.) }
#42771 18/08/03 06:32 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
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,.) }
#42772 18/08/03 07:03 PM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
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.
#42773 18/08/03 07:05 PM
Joined: Dec 2002
Posts: 43
P
Ameglian cow
Offline
Ameglian cow
P
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

#42774 18/08/03 07:21 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Now it looks like this:

Code:
 

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,.) }
#42775 18/08/03 07:30 PM
Joined: Dec 2002
Posts: 43
P
Ameglian cow
Offline
Ameglian cow
P
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
Code:
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
  }
}

#42776 18/08/03 07:47 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
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.. smirk
and i used

Code:

 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,.) }
#42777 18/08/03 07:53 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
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 smirk


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#42778 18/08/03 07:59 PM
Joined: Dec 2002
Posts: 43
P
Ameglian cow
Offline
Ameglian cow
P
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.
Code:
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
  }
}
 

#42779 18/08/03 08:14 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I think i stick with the first one, it works and im glad it does smirk but thanx anyway grin


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard