mIRC Home    About    Download    Register    News    Help

Print Thread
Away System #115552 27/03/05 02:29 PM
Joined: Mar 2005
Posts: 8
E
Exodus_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
E
Joined: Mar 2005
Posts: 8
can sumone fix this for me, im having trouble with the checkboxes
Code:
 
menu channel {
  AwaY System: /dialog -md away away
}
dialog away {
  title "  _-= Away System  =-_"
  size -1 -1 124 119
  option dbu
  edit "", 1, 27 16 69 10
  edit "", 2, 27 44 69 10
  text "Away Nick", 3, 49 4 25 8
  text "Away Message", 4, 42 32 39 8
  check "Logger", 5, 6 65 36 10
  check "Pager", 6, 6 78 26 10
  icon 7, 27 102 68 9, 
  button "Away", 8, 43 63 37 12
  button "Back", 9, 43 82 37 12
}
on *:dialog:away:init:* {
  if (%away.log == on) { did -c $dname 5 }
  if (%pager == on) { did -c $dname 6 }
}
on *:dialog:away:sclick:8: {
  if ($away == $true) { echo -a *** You Are Already Away }
  else {
    set %currentnick $me
    set %away on
    set %awaynick $did(awdia,1).text
    set %awaymsg $did(awdia,2,).text
    set %away.time $ctime
    amsg 10111011101110 11A10w11y 10111011 $+ %awaymsg $+ 10111011101110
    nick %awaynick
    away %awaymsg 
  }
}
on *:dialog:away:sclick:9: {
  if (%away == off) { echo -a ***You Are Not Away }
  else {
    set %away off
    amsg 10111011101110 11B10c11k 101110 11 $+ %awaymsg $+ 10111011 $duration($calc($ctime - %away.time))  10111011101110
    nick %currentnick
    away
  }
  on 1:DIALOG:Away:sclick:5:{
    if $did(5) {
      if ($did(5).state == 1) { set %away.log on } 
      elseif ($did(5).state == 0) { set %away.log off } 
    }
  }
  on *:TEXT:*:#: {
    if (%away.log == on) {
      IF ($me isin $1- || %awaynick isin $1-) { 
        IF ($away == $true) { 
          if (!$window(@Away.log)) { window -l @Away.log 200 200 630 200 Arial 12 }
          aline -c15 @Away.log :: $+ $time $+ ::  $+ $chan $+ :: < $+ $nick $+ > $1-
        }
      }
    }
  }
  on 1:DIALOG:Away:sclick:6:{
    if $did(6) {
      if ($did(6).state == 1) { set %pager on } 
      elseif ($did(6).state == 0) { set %pager off } 
    }
  }
  ctcp *:page:*: {
    if (%pager == on) && ($away == $true) {
      .notice $nick   > Hello. Since you paged me, I'm probably busy or away for a while. I'll get back to you as soon as I can.
      echo -at ** [ You have been PAGED by $nick ] $address on $fulldate
      write $scriptdir\page.txt paged by : $nick $address $fulldate MSG : $2-
    }
  }

 

Re: Away System #115553 27/03/05 05:48 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hi Exodus,

I've added/removed a few portions of your code some IF statements that were unecessary. Below is your code and below that is my code.

The parts in red have been added and the parts in blue have been removed.

Code:
menu channel {
  AwaY System: /dialog -md away away
}
dialog away {
  title " _-= Away System =-_"
  size -1 -1 124 119
  option dbu
  edit "", 1, 27 16 69 10
  edit "", 2, 27 44 69 10
  text "Away Nick", 3, 49 4 25 8
  text "Away Message", 4, 42 32 39 8
  check "Logger", 5, 6 65 36 10
  check "Pager", 6, 6 78 26 10
  icon 7, 27 102 68 9, 
  button "Away", 8, 43 63 37 12
  button "Back", 9, 43 82 37 12
}
on *:dialog:away:init:* {
  if (%away.log == on) { did -c $dname 5 }
  if (%pager == on) { did -c $dname 6 }
}
on *:dialog:away:sclick:8: {
  if ($away == $true) { echo -a *** You Are Already Away [color:red]| return[/color] }
  [color:blue]else {[/color]
    set %currentnick $me
    set %away on
    set %awaynick $did([color:red]awdia[/color],1).text
    set %awaymsg $did([color:red]awdia[/color],2[color:blue],[/color]).text
    set %away.time $ctime
    amsg 10111011101110 11A10w11y 10111011 $+ %awaymsg $+ 10111011101110
    nick %awaynick
    away %awaymsg 
  [color:blue]}[/color]
}

