mIRC Home    About    Download    Register    News    Help

Print Thread
#226376 29/09/10 03:50 AM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
hi,

I have this alias to show what music i listen to.
Code:
alias mp3show {
  if (!$inmp3) || (!$server) return
  var %t = $mp3ret(main,show)
  var %m = $mp3showmsg
  if ($1 ischan) || ($chat($1)) || ($query($1)) describe $1 %m
  else {
    if ((%t == 1) || (%t == 3)) {
      var %i = 1
      while ( %i <= $scon(0) ) {
        scid $scon(%i)
        var %kamers = $null
        var %ii = $chan(0)
        while ( %ii ) {
          if ( %nietszeggenin. [ $+ [ $chan(%ii) ] ] ) { dec %ii | continue }
          var %kamers = $addtok(%kamers,$chan(%ii),44)
          dec %ii
        }
        .describe %kamers %m | echo -i27 %kamers 14 $+ $timestamp $+ $str( ,$calc(17 - $len($_c(core03)))) 6 $+ $_c(core03) $+ : $me %m
        inc %i
      }
    }
    if ((%t == 2) || (%t == 3)) {
      var %i = 1
      while ($scon(%i)) {
        scid $v1
        if ($query(1)) qme %m
        inc %i
      }
    }
    if (%t == 4) && (($active ischan) || ($query($active)) || ($chat($active))) describe $active %m
  }
}


my problem is the echo part.
on rightclick in a channel i have an option to exclude that channel from seeing what i listen to.
When i'm on only one channel it works fine.
But when i'm on multiple channels the echo will show up in my status window like this:
Code:
#chan1,#schan2,#chan3 [05:37]             Aktie: RiMaJoy this is what i'm listening to.

what i want is the echo to show up in all the channel that i'm in and that are not excluded.
on the describe %kamers does the job .... why doesn't it work with the echo ?
i hope u can help me out.

Greetzz,
RiMaJoy

RiMaJoy #226382 29/09/10 06:33 AM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Your code will send a describe and echo for every network in your while loop. You probably do not see the describe because the channels do not exist. With /debug @debug you may see the script send /describe.
Code:
while ( %i <= $scon(0) ) {
scid $scon(%i)
.describe %kamers %m | echo -i27 %kamers 14 $+ $timestamp $+ $str( ,$calc(17 - $len($_c(core03)))) 6 $+ $_c(core03) $+ : $me %m
inc %i
}




The only way I see to not message the channel, in your script, is to not add it to the list when you check for:
if ( %nietszeggenin. [ $+ [ $chan(%ii) ] ] )

Otherwise you can make a simple check before you send messages.

if (%true) {
.describe %kamers %m
echo -i27 %kamers 14 $+ $timestamp $+ $str( ,$calc(17 - $len($_c(core03)))) 6 $+ $_c(core03) $+ : $me %m
}




RiMaJoy #226389 29/09/10 08:05 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
/echo does not support multiple target parameters. You'll have to loop through each token of %kamers and echo to each one separately.

Collective #226420 29/09/10 06:05 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
i'm not that good as a scripter.
the code is not mine and i lost contact with the one who made it.
what do i need ? ?
my guess: $gettok, goto loop and .....
i know $gettok gets one token but my tokens are variable.
another guess: the goto loop is for the N in the $gettok sinds that is thing i need.
that is as far i go ... but i do have a shot at the loop.
my guess is it sucks :P but here goes:
Code:
var %spamchan
  %spamchan = 1
  %chans = $gettok(%kamers,%spamchan,44)
  :start
  if (%spamchan <= %kamers) {
    echo %chans bla bla bla bla bla bla
    inc %spamchan
    goto start
  }





RiMaJoy #226421 29/09/10 07:31 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Simple loop method:

Code:
var %counter = 1, %total = $numtok(%kamers,44)
while (%counter <= %total) {
  echo $gettok(%kamers,%counter,44) Whatever you're echoing.
  inc %counter
}


Invision Support
#Invision on irc.irchighway.net
Riamus2 #226422 29/09/10 07:47 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
frown i wasn't even close smirk

thanks Riamus2

RiMaJoy #226423 29/09/10 08:17 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You weren't far off. This just uses a WHILE loop instead of a GOTO loop. Also, in either loop, your channel token (%chans in your script or the $gettok() in mine) needs to be within the loop so that it gets updated with each loop. In yours, you put it before the loop started, so it wouldn't be changed and you'd just keep echoing in the same channel.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard