Groups Control Dialog

By Scakk on Sep 13, 2008

This dialog allows you turn on/off your groups ( #group ) as you need via the dialog. If you turn one off a second dialog appears allowing you turn off the variables/timers associated with the #group as you need.

Image

Image

Image

By default it is set to open in the top right hand corner of mIRC ( if mIRC is fullscreen ).

Update 15Sep08: Fixed it to unset timers that are numbers and not text.

menu channel,status {
  [Groups]: dialog $iif($dialog(groups), -v, -m) groups groups
}
dialog groups {
  title Groups Control
  size -1 -1 150 40
  text "Groups", 3, 5 40 130 30, center
  list 1, 5 60 140 130, vsbar 
  button "Expand", 2, 5 7 140 25
  edit "", 4, 5 174 75 22, autohs center read
  button "On" 5, 85 172 30 25
  button "Off" 6, 115 172 30 25
}
on *:dialog:groups:*:*: {
  if ($devent == init) {
    dialog -s $dname 791 2 150 40
    did -b $dname 5,6
    grps
  }
  if ($devent == sclick) { 
    if ($did == 1) { 
      did -ra $dname 4 $did(1).seltext 
      if ($group($did(1).seltext).status == on) { did -e $dname 6 | did -b $dname 5 } 
      if ($group($did(1).seltext).status == off) { did -b $dname 6 | did -e $dname 5 }
    }
    if ($did == 2) { 
      did -ra $dname 3 Groups ( $+ $did(1).lines $+ )
      if ($dialog(groups).h == 72) { did -r $dname 1 | grps }
      $iif($dialog(groups).h == 72, dialog -s $dname 791 2 150 200, dialog -s $dname 791 2 150 40) 
      $iif($dialog(groups).h != 72, did -ra $dname 2 Shrink, did -ra $dname 2 Expand) 
      if ($dialog(groups).h != 72) { did -b $dname 5,6 | did -r $dname 4 | did -u $dname 1 }
      if ($dialog(group2)) { dialog -x group2 | unset %grp | $iif($exists(timers.txt), .remove timers.txt) }
      if ($did(2).text == Shrink) { tmrs }
      if ($did(2).text == Expand) { if ($dialog(group2)) { dialog -x group2 } | unset %grp | $iif($exists(timers.txt), .remove timers.txt) }
    }
    if ($did == 5) { .enable $did(1).seltext | did -b $dname 5 | did -e $dname 6 }
    if ($did == 6) { .disable $did(1).seltext | did -b $dname 6 | did -e $dname 5 }
  }
}
alias grps {
  var %t 1
  while (%t <= $group(0)) {
    set %groups $sorttok($addtok(%groups,$group(%t),32),32,a)
    inc %t
  }
  didtok groups 1 32 %groups
  unset %groups
}
dialog group2 {
  title Groups Control 2
  size -1 -1 200 240
  list 1, 5 25 190 90, check
  list 2, 5 130 190 90, check
  text "Variables", 3, 5 5 190 15, center
  text "Timers", 4, 5 113 190 15, center
  button "Del Vars", 5, 5 217 85 20
  button "Del Timers", 6, 110 217 85 20
}
on *:dialog:group2:*:*: {
  if ($devent == init) { did -b $dname 5,6 }
  if ($devent == close) { unset %grp | $iif($exists(timers.txt), .remove timers.txt) }
  if ($devent == sclick) { 
    if ($did == 1) { 
      if ($did(1).seltext) { did -e $dname 5 }
      if ($did(1).csel = 0) { did -b $dname 5 | did -uk $dname 1 | unset %grp }
      if ($did(1).sel >= 1) {
        if ($did(group2,1,$did(group2,1).sel).cstate == 1) { set %grp $addtok(%grp,$did(1).seltext,32) }
        if ($did(group2,1,$did(group2,1).sel).cstate == 0) { set %grp $remtok(%grp,$did(1).seltext,32) }
      }
    }
    if ($did == 2) { 
      if ($did(2).seltext) { did -e $dname 6 }
      if ($did(2).csel = 0) { did -b $dname 6 | did -uk $dname 2 | .remove timers.txt }
      if ($did(2).sel >= 1) {
        if ($did(group2,2,$did(group2,2).sel).cstate == 1) { $iif($did(2).seltext !isin $read(timers.txt), write timers.txt $did(2).seltext) }
        if ($did(group2,2,$did(group2,2).sel).cstate == 0) { write -ds $+ $did(2).seltext timers.txt }
      }
    }
    if ($did == 5) {
      if (%grp != $null) {
        tokenize 32 %grp
        unset $1-
        unset %grp
        dialog -x group2
        tmrs
      }
      if (%grp == $null) { did -b $dname 5 }
    }
    if ($did == 6) { 
      var %t = 1
      while (%t <= $read(timers.txt,t)) { 
        .timer $+ $read(timers.txt,t,%t) off
        $iif(%t = $lines(timers.txt), goto next, inc %t )
      }
      :next
      .remove timers.txt
      dialog -x group2
      tmrs
    }
  }
}
alias tmrs { 
  dialog $iif($dialog(group2), -v, -m) group2 group2
  did -r group2 1,2  
  var %i 1
  while (%i <= $var(%*,0)) {
    did -i group2 1 %i $var(%*,%i)
    inc %i
  }
  var %t 1 
  while (%t <= $timer(0)) {
    did -i group2 2 %t $timer(%t) 
    inc %t 
  }
}

Comments

Sign in to comment.
Scakk   -  Sep 14, 2008

Update 15Sep08: Fixed it to unset timers that are numbers and not text.

 Respond  
rhasttaff   -  Sep 14, 2008

hey!! Nice code Scakk
very usefull!!

Jah Bless´´´

 Respond  
vaseline28   -  Sep 14, 2008

/me likes.
Great script - works nicely and is useful:
9/10

  • Like
 Respond  
Eugenio   -  Sep 13, 2008

First off, why the bloody hell does it open that tiny ass dialog in the top right hand corner >_> ?!?
When I click on shrink the dialog refreshes, and if the dialog isnt open then it re-opens the dialog.

Apart from that nice code
/me rates 7

 Respond  
EL   -  Sep 13, 2008

Looks Good Scakk ,and nice splitem apart very useful bein i have in total liek 100+ groups active with myself an my bot rofl like 31 me 79 my bot Eve,This will deffo come in handy."Rate it or Hate it?"...7/10.`-.-´

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.