mIRC Home    About    Download    Register    News    Help

Print Thread
#161690 10/10/06 02:18 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I've been working on this script for a couple of weeks, and for the most part it works, but something has gone wrong with the alias (which follows). I'm only posting the alias, since the rest of the code works perfectly. If anyone can figure out what's wrong with the alias, I'll be happy to include your name in the credits section of the script.
Additionally, if anyone can suggest a better way of doing the alias, I'm all ears (or eyes, I suppose would be more accurate).

There's no display when I run the script.
I'm hoping that it's either something simple and I'm overlooking it from having concentrated on the script for so long, or that it's something fairly major that I've missed because I didn't think of it.

Code:
on *:dialog:slap_manager:sclick:5:{
  slap $did(6).state $did(7).state $did(8).state $did(11).state $did(12).state $did(13).state
}
alias slap {
  if $1-3 == 1 0 0 {
    var %a = 1, %b = $scon(0)
    while %a <= %b {
      .scon %a 
      var %c = 1, %d = $chan(0)
      while %c <= %d {
        var %e = 1, %f = $nick($chan(%c),0)
        while %e <= %f && $nick($chan(%c),%e) != $me {
          var %g = 1, %h = $iif($4-5 == 0 1,$did(slap_manager,3,0).csel,$did(slap_manager,3).lines)
          while %g <= %h {
            var %slap = $iif($4-6 == 1 0 1,$did(slap_manager,3,$r(1,$did(slap_manager,3).lines)),$iif($4-6 == 1 0 0,$did(slap_manager,3,%g),$iif($4-6 == 0 1 0,$did(slap_manager,3,$did(slap_manager,3,%g).csel),$did(slap_manager,3,$r(1,$did(slap_manager,3,0).csel)))))
            .timer 1 %g describe $chan(%c) slaps $nick($chan(%c),%e) %slap
            inc %g
          }
          inc %e
        }
        inc %c
      }
      .scon -r
      inc %a
    }
  }
  elseif $1-3 == 1 0 1 {
    var %a = 1, %b = $scon(0)
    while %a <= %b {
      var %network = $r(1,$scon(0))
      .scon %network
      var %c = 1, %d = $chan(0)
      while %c <= %d {
        var %chan = $r(1,$chan(0))
        var %e = 1, %f = $nick(%chan,0)
        while %e <= %f  {
          var %nick = $r(1,$nick(%chan,0))
          if $nick(%chan,%nick) != $me {
            var %g = 1, %h = $iif($4-5 == 0 1,$did(slap_manager,3,0).csel,$did(slap_manager,3).lines)
            while %g <= %h {
              var %slap = $iif($4-6 == 1 0 1,$did(slap_manager,3,$r(1,$did(slap_manager,3).lines)),$iif($4-6 == 1 0 0,$did(slap_manager,3,%g),$iif($4-6 == 0 1 0,$did(slap_manager,3,$did(slap_manager,3,%g).csel),$did(slap_manager,3,$r(1,$did(slap_manager,3,0).csel)))))
              .timer 1 %g describe $chan(%c) slaps $nick(%chan,%e) %slap
              inc %g
            }
          }
          inc %e
        }
        inc %c
      }
      .scon -r
      inc %a
    }
  }
  elseif $1-3 == 0 1 0 {
    var %a = 1, %b = $scon(0)
    while %a <= %b && $xdid(slap_manager,1,%a).state == 2 {
      .scon %a
      var %c = 1, %d = $chan(0)
      while %c <= %d && $xdid(slap_manager,1,%a %c).state == 2 {
        var %e = 1, %f = $nick($chan(%c),0)
        while %e <= %f && $xdid(slap_manager,1,%a %c %e).state == 2 {
          while %g <= %h {
            var %slap = $iif($4-6 == 1 0 1,$did(slap_manager,3,$r(1,$did(slap_manager,3).lines)),$iif($4-6 == 1 0 0,$did(slap_manager,3,%g),$iif($4-6 == 0 1 0,$did(slap_manager,3,$did(slap_manager,3,%g).csel),$did(slap_manager,3,$r(1,$did(slap_manager,3,0).csel)))))
            .timer 1 %g describe $chan(%c) slaps $nick(%chan,%e) %slap
            inc %g
          }
          inc %e
        }
        inc %c
      }
      .scon -r
      inc %a
    }
  }
  elseif $1-3 == 0 1 1 {
    var %a = 1, %b = $scon(0)
    while %a <= %b {
      var %network = $r(1,$scon(0))
      if $xdid(slap_manager,1,%network).state == 2 {
        .scon %a
        var %c = 1, %d = $chan(0)
        while %c <= %d {
          var %chan = $r(1, $chan(0))
          if $xdid(slap_manager,1,%network %chan).state == 2 {
            var %e = 1, %f = $nick(%chan,0)
            while %e <= %f {
              var %nick = $r(1,$nick(%chan,0))
              if $xdid(slap_manager,1,%network %chan %nick).state == 2 {
                while %g <= %h {
                  var %slap = $iif($4-6 == 1 0 1,$did(slap_manager,3,$r(1,$did(slap_manager,3).lines)),$iif($4-6 == 1 0 0,$did(slap_manager,3,%g),$iif($4-6 == 0 1 0,$did(slap_manager,3,$did(slap_manager,3,%g).csel),$did(slap_manager,3,$r(1,$did(slap_manager,3,0).csel)))))
                  .timer 1 %g describe %chan slaps %nick %slap
                  inc %g
                }
              }
              inc %e
            }
          }
          inc %c
        }
      }
      .scon -r
      inc %a
    }
  }
  else {
    echo 4 -a ERROR $1-
    halt
  }
}
  

#161691 10/10/06 02:25 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Russell I seen a few post of this.. im getting formiliar with it. What do you mean by no display?


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#161692 10/10/06 02:34 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Just exacly what I said. Nothing shows in the channel in a format similar to that of RusselB slaps Lpfix5 with 1..2..tree

P.S.: You can't be getting familiar with this specific script, as this is the first time I've posted regarding it.

Last edited by RusselB; 10/10/06 02:35 AM.
#161693 10/10/06 02:45 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Im a little confused in the script becaue of the while loops in while loops

Im gonna look at it a bit but for starts though your using a var called %g
and you have it increment while timers 1 %g is present meaning its gonna open a timer all the way through till its done in the script and keep incrementing the %g var so a new timer is created


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#161694 10/10/06 02:50 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The %g variable, for lack of a better expression, tracks which slap in the list will be used for the slap. The usage of the %g variable in the timer simply prevents most flood protections from activating, as it limits the display to one slap per second.

First slap at 1 second
Second at 2 seconds
Third at 3 seconds
etc.

#161695 10/10/06 02:59 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Ok I tested a bit started with the if $1-3 == 1 0 0 code
I changed a few scenarios your var for %slaps is controlled by your dialog which is fine so I put word slapsslaps instead to test

now for the part that is controlled with %g in the while loop now just for example

if the %h becomes $null or inproper it returns nothing(no display)

so I did a small test I put %h = 1 and change the $null back to %h I get

1 describe #Chat slaps FreedomRules SlapsSlaps
1 describe #Chat slaps geemy SlapsSlaps
1 describe #Chat slaps HttpStats SlapsSlaps
1 describe #Chat slaps Phatt_One SlapsSlaps
1 describe #Chat slaps Rikuume SlapsSlaps
1 describe #Chat slaps RuBy SlapsSlaps
1 describe #Chat slaps snow[a] SlapsSlaps
1 describe #Chat slaps alucard SlapsSlaps
1 describe #Chat slaps dac SlapsSlaps
1 describe #Chat slaps dgram SlapsSlaps
1 describe #Chat slaps Doc SlapsSlaps
1 describe #Chat slaps Elder SlapsSlaps

this is just for my test to echo the result...

below I posted a $null version to show you that nothing happens so im thinking whatever is written to your %h var is what you need to worry about. so you see if anything does not fucntion properly in the echo for your vars your stuck in lala land.


[code]alias slap {
if $1-3 == 1 0 0 {
var %a = 1, %b = $scon(0)
while %a <= %b {
.scon %a
var %c = 1, %d = $chan(0)
while %c <= %d {
var %e = 1, %f = $nick($chan(%c),0)
while %e <= %f && $nick($chan(%c),%e) != $me {
var %g = 1, %h = 4
while %g <= $null {
var %slap = SlapsSlaps
echo -a %g describe $chan(%c) slaps $nick($chan(%c),%e) %slap
inc %g
}
inc %e
}
inc %c
}
.scon -r
inc %a
}
}
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#161696 10/10/06 03:19 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for your help. Problem has been located, now I need to figure out a solution. If I haven't figured out something by the end of the week, I'll post for further assistance.

#161697 10/10/06 03:52 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Im anxious what was it?


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#161698 10/10/06 04:20 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In my tests, I'd used a checked sequence, which corresponds to passing the alias 0 1 0 0 1 0
This meant that the script was checking if the item in ID 1 was checked.
Since ID 1 is a treeview listing, there are actually 3 levels that can be checked (network, channel, & nick). I was checking the nick level, but the script was looking for a check at the network level first, then the channel level, then (finally) the nick level, and since it wasn't checking for the nick level if the channel level wasn't checked (and likewise with the network & channel levels), the script kept jumping through.

I hope you can make sense of that explanation..obviously it wouldn't occur in all circumstances, but since I didn't want to send a lot of slaps to a lot of channels, I wasn't testing all of the options available.

#161699 10/10/06 04:27 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Yeah I understand, cool that you figured it out I would however make on alias with all the while loops in place and have like

%g = $1 and %a = $2 so you just have to fill those parameters in on a alias call rather then making the while loops all the time but its upon pure reference but im sure you written something in the past that you got lost in your own written script


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#161700 10/10/06 04:36 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's a simpler explanation
while %a <= %b && $xdid(slap_manager,1,%a).state == 2 {
.scon %a
var %c = 1, %d = $chan(0)
while %c <= %d && $xdid(slap_manager,1,%a %c).state == 2 {
var %e = 1, %f = $nick($chan(%c),0)
while %e <= %f && $xdid(slap_manager,1,%a %c %e).state == 2

Red which would've corresponded to a match, wouldn't have been reached, since neither Green nor Blue had corresponding matches (checked boxes)


Link Copied to Clipboard