on *:dialog:away:sclick:9: {
  if (%away == off) { echo -a ***You Are Not Away [color:red]| return[/color] }
  [color:blue]else {[/color]
    set %away off
    amsg 10111011101110 11B10c11k 101110 11 $+ %awaymsg $+ 10111011 $duration($calc($ctime - %away.time)) 10111011101110
    nick %currentnick
    away
  }
  on 1:DIALOG:Away:sclick:5:{
    [color:blue]if $did(5) {[/color]
      if ($did(5).state == 1) { set %away.log on } 
      elseif ($did(5).state == 0) { set %away.log off } 
    [color:blue]}[/color]
  }
  on *:TEXT:*:#: {
    if (%away.log == on) {
      IF ($me isin $1- || %awaynick isin $1-) { 
        IF ($away == $true) { 
          if (!$window(@Away.log)) { window -l @Away.log 200 200 630 200 Arial 12 }
          aline -c15 @Away.log :: $+ $time $+ :: $+ $chan $+ :: < $+ $nick $+ > $1-
        }
      }
    }
  }
  on 1:DIALOG:Away:sclick:6:{
    [color:blue]if $did(6) {[/color]
      if ($did(6).state == 1) { set %pager on } 
      elseif ($did(6).state == 0) { set %pager off } 
    [color:blue]}[/color]
  }
  ctcp *:page:*: {
    if (%pager == on) && ($away == $true) {
      .notice $nick > Hello. Since you paged me, I'm probably busy or away for a while. I'll get back to you as soon as I can.
      echo -at ** [ You have been PAGED by $nick ] $address on $fulldate
      write $scriptdir\page.txt paged by : $nick $address $fulldate MSG : $2-
    }
  }


if $did(5) and if $did(6) was removed because you already gave reference to clicking that button here:

on 1:dialog:away:sclick:5: { }
on 1:dialog:away:sclick:6: { }

Final code:

Code:
menu channel {
  AwaY System: /dialog -md away away
}
dialog away {
  title " _-= Away System =-_"
  size -1 -1 124 119
  option dbu
  edit "", 1, 27 16 69 10
  edit "", 2, 27 44 69 10
  text "Away Nick", 3, 49 4 25 8
  text "Away Message", 4, 42 32 39 8
  check "Logger", 5, 6 65 36 10
  check "Pager", 6, 6 78 26 10
  icon 7, 27 102 68 9, 
  button "Away", 8, 43 63 37 12
  button "Back", 9, 43 82 37 12
}

on *:dialog:away:init:* {
  if (%away.log == on) { did -c $dname 5 }
  if (%pager == on) { did -c $dname 6 }
}

on *:dialog:away:sclick:8: {
  if ($away == $true) { echo -a *** You Are Already Away | return }
  set %currentnick $me
  set %away on
  set %awaynick $did(away,1).text
  set %awaymsg $did(away,2).text
  set %away.time $ctime
  amsg 10111011101110 11A10w11y 10111011 $+ %awaymsg $+ 10111011101110
  nick %awaynick
  away %awaymsg 
}

on *:dialog:away:sclick:9: {
  if (%away == off) { echo -a *** You Are Not Away | return }
  set %away off
  amsg 10111011101110 11B10c11k 101110 11 $+ %awaymsg $+ 10111011 $duration($calc($ctime - %away.time)) 10111011101110
  nick %currentnick
  away
}

on 1:DIALOG:Away:sclick:5:{
  if ($did(5).state == 1) { set %away.log on } 
  elseif ($did(5).state == 0) { set %away.log off } 
}

on *:TEXT:*:#: {
  if (%away.log == on) {
    IF ($me isin $1- || %awaynick isin $1-) { 
      IF ($away == $true) { 
        if (!$window(@Away.log)) { window -l @Away.log 200 200 630 200 Arial 12 }
        aline -c15 @Away.log :: $+ $time $+ :: $+ $chan $+ :: < $+ $nick $+ > $1-
      }
    }
  }
}

on 1:DIALOG:Away:sclick:6:{
  if ($did(6).state == 1) { set %pager on } 
  elseif ($did(6).state == 0) { set %pager off } 
}

ctcp *:page:*: {
  if (%pager == on) && ($away == $true) {
    .notice $nick > Hello. Since you paged me, I'm probably busy or away for a while. I'll get back to you as soon as I can.
    echo -at ** [ You have been PAGED by $nick ] $address on $fulldate
    write $scriptdir\page.txt paged by : $nick $address $fulldate MSG : $2-
  }
}

Last edited by SladeKraven; 27/03/05 05:50 PM.