All pastes #348447 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-10 04:34 UTC
rendered paste body
menu menubar {
  Config Panel
  .My Nick Config
  ..Register/AutoIdent: /nickconfig 
  ..AutoIdent On/Config: /set %regednick $$?="Your Nick:" | /set %regedpass $$?="Your Pass:" | //echo $input(You have Successfully configured auto-identify !,e,Thank You for using SeersIrc Network!!,title,text)
  ..AutoIdent Off: /set %regednick | /set %regedpass
  .My Channels Config: /setautojoin $$?="Channels to join on connect! Example: #mIRC,#Xuck,#help"
  .My Away Config
  ..AutoAway Settings: dialog $iif($dialog(away),-o,-m) away away
  ..Set away $+ $chr(58) $iif($group(#away) == off,on,off): {
    if ($group(#away) == off) away $?="Enter away reason or leave black for default (if set)"
    else back
  }
  .My Mp3 Config :/mp3
  .My Friends Config:/uwho
  .Sound Conifg
  ..on :/load -rs $mircdirsounds\sounds
  ..off :/unload -rs sounds
}
menu channel,nicklist,query,status,menubar {
  Set away $+ $chr(58) $iif($group(#away) == off,on,off): {
    if ($group(#away) == off) away $?="Enter away reason or leave black for default (if set)"
    else back
  }
  Config Panel :/configpanel

------------------------------------------

alias aud dialog -md aud aud
dialog aud {
  title "TonMp3 Player"
  size -1 -1 157 155
  option dbu
  list 14, 6 7 145 67, size
  box "Song List", 15, 3 0 151 78
  button "Play", 13, 3 80 27 12, flat
  button "Stop", 16, 34 80 27 12, flat
  button "< Prev", 17, 65 80 27 12, flat
  button "Next >", 18, 96 80 27 12, flat
  button "Pause", 19, 127 80 27 12, flat
  edit "To add music click on File at top left", 20, 2 96 112 10, read
  scroll "", 22, 3 109 151 8, range 100 horizontal bottom
  box "Volume Control", 23, 3 119 151 21
  button "+", 24, 11 127 10 10
  button "-", 25, 63 127 10 10
  text "Volume Up", 26, 24 128 30 8
  text "Volume Down", 27, 76 128 35 8
  check "Mute", 28, 120 127 26 10
  text "00:00", 29, 116 97 14 8
  text "/", 30, 132 97 4 8
  text "00:00", 31, 137 97 15 8
  edit "", 21, 3 143 87 10
  button "Search", 32, 93 143 27 10, ok flat
  link "www.myspace.com/tonysbackyard", 33, 124 146 32 8
  menu "File", 1
  item "Add Folder", 2, 1
  item "Add File", 3, 1
  item "Remove File", 4, 1
  item "Clear List", 5, 1
  item "Save List", 6, 1
  menu "mp3", 7
  menu "Extra", 9, 7
  item "TonMp3 is Running", 34, 9
  item "Join Tonys Chat", 35, 9
  item "ID3 Tags", 10, 7
  menu "Options", 8
  item "Repeat", 11, 8
  item "Shuffle", 12, 8
}
on *:dialog:aud:init:0:{
  if ($isfile(tsong.hsh)) {
    if ($hget(tsong)) { 
      hload tsong tsong.hsh     
    }
    else {
      hmake tsong 100 
      hload tsong tsong.hsh
    }  
  } 
  var %x = 1
  while (%x <= $hget(tsong,0).item) {
    did -a aud 14 $nopath($hget(tsong,%x))
    inc %x  
  }
  if ($didwm(aud,14,*$song $artist $length*)) {
    did -d aud 14 $v1
  }
  elseif ($hget(tsong,spam)) {  
    if ($did(aud,14).lines == $hget(tsong,0).item) {
      did -d aud 14 $did(aud,14).lines
    }
  }
}
on *:dialog:aud:menu:2:{
  var %dir $sdir(C:\,Music Files)
  did -r aud 14  
  var %x 1
  while ($findfile(%dir,*.mp3,%x) != $null ) {
    did -a aud 14 $nopath($findfile(%dir,*.mp3,%x))
    hadd -m tsong %x $findfile(%dir,*.mp3,%x)
    inc %x
  }
  var %x 1  
  while ($findfile(%dir,*.wav,%x) != $null ) {
    did -a aud 14 $nopath($findfile(%dir,*.wav,%x))
    hadd -m tsong %x $findfile(%dir,*.wav,%x)
    inc %x
  }
  var %x 1 
  while ($findfile(%dir,*.midi,%x) != $null ) {
    did -a aud 14 $nopath($findfile(%dir,*.midi,%x))
    hadd -m tsong %x $findfile(%dir,*.midi,%x)
    inc %x
  }
}
on *:dialog:aud:menu:3:{
  var %file $sfile(C:\,Music Files)
  did -a aud 14 $nopath(%file)
  hadd -m tsong $hget(tsong,0).item %file
}
on *:dialog:aud:menu:4:{
  if ($did(aud,14).sel == $null) {
    did -ra aud 20 Error: No Song Selected to Remove
    .timermp3status 1 3 did -ra aud 20 No Song Is Playing
  }
  else {
    hdel -w tsong $hfind(tsong,$+(*,$did(aud,14).seltext,*),w,1).data
    did -d aud 14 $did(aud,14).sel
  }
}
on *:dialog:aud:menu:5:{
  did -r aud 14 
  hfree tsong
  .remove tsong.hsh
}
on *:dialog:aud:menu:6:{
  hsave -o tsong tsong.hsh
  echo -s Play List Saved.
}
on *:dialog:aud:menu:10: dialog -m id3 id3
on *:dialog:aud:menu:11:{
  if ($did(12).state == 1) {
    did -u aud 12 
    $iif($did(11).state == 1,did -u $dname 11,did -c $dname 11)
  }
  else $iif($did(11).state == 1,did -u $dname 11,did -c $dname 11)
}
on *:dialog:aud:menu:12:{
  if ($did(11).state == 1) {
    did -u aud 11 
    $iif($did(12).state == 1,did -u $dname 12,did -c $dname 12)
  }
  else $iif($did(12).state == 1,did -u $dname 12,did -c $dname 12)
}
on *:dialog:aud:menu:34: $iif($did(34).state == 1,did -c $dname 34,did -c $dname 34)
on *:dialog:aud:menu:35: join #Baked
on *:dialog:aud:close:0:{
  splay stop 
  .timerpos off
}
on *:dialog:aud:sclick:13: audplay 
on *:dialog:aud:sclick:16: stop
on *:dialog:aud:sclick:17: prev
on *:dialog:aud:sclick:18: next
on *:dialog:aud:sclick:19:{ 
  if ($insong == $true) && (!$insong.pause) {
    splay pause  
    did -ra aud 19 Resume
  } 
  elseif ($insong.pause) {
    splay resume    
    did -ra aud 19 Pause  
  } 
}
on *:dialog:aud:sclick:24: vol -v $calc($vol(master) + 2000) 
on *:dialog:aud:sclick:25: vol -v $calc($vol(master) - 2000)
on *:dialog:aud:sclick:28: $iif($did(28).state == 1,vol -pu1,vol -pu2)
on *:dialog:aud:dclick:14: audplay  
on *:dialog:aud:sclick:32:{
  did -c aud 14 $didwm(aud,14,$+(*,$did(aud,21),*),1) 
  did -r aud 21  
  halt
}
on *:dialog:aud:sclick:33: run http://www.myspace.com/tonysbackyard

on *:dialog:aud:scroll:22:{
  if ($devent == scroll) { 
    if ($did == 22) { 
      if ($insong == $true) { 
        var %t $round($calc($did(aud,22).sel / 22000 * $insong.length),0) 
        splay seek $calc((%t + $did(aud,22).sel) * 200) 
      } 
    } 
  } 
} 
on *:mp3end: next
on *:waveend: next
on *:midiend: next
alias audplay {
  if ($did(aud,14).lines == 0) {
    did -ra aud 20 No Playlist
    halt
  }
  elseif ($did(aud,14).sel == $null) {
    did -ra aud 20 No Song Selected
    halt
  }
  else {    
    if ($sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).title != $null) {
      did -ra aud 20 Playing: $sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).title
      did -ra aud 31 $asctime($calc($sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).length / 1000 ),nn:ss)    
      .timerpos 0 1 pos.seek  
      splay $hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)
      /msg #Baked 12 Now Playing 4 $did(aud,14).seltext 12[ $length ]
    }
    else {
      did -ra aud 20 Playing: $did(aud,14).seltext
      did -ra aud 31 $asctime($calc($sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).length / 1000 ),nn:ss)    
      .timerpos 0 1 pos.seek    
      splay $hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)
    }
  }
  if ($did(aud,34).state == 1) {  
    if ($hget(tsong,spam)) {  
      if ($sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).title == $null) && ($did(aud,34).state == 1) msg $active Jamming to $did(aud,14).seltext
      else $iif($did(aud,34).state == 1,$($+($hget(tsong,spam)),2),return)  
    }
  }
}
alias stop {
  splay stop
  .timerpos off
  did -ra aud 20 No Song Is Playing
  did -ra aud 31 00:00
  did -ra aud 29 00:00  
}
alias prev {
  splay stop
  .timerpos off
  if ($did(aud,12).state == 1) {
    if ($hget(tsong,spam)) {
      did -c aud 14 $r(1,$calc($hget(tsong,0).item - 1))   
      audplay  
    }
    else {
      did -c aud 14 $r(1,$hget(tsong,0).item)
      audplay
    }
  }
  elseif ($did(aud,11).state == 1) { audplay }
  else {
    did -c aud 14 $calc($did(aud,14).sel - 1) 
    audplay  
  }
}
alias next {
  splay stop
  .timerpos off
  if ($did(aud,12).state == 1) {
    if ($hget(tsong,spam)) {
      did -c aud 14 $r(1,$calc($hget(tsong,0).item - 1))   
      audplay  
    }
    else {
      did -c aud 14 $r(1,$hget(tsong,0).item)
      audplay
    }
  }
  elseif ($did(aud,11).state == 1) { audplay }
  elseif ($did(aud,14).sel == $did(aud,14).lines) && ($did(aud,11).state == 0) && ($did(aud,12).state == 0) {
    did -c aud 14 1  
    audplay
  }
  else {
    did -c aud 14 $calc($did(aud,14).sel + 1) 
    audplay  
  }
} 

alias -l pos.seek { 
  if ($dialog(aud) != $null) && ($inmp3 == $true) { 
    did -c aud 22 $round($calc($calc($insong.pos / $insong.length) * 100),0) 
    ;the below line was basically written by the good ImthePariah    
    did -ra aud 29 $+($gettok($duration($calc($insong.pos / 1000),3),2-,58),/,$gettok($duration($calc($insong.length / 1000),3),2-,58))
  } 
  elseif ($dialog(aud) == $null) { 
    .timerpos off 
  } 
} 
alias length {
  return $asctime($calc($sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).length / 1000 ),nn:ss)
}
alias artist {
  return $sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).artist
}
alias song {
  return $sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).title
}
alias bit {
  return $sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).bitrate
}
alias jam {
  if ($hget(tsong,spam)) {
    if ($sound($hget(tsong,$hfind(tsong,$+(*,$did(aud,14).seltext,*),1,w).data)).title == $null) msg $active Jamming to $did(aud,14).seltext
    else $($+($hget(tsong,spam)),2)
  }
  else echo -a No Spam Message set.  
}
dialog spam {
  title "Spam Message"
  size -1 -1 147 82
  option dbu
  radio "Message all channels", 1, 2 3 63 10, 
  radio "Describe all channels", 2, 75 3 64 10, group
  radio "Message active channels", 3, 2 16 72 10, group
  radio "Describe active channels", 4, 75 16 71 10, group
  text "Select one of the above boxes and fill in the message that you would like to use for your spam message. You can use the following identifiers to return song info. $length = Song length $artist = Artist $song = Title $bit = Bitrate", 5, 1 27 145 28
  edit "", 6, 25 57 115 10, autohs
  text "Message:", 7, 1 58 24 8
  button "Set", 8, 7 70 25 10, ok flat
  button "Cancel", 9, 34 70 25 10, cancel flat
} 
on *:dialog:spam:init:0:{
  if ($gettok($hget(tsong,spam),1,32) == msg) did -c spam 3
  if ($gettok($hget(tsong,spam),1,32) == describe) did -c spam 4
  if ($gettok($hget(tsong,spam),1,32) == amsg) did -c spam 1
  if ($gettok($hget(tsong,spam),1,32) == ame) did -c spam 2  
  if ($gettok($hget(tsong,spam),1,32) == msg) || ($gettok($hget(tsong,spam),1,32) == describe) {
    $iif($hget(tsong,spam),did -a spam 6 $gettok($hget(tsong,spam),3-,32),return)
  }    
  else {
    $iif($hget(tsong,spam),did -a spam 6 $gettok($hget(tsong,spam),2-,32),return)
  }
}
on *:dialog:spam:sclick:1: did -u spam 2,3,4
on *:dialog:spam:sclick:2: did -u spam 1,3,4
on *:dialog:spam:sclick:3: did -u spam 1,2,4
on *:dialog:spam:sclick:4: did -u spam 1,2,3
on *:dialog:spam:sclick:8:{
  if ($did(spam,1).state == 0) && ($did(spam,2).state == 0) && ($did(spam,3).state == 0) && ($did(spam,4).state == 0) {
    did -ra spam 6 You need to check a message type.
    halt
  }
  else {
    if ($did(spam,1).state == 1) hadd -m tsong Spam msg #seersmp3 $did(spam,6)
    elseif ($did(spam,2).state == 1) hadd -m tsong Spam msg #seersmp3 $did(spam,6)
    elseif ($did(spam,3).state == 1) hadd -m tsong Spam msg #seersmp3 $did(spam,6)
    elseif ($did(spam,4).state == 1) hadd -m tsong Spam msg #seersmp3 $did(spam,6)
  }
}
dialog id3 {
  title "Id3 Changer"
  size -1 -1 88 90
  option dbu
  list 1, 1 0 86 52, size
  text "Title:", 2, 2 54 13 8
  text "Artist:", 3, 2 65 14 8
  edit "", 4, 16 53 66 10, autohs
  edit "", 5, 16 64 66 10, autohs
  button "Save", 6, 3 76 22 12, flat
  button "Close", 7, 33 76 22 12, flat ok
  button "Cancel", 8, 63 76 22 12, flat cancel
}
on *:dialog:id3:init:0:{
  var %x = 1
  while (%x <= $hget(tsong,0).item) {
    did -a id3 1 $nopath($hget(tsong,%x))
    inc %x  
  }
  if ($didwm(aud,14,*$song $artist $length*)) {
    did -d id3 1 $v1
  }
  elseif ($hget(tsong,spam)) {  
    if ($did(id3,1).lines == $hget(tsong,0).item) {
      did -d id3 1 $did(id3,1).lines
    }
  }
}
on *:dialog:id3:dclick:1:{
  set %song $hget(tsong,$hfind(tsong,$+(*,$did(id3,1).seltext,*),1,w).data)
  did -r id3 5,4  
  if ($sound(%song).artist) did -a id3 5 $ifmatch
  if ($sound(%song).title) did -a id3 4 $ifmatch
}
on *:dialog:id3:sclick:6:{
  $EDIT($shortfn(%song),1,4)
  $EDIT($shortfn(%song),2,5)
}

alias -l EDIT {
  bread $1 $B_CALC($1,128) 3 &tag
  if ($bvar(&tag,1-3).text != TAG) {
    bwrite $1 $B_CALC($1,128) 3 TAG
    bset &fill 125 0
    bwrite $1 $B_CALC($1,125) 124 &fill
    bunset &fill
  }
  if ($did(id3,4)) || ($did(id3,5)) {  
    bset &val $N_BYTE($2) $did(id3,$3)          
    bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) &val
    $iif($2 < 6,.bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) $did(id3,$3))
  }    
  else {
    bset &val 30 $asc($chr(32))
    bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) &val
  }
  bunset &val
}
alias -l B_CALC return $calc($file($1).size - $2)
alias -l N_BYTE return $gettok(30 30 30 4 30 1,$1,32)
alias -l S_BYTE return $calc($file($1).size - $gettok(125 95 65 35 31 1,$2,32))
menu menubar,channel,nicklist {
  Mp3 Controls
  .Mp3 Player or F2:/aud
  .Play or F3:/audplay
  .Stop or F4:/stop
  .Previous or F5:/prev
  .Next or F6:/next
  .Volume Up or F7:/vol -v $calc($vol(master) + 2000)
  .Volume Down or F8:/vol -v $calc($vol(master) - 2000)
  .Join Mp3 Channel or F9:/join #Baked



}
-----------------------------------

; #################################################################
; ## Away system script                                          ##
; ## Designed and written by Tony                                ##
; ## Email: tholtnpt15@hotmail.com                               ##
; ## Written and tested in mIRC 6.17                             ##
; ##  Also tested in mIRC 6.16                                   ##
; ##  May not work correctly in earlier versions                 ##
; ## ----------------------------------------------------------- ##
; ## Usage:                                                      ##
; ##   /Away.Config   - Opens the options dialog                 ##
; ##   /Away [Reason] - Set yourself away                        ##
; ##   /Away [Preset] - Set yourself away using a preset trigger ##
; ##   /Back          - Return from away                         ##
; ## Options are also avaliable via menus                        ##
; #################################################################


; ##############################################
; # Start Idle Away Timer                      #
; ##############################################
on *:start: if ($readini(Settings.ini,Away.Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck

; ##############################################
; # Load Default Options                       #
; ##############################################
on *:load: {
  if (!$readini(AwaySettings.ini,Config,NickEditType))      writeini AwaySettings.ini Config NickEditType Suffix
  if (!$readini(AwaySettings.ini,Config,NickPrefix))        writeini AwaySettings.ini Config NickPrefix Away|
  if (!$readini(AwaySettings.ini,Config,NickSuffix))        writeini AwaySettings.ini Config NickSuffix |Away
  if (!$readini(AwaySettings.ini,Config,NickSetTo))         writeini AwaySettings.ini Config NickSuffix Away
  if (!$readini(AwaySettings.ini,Config,AutoAway))          writeini AwaySettings.ini Config AutoAway off
  if (!$readini(AwaySettings.ini,Config,AutoAwayTime))      writeini AwaySettings.ini Config AutoAwayTime 900
  if (!$readini(AwaySettings.ini,Config,IdleSettings))      writeini AwaySettings.ini Config IdleSettings Suffix~|Idle~Auto away after %time minutes idle
  if (!$readini(AwaySettings.ini,Config,LeavingTime))       writeini AwaySettings.ini Config LeavingTime off
  if (!$readini(AwaySettings.ini,Config,LeavingTimeFormat)) writeini AwaySettings.ini Config LeavingTimeFormat HH:nn:ss
  if (!$readini(AwaySettings.ini,Config,TimeAway))          writeini AwaySettings.ini Config TimeAway off
  if (!$readini(AwaySettings.ini,Config,TimeAwayFormat))    writeini AwaySettings.ini Config TimeAwayFormat Short
  if (!$readini(AwaySettings.ini,Config,ARChannelMessage))  writeini AwaySettings.ini Config ARChannelMessage off
  if (!$readini(AwaySettings.ini,Config,ARPrivateMessage))  writeini AwaySettings.ini Config ARPrivateMessage off
  if (!$readini(AwaySettings.ini,Config,MsgChans))          writeini AwaySettings.ini Config MsgChans on
  if (!$readini(AwaySettings.ini,Config,MsgQueries))        writeini AwaySettings.ini Config MsgQueries off
  if (!$readini(AwaySettings.ini,Config,RespondHilights))   writeini AwaySettings.ini Config RespondHilights on
  if (!$readini(AwaySettings.ini,Config,RespondPM))         writeini AwaySettings.ini Config RespondPM on
  if (!$readini(AwaySettings.ini,Config,RespondNotice))     writeini AwaySettings.ini Config RespondNotice on
  echo -a 4>>> Successfully loaded $remove($script,$scriptdir) - Away System script by Xuck
}

; ##############################################
; # Check for away on connect                  #
; ##############################################
on *:connect: {
  if ($group(#away) == on) {
    if ($($+(%,Away.Newnick.,$network),2) != $me) nick $ifmatch
    ame is currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavtime) $iif($Away.Gonefor,- Gone for $Away.Gonefor)
    !away Away: $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavtime) $iif($Away.Gonefor,- Gone for $Away.Gonefor)
  }
}
; ##############################################
; # Remove Away if unloaded                    #
; ##############################################
on *:unload: { 
  disable #away
  unset %away.*
  hfree away.*.responses
  timerAway.Idlecheck off
}
; ##############################################
; # Cancel Away on exit                        #
; ##############################################
on *:exit: {
  disable #away
  unset %away.*
  timerAway.Idlecheck off
}
; ##############################################
; # Popup Menus                                #
; ##############################################
menu status,channel,menubar,@Away.Logs {
  -
  Away Settings
  .Open away options: dialog $iif($dialog(away),-o,-m) away away
  .$iif($active == @Away.Logs,Close window):window -c $active
  . -
  . Set away $+ $chr(58) $iif($group(#away) == off,on,off): {
    if ($group(#away) == off) away $?="Enter away reason or leave black for default (if set)"
    else back
  }
  .-
  .$iif($group(#away) == on && %Away.Preset == 1,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,1),$style(2))) Preset 1 - $iif($readini(AwaySettings.ini,Presets,1),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,1),1,126)
  .$iif($group(#away) == on && %Away.Preset == 2,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,2),$style(2))) Preset 2 - $iif($readini(AwaySettings.ini,Presets,2),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,2),1,126)
  .$iif($group(#away) == on && %Away.Preset == 3,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,3),$style(2))) Preset 3 - $iif($readini(AwaySettings.ini,Presets,3),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,3),1,126)
  .$iif($group(#away) == on && %Away.Preset == 4,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,4),$style(2))) Preset 4 - $iif($readini(AwaySettings.ini,Presets,4),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,4),1,126)
  .$iif($group(#away) == on && %Away.Preset == 5,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,5),$style(2))) Preset 5 - $iif($readini(AwaySettings.ini,Presets,5),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,5),1,126)
  .$iif($group(#away) == on && %Away.Preset == 6,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,6),$style(2))) Preset 6 - $iif($readini(AwaySettings.ini,Presets,6),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,6),1,126)
  .$iif($group(#away) == on && %Away.Preset == 7,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,7),$style(2))) Preset 7 - $iif($readini(AwaySettings.ini,Presets,7),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,7),1,126)

}

; ##############################################
; # Main Dialog                                #
; ##############################################
dialog away {
  title Away System Settings
  size -1 -1 150 177
  option dbu
  tab "Basic Settings"                 100,0   0     150 156
  tab "Exceptions and Messaging"       200,0   0     150 156
  Box "Default Away Settings",         2,  4   15    142 45, tab 100
  text "Nick:",                        1,  8   28    12  10, tab 100
  combo                                3,  22  26    50  10, drop tab 100
  edit "",                             5,  75  26    50  10, tab 100
  button "?",                          6,  130 26    10  10, tab 100
  text "Default Away Message:",        24, 8   39    100 10, tab 100
  edit "",                             25, 8   47    117 10, autohs tab 100
  button "?",                          26, 130 47    10  10, tab 100
  box "Global Options"                 4,  4   62    142 92, tab 100
  check "A&uto Away After",            7,  12  71    50  10, tab 100
  edit "",                             8,  63  71    10  10, tab 100
  text "minutes.",                     9,  75  72.5  40  10, tab 100
  button "?",                          10, 130 71    10  10, tab 100
  button "options",                    27, 98  71    30  10, tab 100
  check "Show &Leaving Time?"          11, 12  85    60  10, tab 100
  edit ""                              12, 75  85    50  10, tab 100
  button "?",                          13, 130 85    10  10, tab 100
  check "Show &Time Away?"             14, 12  100   55  10, tab 100
  combo                                15, 75  100   50  10, drop tab 100
  button "?",                          16, 130 100   10  10, tab 100
  box "Auto Return"                    17, 7   115   136 35, tab 100
  text "Cancel away on:"               18, 12  125   80  10, tab 100
  check  "&Channel Message"            19, 60  124   50  10, tab 100
  check  "&Private Message"            20, 60  134   50  10, tab 100
  button "?",                          21, 130 134   10  10, tab 100

  ;Exception + messaging options:  - display only does nothing yet
  box "Messaging",                     30, 4   15   142  90, tab 200
  text "Send messages to:",            31, 8   26   50   10, tab 200
  check "All open channels"            32, 60  25   50   10, tab 200
  check "All open queries"             33, 60  35   50   10, tab 200 
  button "?",                          34, 130 26   10   10, tab 200
  box "Response Messages",             35, 8   48   134  38, tab 200
  text "Respond to:",                  36, 12  56   50   10, tab 200
  check "Channel highlight",           37, 60  55   50   10, tab 200
  check "Private message",             38, 60  65   50   10, tab 200
  check "Private notice",              39, 60  75   50   10, tab 200
  button "?",                          40, 130 55   10   10, tab 200
  button "Get mIRC hilights",          42, 18  90   50   10, tab 200
  button "Modify Hilights",            43, 70  90   50   10, tab 200
  button "?",                          44, 130 90   10   10, tab 200
  box "Exceptions",                    45, 4   109  142  24, tab 200
  button "Modify Away System Exceptions"   46, 8   118  100  10, tab 200
  button "?",                          48, 130 118  10   10, tab 200

  button "Edit &Presets"               22, 12  159  60  15
  button "&Ok"                         23, 80  159  60  15, ok
}
; ##############################################
; # Custom presets dialog                      #
; ##############################################
dialog Custom.Aways {
  title Custom Away Messages
  size -1 -1 236 110 
  option dbu
  box  "Custom Away Triggers"          1,  4   4  227 85
  text "Trigger",                      2,  16  12 30  10
  text "Nick Settings",                3,  50  12 50  10
  text "Away Message",                 4,  130 12 50  10
  list                                 5,  10  20 30  50
  list                                 6,  40  20 50  50 
  list                                 7,  90  20 134 50, autohs
  button "Add",                        8,  10  70 50  15
  button "Edit",                       10, 65  70 50  15
  button "Delete",                     9,  120 70 50  15
  button "Clear",                      12, 175 70 50  15
  button "OK",                         11, 90  90 50  15, OK

}
; ##############################################
; # Idle Away Settings + Help dialogs          #
; ##############################################
dialog Idle.Away.Settings {
  title Idle Away Settings
  size -1 -1 120 85
  option dbu
  box "Idle away settings",           1, 4  4  112 55
  text "Nick Settings:",              2, 8  12 50  10
  combo                               3, 8  20 50  10, drop
  edit "",                            4, 62 20 50  10
  text "Idle away message:",          5, 8  35 50  10
  edit "",                            6, 8  43 104 10, autohs
  button "&Help"                      7, 5  65 50  15
  button "&Ok",                       8, 65 65 50  15, OK
}
Dialog Idle.Away.Help {
  title Away System Help
  size -1 -1 150 90
  option dbu
  box "Idle away help",           1, 4  4  142 60
  text "Idle away nick and automatic message settings work in the same way as the default away settings in the main dialog, except that they define the settings used when you are automatically set away from Idle"   2, 8  15  133 25
  text "you can use %time to refer to the time you must idle before being set as away",  3, 8  45  133 20                                                                                                                                                
  button "&Ok",                   4, 50 70 50 15, OK
}
; ##############################################
; # Preset Settings + Help dialogs             #
; ##############################################
dialog Preset.Settings {
  title Preset Settings
  size -1 -1 120 100
  option dbu
  box "Preset settings",              1,  4  4  112 70
  text "Trigger:",                    2,  8  14 50  10
  edit "",                            3,  30 13 50  10
  text "Nick Settings:",              4,  8  27 50  10
  combo                               5,  8  35 50  10, drop
  edit "",                            6,  62 35 50  10
  text "Away message:",               7,  8  50 50  10
  edit "",                            8,  8  58 104 10, autohs
  button "&Help"                      9,  5  80 50  15
  button "&Ok",                       10, 65 80 50  15, OK
}
Dialog Preset.Help {
  title Away System Help
  size -1 -1 150 90
  option dbu
  box "Presets help",             1, 4  4  142 60
  text "Preset nick and Away message settings work in the same way as the default away settings in the main dialog, except that they define the settings used for the preset you are creating"   2, 8  15  133 27
  text "To use a preset once you have created it simply type /Away TRIGGER",  3, 8  45  133 20                                                                                                                                                
  button "&Ok",                   4, 50 70 50 15, OK
}
; ##############################################
; # Exceptions dialogs                         #
; ##############################################
dialog Away.Exceptions {
  title Away System Exceptions
  size -1 -1 120 100
  option dbu
  box "Exceptions"         1,  4  4  112 75
  text "Networks"          2,  8  12  50 10, center
  list                     3,  8  19 50 58
  button "Add"             6,  61 20 50 10
  button "Delete"          7,  61 34 50 10
  button "Edit"            8,  61 49 50 10
  button "Clear"           9,  61 63 50 10
  button "OK"              10, 35 82 50 15, oks
}
dialog Away.AddException {
  title Add Exception
  size -1 -1 156 190
  option dbu
  box "Add Exception"                                                                              1,  4  4   148 165
  text "Network Name:"                                                                             2,  8  16  40  10
  edit ""                                                                                          3,  50 15  60  10
  text "If you are unsure of a network name you can type: //echo -a $network in mIRC to view it."  20, 8  30  130 15
  box "Exception scope"                                                                            4,  8  50  140 55
  Text "This exception affects:"                                                                   5,  12 60  55  10
  radio "Entire network"                                                                           6,  69 59  65  10
  radio "certain channels only"                                                                    7,  69 69  65  10
  Text "Enter Channels to be excepted, seperated by spaces."                                       8,  12 80  130 10
  edit ""                                                                                          9,  12 90  130 10
  box "Exception Options"                                                                          10, 8  110  140 55
  text "On this network:"                                                                          11, 12 120 45  10
  check "Do not change nick"                                                                       12, 55 120 55  10
  check "Do not send away messages"                                                                13, 55 130 80  10
  check "Do not send hilight responses"                                                            14, 55 140 80  10
  check "Do not send PM responses"                                                                 15, 55 150 80  10
  button "OK"                                                                                      16, 53 172 50  15, Ok
}

; ##############################################
; # Help Dialogs                               #
; ##############################################
dialog Away.Help.6 {
  title Away System Help
  size -1 -1 150 120 
  option dbu
  box "Nick Settings Help",                                                                   1, 5  5   140 90
  text "Nick PREFIX: Adds the specified text to the FRONT of your nick when going away",      2, 8  15  133 20
  text "Nick SUFFIX: Adds the specified text to the END of your nick when going away",        3, 8  35  133 20
  text "Set to: Sets your nick to the specified nick when you set away",                      4, 9  55  133 20   
  text "Don’t Change: Means that you’re nick will not change when going away or coming back", 5, 8  75  133 20          
  button "OK",                                                                                7, 50 100 50 15, OK
}
dialog Away.Help.10 {
  title Away System Help
  size -1 -1 150 90 
  option dbu
  box "Auto Away Help",                                                                                1, 5  5  140 60
  text "Enabling Auto-Away will automatically set you as away if you are idle for the specified time", 2, 8  15 134 20
  text "Time must be between 1 and 60 minutes",                                                        3, 8  35 134 20
  text "Options for settings Idle nick and message can be found by clicking the options button",       4, 8  45 134 20
  button "OK",                                                                                         5, 50 70 50 15, ok
}
dialog Away.Help.13 {
  title Away System Help
  size -1 -1 150 80 
  option dbu
  box "Show Leaving Time Help",                                                                                                    1, 5 5 140 50
  text "Enabling 'Show Leaving Time' will display the time you went away in all your away messages in the specified Time Format",  2, 8 15 134 20
  button "Click Here for a list of codes used in time format",                                                                     3, 8 40 134 10
  button "OK",                                                                                                                     4, 50 60 50 15, ok
}
dialog Away.Help.16 {
  title Away System Help
  size -1 -1 150 90 
  option dbu
  box "Show Time Away Help",                                                                                                         1, 5 5 140 60
  text "Enabling 'Show Time Away' will display how long you have been away in all your away messages in the specified Time Format",  2, 8 15 134 20
  text "Example of Short format: 5h 6m 10s"                                                                                          3, 8 40 134 10
  text "Example of Medium format: 5hrs 6mins 10secs"                                                                                 4, 8 48 134 10
  text "Example of long format: 5 hours 6 minutes 10 seconds"                                                                        5, 8 56 134 10
  button "OK",                                                                                                                       6, 50 70 50 15, ok
}
dialog Away.Help.21 {
  title Away System Help
  size -1 -1 150 65 
  option dbu
  box "Automatic Return Help",                                                                                                    1, 5 5 140 35
  text "Enabling 'Automatic Return' will automatically bring you back from away if you send any Channel And/Or Private message",  2, 8 15 134 20
  button "OK",                                                                                                                    5, 50 45 50 15, ok
}
dialog Away.Help.26 {
  title Away System Help
  size -1 -1 150 55
  option dbu
  box "Default Message Help",                                                    1, 5  5  140 27
  text "If you do not enter a reason when going away this default will be used", 2, 8  15 134 20
  button "OK",                                                                   3, 50 35 50 15, ok
}
dialog Away.Help.34 {
  title Away System Help
  size -1 -1 150 60
  option dbu
  box "Message sending help",                                                                                                         1, 5  5  140 32
  text "These options refer to weather your away message will be sent to channels and/or Pm's (Queries) when leaving and returning.", 2, 8  15 134 20
  button "OK",                                                                                                                        3, 50 40 50 15, ok
}
dialog Away.Help.40 {
  title Away System Help
  size -1 -1 150 80
  option dbu
  box "Auto Response Help",                                                                                       1, 5  5  140 50
  text "These options refer to what actions will trigger an auto message alerting the person that you are away.", 2, 8  15 134 20
  text "Channel highlight is triggered whenever someone says a word that is in your hilights list",               3, 8  35 134 20
  button "OK",                                                                                                    4, 50 60 50  15, ok
}
dialog Away.Help.44 {
  title Away System Help
  size -1 -1 150 120
  option dbu
  box "Hilight help",                                                                                                                                                        1, 5  5  140 92
  text "'Hilight' occurs whenever somebody says a word that is in your hilights list.",                                                                                      2, 8  15 134 20
  text "Your away hilights determine what words, when said, will cause the script to notify the person that you are away, and log the message",                              3, 8  31 134 20
  text "If you have hilights set in mIRC you can click 'Get mIRC Hilights' to have the away system use these same hilights",                                                 4, 8  54 134 20
  text "You may also add or modify seperate ones using the 'Modify Hilights' button. Note that Identifiers such as $me (which refers to your current nick) are also allowed" 5, 8  75 134 20
  button "OK",                                                                                                                                                               6, 50 100 50  15, ok
}
dialog Away.Help.48 {
  title Away System Help
  size -1 -1 150 65
  option dbu
  box "Exceptions help",                                                                                                                        1, 5  5  140 35
  text "Exceptions allow you to specify networks/channels in which away messages are not sent, or networks in which your nick is not changed",  2, 8  15 134 25      
  button "OK",                                                                                                                                  3, 50 45 50  15, ok
}

dialog Away.Help.Time {
  title Away System Help
  size -1 -1 150 155
  option dbu
  box "Time Format Help",                                                   1, 5 5 140 120
  text "The following is a list of Codes that can be used in Time Formats", 2, 8 15 134 20
  box "Time Format Codes",                                                  3, 8 30 134 88
  list                                                                      4, 20 40 20 75
  list                                                                      5, 40 40 90 75
  button "OK",                                                              6, 50 130 50 15, ok
}


; ##############################################
; # Dialog Initiation events                   #
; ##############################################
; ----- Populate Time help
on *:dialog:Away.Help.Time:init:*: {
  did -a $dname 4 HH
  did -a $dname 5 Hours - 2 Digit 24 hour time - $time(HH)
  did -a $dname 4 H 
  did -a $dname 5 Hours - 1 Digit 24 hour time - $time(H)
  did -a $dname 4 hh
  did -a $dname 5 Hours - 2 Digit 12 hour time - $time(hh)
  did -a $dname 4 h
  did -a $dname 5 Hours - 1 Digit 12 hour time - $time(h)
  did -a $dname 4 nn 
  did -a $dname 5 Minutes - 2 Digit - $time(nn)
  did -a $dname 4 n
  did -a $dname 5 Minutes - 1 Digit - $time(n)
  did -a $dname 4 ss 
  did -a $dname 5 Seconds - 2 Digit - $time(ss)
  did -a $dname 4 s
  did -a $dname 5 Seconds - 1 Digit - $time(s)
  did -a $dname 4 tt
  did -a $dname 5 am/pm - Lower case - $time(tt)
  did -a $dname 4 TT
  did -a $dname 5 AM/PM - Upper Case - $time(TT)
}
; ----- Populate main dialog settings
on *:dialog:away:init:*: {
  ;Tab 100 Controls
  did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Prefix,c) $dname 3 Prefix
  did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Suffix,c) $dname 3 Suffix
  did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Set to,c) $dname 3 Set to
  did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Don't Change,c) $dname 3 Don't Change
  if ($readini(AwaySettings.ini,Config,NickEditType) == Don't Change) did -m $dname 5
  if ($readini(AwaySettings.ini,Config,NickPrefix)) && ($did(away,3).seltext == Prefix) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickPrefix) 
  if ($readini(AwaySettings.ini,Config,NickSuffix)) && ($did(away,3).seltext == Suffix) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickSuffix)
  if ($readini(AwaySettings.ini,Config,NickSetTo)) && ($did(away,3).seltext == Set To) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickSetTo)
  if ($readini(AwaySettings.ini,Config,AutoAway) == on) did -c $dname 7 | else did -m $dname 8
  if ($readini(AwaySettings.ini,Config,AutoAwayTime)) did -a $dname 8 $calc($ifmatch / 60) | else did -a $dname 8 900
  if ($readini(AwaySettings.ini,Config,LeavingTime) == on) did -c $dname 11                | else did -m $dname 12
  if ($readini(AwaySettings.ini,Config,LeavingTimeFormat)) did -a $dname 12 $ifmatch       | else did -a $dname 12 HH:nn:ss
  if ($readini(AwaySettings.ini,Config,TimeAway) == on) did -c $dname 14                   | else did -b $dname 15
  if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Short) did -ac $dname 15 Short   | else did -a $dname 15 Short
  if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Medium) did -ac $dname 15 Medium | else did -a $dname 15 Medium
  if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Long) did -ac $dname 15 Long     | else did -a $dname 15 Long
  if ($readini(AwaySettings.ini,Config,ARChannelMessage) == on) did -c $dname 19
  if ($readini(AwaySettings.ini,Config,ARPrivateMessage) == on) did -c $dname 20
  if ($readini(AwaySettings.ini,Config,DefaultMessage)) did -a $dname 25 $ifmatch
  ;Tab 200 controls
  if ($readini(AwaySettings.ini,Config,MsgChans) == on) did -c $dname 32
  if ($readini(AwaySettings.ini,Config,MsgQueries) == on) did -c $dname 33
  if ($readini(AwaySettings.ini,Config,RespondHilights) == on) did -c $dname 37
  if ($readini(AwaySettings.ini,Config,RespondPM) == on) did -c $dname 38
  if ($readini(AwaySettings.ini,Config,RespondNotice) == on) did -c $dname 39
}
; ----- Populate Custom presets list
on *:dialog:Custom.Aways:init:*: {
  var %x = 1
  while (%x <= 7) {
    if ($readini(AwaySettings.ini,Presets,%x)) {
      did -a $dname 5 $gettok($v1,1,126)
      did -a $dname 6 $gettok($v1,2,126)
      did -a $dname 7 $gettok($v1,3-,126)
    } 
    else halt
    inc %x
  }
}
; ----- Populate Idle Away Settings
on *:dialog:Idle.Away.Settings:init:*: {
  tokenize 126 $readini(AwaySettings.ini,n,Config,IdleSettings)
  did -a $+ $iif($1 == Prefix,c) $dname 3 Prefix
  did -a $+ $iif($1 == Suffix,c) $dname 3 Suffix
  did -a $+ $iif($1 == Set to,c) $dname 3 Set to
  did -a $+ $iif($1 == Don't Change,c) $dname 3 Don't Change
  if ($1 == Don't Change) did -m $dname 5
  else did -ra $dname 4 $2
  if ($3) did -a $dname 6 $3-
}
; ----- Populate Preset settings
on *:dialog:Away.Preset:init:*: {
  if (%Away.EditPreset) {
    var %pre = %Away.EditPreset, %trigger = $did(Custom.Aways,5).seltext
    var %edittype = $gettok($did(Custom.Aways,6).seltext,1,58), %nickedit = $gettok($did(Custom.Aways,6).seltext,2,58)
    var %reason = $did(Custom.Aways,7).seltext
    did -a $dname  3 %trigger
    did -a $+ $iif(%edittype == Prefix,c) $dname 5 Prefix
    did -a $+ $iif(%edittype == Suffix,c) $dname 5 Suffix
    did -a $+ $iif(%edittype == Set to,c) $dname 5 Set to
    did -a $+ $iif(%edittype == Don't Change,c) $dname 5 Don't Change
    if (%edittype == Don't Change) did -m $dname 6
    else did -ra $dname 6 %nickedit
    if (%reason) did -a $dname 8 %reason
  }
  else {
    did -a $dname 5 Prefix
    did -a $dname 5 Suffix
    did -a $dname 5 Set to
    did -a $dname 5 Don't Change
  }
}
; Exception initiation events
on *:dialog:Away.Exceptions:init:*: {
  var %x = 1,%total = $ini(AwaySettings.ini,Exceptions,0)
  while (%x <= %total) {
    did -a $dname 3 $ini(AwaySettings.ini,Exceptions,%x)
    inc %x
  }
}
on *:dialog:Away.AddException:init:*: {
  if (%Away.Exception) {
    var %info = $readini(AwaySettings.ini,Exceptions,%away.Exception)
    var %scope = $gettok(%info,1,126), %options = $gettok(%info,2,126), %chans = $gettok(%info,3-,126)
    did -a $dname 3 %Away.Exception
    if (%scope == 1) {
      did -c $dname 6
      did -b $dname 9
    }
    else {
      did -c $dname 7
      did -b $dname 12,15
      did -e $dname 9
      did -a $dname 9 %chans
    }
    if ($left(%options,1) == 1) && (%scope == 1) did -c $dname 12
    if ($mid(%options,2,1) == 1) did -c $dname 13
    if ($mid(%options,3,1) == 1) did -c $dname 14
    if ($right(%options,1) == 1) && (%scope == 1) did -c $dname 15
  }
  else {
    did -c $dname 6
    did -b $dname 9
  }
}

; ##############################################
; # Dialog Sclick Events                       #
; ##############################################
; ----- Open Time Help dialog
on *:dialog:Away.Help.13:sclick:3: {
  dialog $iif($dialog(Away.Help.Time),-o,-m) Away.Help.Time Away.Help.Time
  dialog -x $dname
}
; ----- Select same line in each column in time help dialog
on *:dialog:Away.Help.Time:sclick:*: {
  if ($did == 4) did -c $dname 5 $did(4).sel
  elseif ($did == 5) did -c $dname 4 $did(5).sel
}
; ----- Processing clicks for main dialog
on *:dialog:away:sclick:*: {
  ; Tab 100
  if ($did == 3) {
    writeini AwaySettings.ini Config NickEditType $did(3).seltext
    if ($did(3).seltext == Prefix) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickPrefix)
    elseif ($did(3).seltext == suffix) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickSuffix)
    elseif ($did(3).seltext == Set to) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickSetTo)
    else did -rm $dname 5 
  }
  if ($did == 7) && ($did(7).state == 0)  did -m $dname 8 
  elseif ($did == 7) && ($did(7).state == 1) did -n $dname 8
  elseif ($did == 11) && ($did(11).state == 0) did -m $dname 12
  elseif ($did == 11) && ($did(11).state == 1) did -n $dname 12
  elseif ($did == 14) && ($did(14).state == 0) did -b $dname 15
  elseif ($did == 14) && ($did(14).state == 1) did -e $dname 15
  elseif ($istok(6|10|13|16|21|26|34|40|44|48,$did,124)) dialog $iif($dialog($+(Away.Help.,$did)),-o,-m) $+(Away.Help.,$did) $+(Away.Help.,$did)
  elseif ($did == 22) dialog $iif($dialog(Custom.Aways),-o,-m) Custom.Aways Custom.Aways 
  elseif ($did == 27) dialog $iif($dialog(Idle.Away.Settings),-o,-m) Idle.Away.Settings Idle.Away.Settings
  ; Tab 200
  elseif ($did == 42) {
    if ($input(Retrieved the following hilights from your current mIRC settings: $crlf $crlf $+ $Get.Highlights $Crlf $crlf $+ Would you like to use these as your away system highlights? You can use the 'Modify Hilights' button to modify or add to these.,yi,Highlights)) {
      writeini AwaySettings.ini Config Hilights $Get.Highlights
    }
  }
  elseif ($did == 43) {
    var %hilights = $input(Enter Hilight words or identifiers seperated by commans ONLY. $crlf $+ Eg: $+($me,$chr(44),ALTNICK,$chr(44),$ $+ me),oe,Modify Hilights,$readini(AwaySettings.ini,n,Config,Hilights)))
    if (%hilights) writeini AwaySettings.ini Config Hilights $remove(%hilights,$chr(32))
    else remini Settings.ini Away.Config Hilights
  }
  elseif ($did == 46) { 
    dialog $iif($dialog(Away.Exceptions),-v,-m) Away.Exceptions Away.Exceptions
  }
}
; ----- Process button clicks and keep selection of all columns the same in presets dialog
on *:dialog:Custom.Aways:sclick:*: { 
  if ($did == 5)     did -c $dname 6,7 $did(5).sel
  elseif ($did == 6) did -c $dname 5,7 $did(6).sel
  elseif ($did == 7) did -c $dname 5,6 $did(7).sel
  elseif ($did == 8) dialog $iif($dialog(Away.Preset),-v,-m) Away.Preset Preset.Settings
  elseif ($did == 9) {
    if (!$did(5).sel) var %x = $input(Error: You must select an entry to delete,wo,Invalid Selection) 
    elseif ($?!="Are you sure you want to delete this entry - $did(5).seltext ") {
      did -d $dname 5 $did(5).sel  
      did -d $dname 6 $did(6).sel  
      did -d $dname 7 $did(7).sel  
    }
  }
  elseif ($did == 10) {
    if (!$did(5).sel) { var %x = $input(Error: You must select an entry to edit,wo,Invalid Selection) | halt } 
    set %Away.EditPreset $did(5).sel
    dialog $iif($dialog(Away.Preset),-v,-m) Away.Preset Preset.Settings
  }
  elseif ($did == 12) {
    if ($input(Are you sure you want to clear all your presets?,qy,Validation Prompt)) {
      var %x = 7
      while (%x > 0) {
        did -c $dname 5 %x
        if ($did(5).seltext) did -d $dname 5,6,7 $did(5).sel
        dec %x
      }
    }
  }
} 

; ----- Process Idle Away clicks/settings
on *:dialog:Idle.Away.Settings:sclick:*: {
  var %time = $calc($readini(AwaySettings.ini,Config,AutoAwayTime) / 60)
  if ($did == 3) {
    if ($did(3).seltext == Don't Change) did -rm $dname 4
    else did -n $dname 4
  } 
  elseif ($did == 7) dialog $iif($dialog(Idle.Away.help),-v,-m) Idle.Away.help Idle.Away.Help
}
; ----- Process Preset dialog clicks/settings
on *:dialog:Away.Preset:sclick:*: {
  if ($did == 5) {
    if ($did(5).seltext == Don't Change) did -rm $dname 6
    else did -n $dname 6
  }
  elseif ($did == 9) dialog $iif($dialog(Preset.Help),-v,-m) Preset.Help Preset.Help
}
; ----- Exception Clicks
on *:dialog:Away.Exceptions:sclick:*: {
  if ($did == 6) dialog $iif($dialog(Away.AddException),-v,-m) Away.AddException Away.AddException
  elseif ($did == 7) {
    if (!$did(3).sel) var %x = $input(You must select an entry to delete,wo,Invalid Selection)
    elseif ($?!="Are you sure you want to delete this entry - $did(3).seltext ") {
      remini AwaySettings.ini Exceptions $did(3).seltext
      did -d $dname 3 $did(3).sel
    }
  }
  elseif ($did == 8) {
    if (!$did(3).sel) var %x = $input(You must select an entry to edit,wo,Invalid Selection)
    else { 
      set %Away.Exception $did(3).seltext
      set %Away.ExceptionNum $did(3).sel
      dialog $iif($dialog(Away.AddException),-v,-m) Away.AddException Away.AddException
    }
  }
  elseif ($did == 9) {
    if ($input(Are you sure you want to clear all your network exceptions?,qy,Validation Prompt)) {
      var %x = $did(3).lines
      remini AwaySettings.ini Exceptions
      while (%x > 0) {
        did -c $dname 3 %x
        if ($did(3).seltext) did -d $dname 3 $did(3).sel
        dec %x
      }
    }
  }
}
on *:dialog:Away.AddException:Sclick:*: { 
  if ($did == 6) { 
    did -e $dname 12,15 
    did -b $dname 9 
    did -r $dname 9
  } 
  elseif ($did == 7) { 
    did -b $dname 12,15 
    did -e $dname 9 
    if ($did(12).state == 1) did -u $dname 12
    if ($did(15).state == 1) did -u $dname 15
  }
}
; ##############################################
; # Dialog Close Events                        #
; ##############################################
; ----- Main dialog - save data
on *:dialog:Away:close:*: {
  ; tab 100 settings
  if ($did(5)) {
    if ($did(3).seltext == Prefix) writeini AwaySettings.ini Config NickPrefix $did(5)
    elseif ($did(3).seltext == Suffix) writeini AwaySettings.ini Config NickSuffix $did(5)
    elseif ($did(3).seltext == Set to) writeini AwaySettings.ini Config  NickSetTo $did(5)
  }  
  else { 
    writeini AwaySettings.ini Config NickPrefix Away|
    writeini AwaySettings.ini Config NickSuffix |Away
  }
  writeini AwaySettings.ini Config AutoAway $iif($did(7).state == 0,off,on)
  writeini AwaySettings.ini Config AutoAwayTime $iif($did(8),$calc($did(8) * 60),900)
  writeini AwaySettings.ini Config LeavingTime $iif($did(11).state == 0,off,on)
  writeini AwaySettings.ini Config LeavingTimeFormat $iif($did(12),$did(12),HH:nn:ss)
  writeini AwaySettings.ini Config TimeAway $iif($did(14).state == 0,off,on)
  writeini AwaySettings.ini Config TimeAwayFormat $iif($did(15),$did(15),Shorts)
  writeini AwaySettings.ini Config ARChannelMessage $iif($did(19).state == 0,off,on)
  writeini AwaySettings.ini Config ARPrivateMessage $iif($did(20).state == 0,off,on)
  if ($did(25)) writeini AwaySettings.ini Config DefaultMessage $did(25)
  else remini Settings.ini Away.Config DefaultMessage
  if ($readini(AwaySettings.ini,Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
  elseif ($timer(Away.IdleCheck)) .timerAway.IdleCheck off

  ;Tab 200 settings
  writeini AwaySettings.ini Config MsgChans $iif($did(32).state == 0,off,on)
  writeini AwaySettings.ini Config MsgQueries $iif($did(33).state == 0,off,on)
  writeini AwaySettings.ini Config RespondHilights $iif($did(37).state == 0,off,on)
  writeini AwaySettings.ini Config RespondPM $iif($did(38).state == 0,off,on)
  writeini AwaySettings.ini Config RespondNotice $iif($did(39).state == 0,off,on)
}
; ----- Save presets
on *:dialog:Custom.Aways:close:*: {
  var %x = 1, %lines = $did(5).lines
  while (%x <= %lines) {
    did -c $dname 5,6,7 %x
    writeini AwaySettings.ini presets %x $+($did(5).seltext,~,$did(6).seltext,~,$did(7).seltext)
    inc %x
  }
  dec %x
  while (%x < 7) {
    inc %x
    if ($readini(AwaySettings.ini,presets,%x)) remini AwaySettings.ini Presets %x
  }
}
; ----- Save Idle away settings
on *:dialog:Idle.Away.Settings:close:*: {
  writeini AwaySettings.ini Config IdleSettings $+($did(3).seltext,~,$iif($did(4),$ifmatch,IDLE),~,$iif($did(6),$ifmatch,Auto away after % $+ time minutes idle))
}
; ----- Save Preset settings
on *:dialog:Away.Preset:close:*: {
  var %pre = %away.EditPreset
  if (!$did(3)) var %x = $input(Error: No trigger was specified,ow,Input Error)
  elseif (!$did(6)) && ($did(5).seltext != Don't Change) var %x = $input(Error: You did not specify $iif($did(5).seltext,a nick $iif($did(5).seltext == set to,to change to,$ifmatch),any nick settings),ow,Input Error)
  elseif ($remove($did(6),$chr(91),$chr(93),$chr(92),$chr(45),$chr(95),$chr(123),$chr(124),$chr(125)) !isalnum) && ($did(6)) { var %x = $input(Error: Invalid Characters detected in specified nick,wo,Input Error) | halt }
  elseif (!$did(5).seltext) var %x = $input(Error: You have not specified how to change your nick - Select an option from the nick settings drop down,ow,Error)
  elseif ($numtok($did(3),32) > 1) || ($numtok($did(6),32) > 1) var %x = $input(Error: Trigger and nick Settings can each only be one word long,wo,Input Error)
  else {
    did $iif(%pre,-o,-a) Custom.Aways 5 $iif(%pre,%pre) $did(3)
    did $iif(%pre,-o,-a) Custom.Aways 6 $iif(%pre,%pre) $did(5).seltext $+ $iif($did(5).seltext != Don't Change,: $did(6))
    did $iif(%pre,-o,-a) Custom.Aways 7 $iif(%pre,%pre) $did(8)
    unset %away.EditPreset
  }
}
; ---- Save Exception settings
on *:dialog:Away.AddException:close:*: {
  if (!$did(3)) var %x = $input(No Network name was entered,wo,Input Error)
  elseif ($numtok($did(3),32) > 1) var %x = $input(Network name may not contain spaces,wo,Input Error)
  else {
    var %scope = $iif($did(6).state == 1,1,2)
    var %x = 1, %numchans = $numtok($did(9),32)
    while (%x <= %numchans) {
      var %token = $gettok($did(9),%x,32) 
      if (#?* iswm %token) var %chans = %chans %token
      elseif (%token != $chr(35)) var %chans = %chans $+($chr(35),%token)
      inc %x
    }
    var %x = 12
    while (%x <= 15) {
      var %options = %options $+ $did(%x).state
      inc %x
    }  
    did $iif(%Away.ExceptionNum,-o,-a) Away.Exceptions 3 $iif(%Away.ExceptionNum,$ifmatch) $did(3)
    writeini AwaySettings.ini Exceptions $did(3) $+(%scope,~,%options,~,%chans)
    unset %Away.Exception*
  }
}
; ##############################################
; # /Away And /back aliases                    #
; ##############################################
alias away {
  ; ----- Unset Idle timer, Get highlights, enable #away group for logging etc
  if ($timer(Away.IdleCheck)) .timerAway.IdleCheck off
  set %Away.Hilights $readini(awaySettings.ini,n,Config,Hilights)
  .enable #away

  ; ---- Retrieve away settings from config/User entry
  var %time = $calc($readini(AwaySettings.ini,Config,AutoAwayTime) / 60)
  if ($1) set %away.Reason $1- 
  elseif ($readini(AwaySettings.ini,Config,DefaultMessage)) set %away.Reason $v1
  set %Away.LeftAt $ctime
  if ($readini(AwaySettings.ini,Config,LeavingTime) == on) {
    var %LeavingTimeFormat = $readini(AwaySettings.ini,Config,LeavingTimeFormat)
    set %away.LeaveTime $time(%LeavingTimeFormat)
  }
  ; ---- Check for idleaway
  If ($1- = Auto.Idle.Away) {
    var %IdleInfo = $readini(AwaySettings.ini,Config,IdleSettings)
    var %edittype = $gettok(%IdleInfo,1,126)
    if (%edittype == Set to) var %nickset = $gettok(%IdleInfo,2,126)
    else var %nickadd = $gettok(%IdleInfo,2,126)
    set %Away.Reason $($gettok(%IdleInfo,3-,126),2)
  }
  else {
    var %edittype = $readini(AwaySettings.ini,Config,NickEditType)
    if (%edittype == Set To) var %nickset = $readini(AwaySettings.ini,Config,NickSetTo)
    else var %nickadd = $readini(AwaySettings.ini,Config,Nick $+ %edittype) 
  }
  ; ----- Check for presets
  var %x 1 
  while (%x <= 7) {
    if ($readini(AwaySettings.ini,Presets,%x)) {
      var %preset = $v1
      if ($1- == $gettok(%preset,1,126)) {
        var %edittype = $gettok($gettok(%preset,2,126),1,58)
        var %nickadd = $remove($gettok($gettok(%preset,2,126),2,58),$chr(32))
        set %Away.Reason $gettok(%preset,3-,126)
        set %Away.Preset %x
        var %x = 7
      }
    }
    inc %x
  }
  ; ----- Cycle Connections to change nick/send msg
  var %x = 1, %connections = $scon(0) 
  while (%x <= %connections) {
    scon %x
    if ($status == connected) {
      unset %Except.*
      if ($readini(AwaySettings.ini,Exceptions,$network)) {
        var %Except.info = $v1
        var %Except.Scope = $gettok(%Except.info,1,126)
        var %Except.Options = $gettok(%Except.info,2,126)
        if (%Except.Scope == 2) && ($mid(%Except.Options,2,1) == 1) var %Except.NoMsgChans = $gettok(%Except.Info,3-,126)
        if (%Except.Scope == 1) && ($left(%Except.Options,1) == 1) var %Except.NoNickChange = 1
        if (%Except.Scope == 1) && ($mid(%Except.Options,2,1) == 1) var %Except.NoAwayMsg = 1
      }
      set $+(%,Away.Oldnick.,$network) $me
      if ($readini(AwaySettings.ini,Config,NickEditType) != Don't Change) && (!%Except.NoNickChange) {
        if (%edittype == Set To) && (%NickSet != $me) var %newnick = %NickSet 
        if (%edittype == Prefix) && ($+(%nickadd,*) !iswm $me) var %newnick = $+(%nickadd,$me)
        if (%edittype == Suffix) && ($+(*,%nickadd) !iswm $me) var %newnick = $+($me,%nickadd)
        set $+(%,Away.Newnick.,$network) $iif(%newnick,$ifmatch,$me)
        if (%newnick) nick %newnick
      }
      if ($chan(0)) && ($readini(AwaySettings.ini,Config,MsgChans) == on) && (!%Except.NoAwayMsg) {
        var %Chan = 1, %TotalChans = $chan(0)
        while (%chan <= %TotalChans) {
          if (!$istok(%Except.NoMsgChans,$chan(%chan),32)) describe $chan(%chan) 4 is now away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime)           
          inc %chan
        }
      }
      if ($readini(AwaySettings.ini,Config,MsgQueries) == on) && (!%Except.NoAwayMsg)  {
        qme 4 is now away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime)
      }
      !away Away: $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime) 
    }
    inc %x
  }
}

alias back {
  var %x = 1, %connections = $scon(0) 
  while (%x <= %connections) {
    scon %x
    if ($status == connected) {
      unset %Except.*
      if ($readini(AwaySettings.ini,Exceptions,$network)) {
        var %Except.info = $v1
        var %Except.Scope = $gettok(%Except.info,1,126)
        var %Except.Options = $gettok(%Except.info,2,126)
        if (%Except.Scope == 2) && ($mid(%Except.Options,2,1) == 1) var %Except.NoMsgChans = $gettok(%Except.Info,3-,126)
        if (%Except.Scope == 1) && ($left(%Except.Options,1) == 1) var %Except.NoNickChange = 1
        if (%Except.Scope == 1) && ($mid(%Except.Options,2,1) == 1) var %Except.NoAwayMsg = 1
      }

      if (!%Except.NoNickChange) && ($($+(%,Away.Oldnick.,$network),2)) nick $ifmatch 

      ; ----- Cycle Connections to change nick/send msg
      if ($chan(0)) && ($readini(AwaySettings.ini,Config,MsgChans) == on) && (!%Except.NoAwayMsg) {
        var %Chan = 1, %TotalChans = $chan(0)
        while (%chan <= %TotalChans) {
          if (!$istok(%Except.NoMsgChans,$chan(%chan),32)) describe $chan(%chan) 4 is back $iif(%away.Reason,- from %Away.Reason) $iif(%Away.Leavetime,- Left at %Away.Leavetime) $iif($Away.GoneFor,- Gone for $Away.GoneFor)   
          inc %chan
        }
      }
      if ($readini(AwaySettings.ini,Config,MsgQueries) == on) && (!%Except.NoAwayMsg) {
        qme 4 is now away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime)
      }
      !away
    }
    inc %x
  }
  .disable #away 
  unset %away.* 
  if ($hget(Away.PM.Responses)) || ($hget(Away.Highlight.Responses)) hfree -w Away.*.Responses 
  if ($readini(AwaySettings.ini,Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
}
; ##############################################
; # Other Aliases                              #
; ##############################################
alias -l Away.Gonefor {
  if ($readini(AwaySettings.ini,Config,TimeAway) == on) {
    var %TimeAwayFormat = $readini(AwaySettings.ini,Config,TimeAwayFormat)
    if (%Away.LeftAt) {
      var %duration = $duration($calc($ctime - %Away.LeftAt),%TimeAwayFormat)
      if (%TimeAwayFormat == Short) return $Short.Duration(%duration)
      elseif (%TimeAwayFormat == medium) return %duration
      elseif (%TimeAwayFormat == long) return $Long.Duration(%duration)
    }
  }
  else return $false
}
alias -l Short.Duration return $replacex($1-,secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w)
alias -l Long.Duration return $replacex($1-,sec,second,secs,seconds,min,minute,mins,minutes,hr,hour,hrs,hours,wk,week,wks,weeks)

alias -l Get.Highlights {
  var %x = 1, %Groups = $ini(mirc.ini,highlight,0)
  while (%x <= %groups) {
    var %Away.Highlights = $addtok(%Away.highlights,$highlight(%x),44)
    inc %x
  }
  return %Away.Highlights
}
alias -l Check.For.highlights { 
  if (!%Away.Highlights) set %Away.Highlights $readini(AwaySettings.ini,n,Config,Hilights)
  var %x = 1, %highlights = $numtok(%Away.highlights,44)
  while (%x <= %highlights) {
    var %chighlight = $($gettok(%Away.Highlights,%x,44),2)
    if ($istok($1-,%chighlight,32)) return %chighlight
    inc %x
  }
  return $false
}
alias -l Away.Logwin {
  if (!$window(@Away.Logs)) window -eknz @Away.Logs
  echo -ti2 @Away.Logs $1-
}
alias -l Highlight.Response {
  if (!$hget(Away.highlight.Responses,$+($1,.,$2))) {
    scid $1 .notice $2 I am currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.LeaveTime,- Left at %Away.LeaveTime) $iif($away.gonefor,- Gone for $away.gonefor) - One time response to highlight
    hadd -m Away.Highlight.Responses $+($1,.,$2) 1
  }
}
alias -l Private.Message.Response {
  if (!$hget(Away.PM.Responses,$+($1,.,$2))) {
    scid $1 .notice $2 I am currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.LeaveTime,- Left at %Away.LeaveTime) $iif($away.gonefor,- Gone for $away.gonefor) - One time response to Private Message
    hadd -m Away.PM.Responses $+($1,.,$2) 1
  }
}
alias -l Away.IdleCheck {
  var %x = 1, %networks = $scon(0) 
  var  %AutoAwayTime = $readini(AwaySettings.ini,Config,AutoAwayTime)
  while (%x <= %networks) {
    scon %x {
      if ($status == Connected) && ($idle < %AutoAwayTime) var %Idle = off
    }    
    inc %x
  }
  if (%idle != off) away Auto.Idle.Away
}
alias Away.Config dialog  $iif($dialog(Away),-v,-m) Away Away
; ##############################################
; # Logging and hilight resposes               #
; ##############################################
#away off
;Hilight responses
on *:text:*:#: {
  if (!$Check.For.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return
  else {
    Away.Logwin 4[10CHANNEL MESSAGE4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),$chan,12/10,$nick,4]) $1-
    if ($readini(AwaySettings.ini,Exceptions,$network)) {
      var -s %Except.info = $v1
      var -s %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
      if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
      elseif (%Except.Scope == 1) && ($mid(%Except.Options,3,1) == 1) return
    }
    if (!$istok(%Except.NoHilight,$chan,32)) && ($readini(AwaySettings.ini,Config,RespondHilights) == on) Highlight.Response $cid $nick 
  }
}
on *:action:*:#: {
  if (!$check.for.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return
  else {
    Away.Logwin 4[10CHANNEL  10ACTION4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),$chan,12/10,$nick,4]) * $nick $1-
    if ($readini(AwaySettings.ini,Exceptions,$network)) {
      var %Except.info = $v1
      var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
      if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
      elseif (%Except.Scope == 1) && ($mid(%Except.Options,3,1) == 1) return
    }    
    if (!$istok(%Except.NoHilight,$chan,32)) && ($readini(AwaySettings.ini,Config,RespondHilights) == on) Highlight.Response $cid $nick 
  }
}
; Private notice response
on *:notice:*:?: {
  if (*serv !iswm $nick) {
    Away.Logwin 4[10PRIVATE NOTICE4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),Private,12/10,$nick,4]) $1-
    if ($readini(AwaySettings.ini,Exceptions,$network)) {
      var %Except.info = $v1
      var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
      if (%Except.Scope == 1) && ($right(%Except.Options,1) == 1) return
    }   
    if ($readini(AwaySettings.ini,Config,RespondNotice) == on) Private.Message.Response $cid $nick 
  }
}
;PM responses
on *:text:*:?: {
  if ($readini(AwaySettings.ini,Config,RespondPM) == on) && (*serv !iswm $nick) {
    if ($readini(AwaySettings.ini,Exceptions,$network)) {
      var %Except.info = $v1
      var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
      if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
      elseif (%Except.Scope == 1) && ($right(%Except.Options,1) == 1) return
    }   
    Private.Message.Response $cid $nick
  }
}
;Return from away on input if set
on *:input:#: {
  if ($left($1,1) != $readini(mirc.ini,text,commandchar)) {
    if ($readini(AwaySettings.ini,Config,ARChannelMessage) == on) back
  }
}
on *:input:?: {
  if ($left($1,1) != $readini(mirc.ini,text,commandchar)) {
    if ($readini(AwaySettings.ini,Config,ARPrivateMessage) == on) back
  }
}
#away end
--------------------------
menu channel,nicklist,query,status,menubar {
  My Friends
  .Add/remove
  ..add $$1 Friend:/notify $$1 $$?="This space is for you to add a personal note to yourself of who the user is add their runescape nick,email,name or just a short note & click ok examples:-Staff-HelpOp-:"
  ..remove $$1 Friend:/notify -r $$1
  ..add Friend by nick://notify $$?="Friends nick:" $$?="This space is for you to add a personal note to yourself of who the user is add their runescape nick,email,name or just a short note & click ok examples:-Staff-HelpOp-:"
  ..Remove Friend by nick://notify -r $$?="Friends to remove:"  
  .Friends Notify
  ..Yes,notify me in channel:/set %notifyme on
  ..No:/set %notifyme off
  .Friends Config:/uwho

}


on ^*:notify:{
  if (%notifyme == on) && ($me == $me) {
  echo -a 9*** 4[9Notify4] 6:4:9 $nick 0(0 $notify($nick).note 0) 9is 9Online  | haltdef }
}
elseif if (%notifyme == off} {
  halt 
}
-------------------------
Dialog nickoptions {
  Title "Xuck Nick Config"
  Size -1 -1 270 130
  Button "Register New Account", 1, 10 10 250 25, Register New Account
  Button "Auto Idenitfy ON", 2, 10 35 250 25, Auto Identify
  Button "Auto Identify OFF", 3, 10 60 250 25, Auto Identify
  Button "Cancel", 10, 100 90 80 25, cancel
}

; dialog events.
On *:DIALOG:nickoptions:*:*:{
  ; $devent returns the event which is happening, in this case it checks if its ‘init’
  ; init is the initial, which executes on startup, $did returns the dialog id
  ; since the dialog it self, doesn’t have an ID, and only a name, $did returns 0.


  ; sclick is single click, on id 1 (the OK button)
  if ($devent == sclick) && ($did == 1) {
    RegisterNewAccount | /halt
  }
  elseif ($devent == sclick) && ($did == 2) {
    AutoIdentON | /halt
  }
  elseif ($devent == sclick) && ($did == 3) {
    AutoIdentOFF | /halt
  }


}
--------------------------------

  Size -1 -1 270 260
  Button "Nick Config Panel", 1, 10 10 250 25, Nick Config Panel
  Button "Auto Join Channels Config", 2, 10 35 250 25, Auto Join Channels Config
  Button "Away System Config", 3, 10 60 250 25, Away System Config 
  Button "Xuck Mp3 Player Config", 4, 10 85 250 25, Xuck Mp3 Player Config
  Button "My Friends Config", 5, 10 110 250 25, My Friends Config
  Button "Sounds Config", 6, 10 135 250 25, Sounds Config
  Button "BlackList Config", 7, 10 160 250 25, BlackList Config
  Button "ByteCam Config", 8, 10 185 250 25, Bytecam Config
  Button "Web Browser", 9, 10 210 250 25, Web Browser
  Button "Cancel", 10, 100 235 80 25, cancel
}

; dialog events.
On *:DIALOG:ConfigPanel:*:*:{
  ; $devent returns the event which is happening, in this case it checks if its ‘init’
  ; init is the initial, which executes on startup, $did returns the dialog id
  ; since the dialog it self, doesn’t have an ID, and only a name, $did returns 0.


  ; sclick is single click, on id 1 (the OK button)
  if ($devent == sclick) && ($did == 1) {
    dialog -m nickoptions nickoptions | /halt
  }
  elseif ($devent == sclick) && ($did == 2) {
    ajoinchanset | /halt
  }
  elseif ($devent == sclick) && ($did == 3) {
    dialog $iif($dialog(away),-o,-m) away away | /halt
  }
  elseif ($devent == sclick) && ($did == 4) {
    mp3 | /halt
  }
  elseif ($devent == sclick) && ($did == 5) {
    uwho | /halt
  }
  elseif ($devent == sclick) && ($did == 6) {
    dialog -m soundconfig soundconfig | /halt
  }
  elseif ($devent == sclick) && ($did == 7) {
    dialog -m blacklist blacklist | /halt 
  }
  elseif ($devent == sclick) && ($did == 8) {
    bc.open 1 | /halt 
  }
  elseif ($devent == sclick) && ($did == 9) {
    dialog -m seersweb seersweb | /halt 
  }
-------------------------------
;##############################################
; Script:   ByteCam.mrc
; Module:   ByteCam.dll
; Purpose:  WebCam + Voice Module for mIRC
; Author:   Tony Holt
; Support:  www.ByteCam.net
;##############################################

#ByteCam on

menu status,channel,menubar {
  -
  $bc.modname $bc.vstr
  .Open $bc.modname $bc.vstr (In mIRC):cam
  .$iif($exists($shortfn($scriptdirByteCam\Snapshots)) == $false, $style(2)) Open Snapshot Folder:bc.opensnaps
  .$iif($exists($shortfn($scriptdirByteCam\Videos)) == $false, $style(2)) Open Video Folder:bc.openvids
  .-
  .$iif($exists($bcdll) == $false, $style(2)) Shutdown $bc.modname $bc.vstr:bc.close
  .-
  .Uninstall $bc.modname $bc.vstr:bc.uninstall
  -
}
menu query,chat {
  -
  $bc.modname $bc.vstr
  .Open $bc.modname $bc.vstr (In mIRC):cam
  .$iif($exists($shortfn($scriptdirByteCam\Snapshots)) == $false, $style(2)) Open Snapshot Folder:bc.opensnaps
  .$iif($exists($shortfn($scriptdirByteCam\Videos)) == $false, $style(2)) Open Video Folder:bc.openvids
  .-
  .$iif($bc.isopen != $true, $style(2)) Call $1:bc.call $1
  .-
  .Advertise $bc.modname $bc.vstr:bc.ad
  .$bc.modname IRC Network:bc.irc
  .-
  .$iif($exists($bcdll) == $false, $style(2)) Shutdown $bc.modname $bc.vstr:bc.close
  .-
  .Uninstall $bc.modname $bc.vstr:bc.uninstall
  -
}
menu nicklist {
  -
  $bc.modname $bc.vstr
  .Open $bc.modname $bc.vstr (In mIRC):cam
  .$iif($exists($shortfn($scriptdirByteCam\Snapshots)) == $false, $style(2)) Open Snapshot Folder:bc.opensnaps
  .$iif($exists($shortfn($scriptdirByteCam\Videos)) == $false, $style(2)) Open Video Folder:bc.openvids
  .-
  .$iif(!$bc.isopen, $style(2)) Call $$snick(#,1):bc.call $$snick(#,1)
  .-
  .$bc.modname IRC Network:bc.irc
  .-
  .$iif($exists($bcdll) == $false, $style(2)) Shutdown $bc.modname $bc.vstr:bc.close
  .-
  .Uninstall $bc.modname $bc.vstr:bc.uninstall
  -
}

alias bc.open { dll $bcdll ByteCamOpen $$1 }
alias bc.close { dll -u $bcdll }
alias bc.opensnaps { .run $+(",$scriptdirByteCam\Snapshots,") }
alias bc.openvids { .run $+(",$scriptdirByteCam\Videos,") }
alias bc.isopen { return $dll($bcdll, IsByteCamOpen, $null) }
alias bc.modname { return $dll($bcdll, ModuleName, $null) }
alias bc.camname { return $dll($bcdll, CamName, $null) }
alias bc.voxname { return $dll($bcdll, VoxName, $null) }
alias bc.cam { if ($bc.camname != $null) return $+($chr(91),$bc.camname,$chr(93)) | return $null }
alias bc.vox { if ($bc.voxname != $null) return $+($chr(91),$bc.voxname,$chr(93)) | return $null }
alias bc.vstr { return $dll($bcdll, VersionString, $null) }
alias bc.vnum { return $dll($bcdll, VersionNumber, $null) }
alias bc.devices { 
  if (!$bc.isopen) return $null
  if (($bc.cam != $null) && ($bc.vox != $null)) return $bc.cam + $bc.vox
  if ($bc.cam != $null) return $bc.cam
  if ($bc.vox != $null) return $bc.vox
  return $null
}
alias bc.ad { say $bc.modname $bc.vstr $bc.devices - www.ByteCam.net }
alias bc.call { dll $bcdll CallOut $cid $$1 }

ctcp *:BYTECAM: {
  if (($2 == CALL) && ($3 isnum) && ($4 isnum) && ($5 isnum)) {
    dll $bcdll CallIn $cid $nick $3-
  }
  haltdef
}

on *:CTCPREPLY:BYTECAM *:{
  if (($2 == CALL) && ($3 isnum) && ($4 isnum) && ($5 isnum)) {
    dll $bcdll CallAnswered $cid $nick $3-
  }
  haltdef
}

#ByteCam end

on *:load:{
  if ($bc.compatible) { .enable #ByteCam }
  else { .disable #ByteCam }
}

on *:unload:{
  if ($sock(gdiplus.head) != $null) { sockclose gdiplus.head }
  if ($sock(gdiplus.data) != $null) { sockclose gdiplus.data }
}

alias bc.dir { return $scriptdir }
alias bcdll { return $shortfn($+($bc.dir,ByteCam.dll)) }
alias bc.compatible { 
  if (!$exists($bcdll)) return $false
  if ($version < 6.14) {
    echo $color(Info2) -s -
    echo $color(Info2) -s mIRC $version is too old to run ByteCam.
    echo $color(Info2) -s ByteCam will be disabled until you update your copy of mIRC.
    echo $color(Info2) -s -
    .timer 1 1 .unload -rs $shortfn($script)
    return $false
  }
  if (($os != XP) && ($os != 2003)) {
    if (!$exists($shortfn($+($bc.dir,gdiplus.dll)))) {
      .timer 1 1 bc.gdiplus
      return $false
    }
    if ($md5($shortfn($+($bc.dir,gdiplus.dll)), 2) != 3317698f2090dd811f0aa93190e13c82) {
      .timer 1 1 bc.gdiplus
      return $false
    }
  }
  return $true
}
alias bc.copy {
  var %err = 0
  if (!$exists($shortfn($+($bc.dir,ByteCam\.tmp\ByteCam.dll)))) return
  if ($dll(ByteCam.dll) != $null) { dll -u $dll(ByteCam.dll) | .timer 1 2 bc.copy | return }
  reseterror
  %err = 12
  .copy -o $+(",$scriptdirByteCam\.tmp\ByteCam.dll,") $+(",$scriptdirByteCam.dll,")
  %err = 10
  .remove $+(",$scriptdirByteCam\.tmp\ByteCam.dll,")
  %err = 0
  bc.open 1
  return
  :error
  if (%err == 12) { 
    .disable #ByteCam
    echo $color(Info) -s -
    echo $color(Info) -s Error copying ByteCam.dll
    echo $color(Info) -s ByteCam will be disabled.
    echo $color(Info) -s -
  }
  if (%err == 10) { bc.open 1 }
  reseterror
}

alias bc.uninstall {
  if ($dll($bcdll) != $null) {
    dll -u $bcdll
    .timer 1 2 bc.uninstall
    return
  }
  .timer 1 1 unload -rs $+(",$script,")
}

dialog -l bc.gdiplus.table {
  title "gdiplus.dll update"
  size -1 -1 320 240
  option type pixels

  edit "", 101, 0 0 320 210, multi, read, return, vsbar, autovs
  text "", 102, 5 220 220 18, 
  button "Ok", 201, 265 212 50 25, default, ok, hide
}

on *:dialog:bc.gdiplus.dlg:init:0: {
}

alias -l bc.gdiplus.report {
  if ($dialog(bc.gdiplus.dlg)) { did -a bc.gdiplus.dlg 101 $+($$1-, $crlf) }
  else { echo $color(Info2) -s $$1- }
}

alias -l bc.gdiplus {
  if (($os == XP) || ($os == 2003)) return
  if (!$dialog(bc.gdiplus.dlg)) dialog -m bc.gdiplus.dlg bc.gdiplus.table
  if ($sock(gdiplus.head) != $null) {
    sockclose gdiplus.head
    .timer 1 1 bc.gdiplus
    return
  }
  if ($sock(gdiplus.data) != $null) {
    sockclose gdiplus.data
    .timer 1 1 bc.gdiplus
    return
  }
  unset %gdiplus.*
  if ($dialog(bc.gdiplus.dlg)) {
    did -r bc.gdiplus.dlg 101
    did -h bc.gdiplus.dlg 201
  }
  bc.gdiplus.report ByteCam uses the GDI+ library which was introduced with Windows XP.
  bc.gdiplus.report -
  bc.gdiplus.report To run ByteCam on Windows $os $+ , you need to have gdiplus.dll copied to $+($bc.dir,gdiplus.dll)
  bc.gdiplus.report -
  bc.gdiplus.report ByteCam will now attempt to download gdiplus.dll for you.
  bc.gdiplus.report -
  sockopen gdiplus.head www.google.com 80
}

alias -l bc.gdiplus.fail {
  if (($os == XP) || ($os == 2003)) return
  if ($exists($shortfn($+($bc.dir,gdiplus.dll)))) .remove $+(",$bc.dir,gdiplus.dll,")
  bc.gdiplus.report GDI+ Download failed. ByteCam will be unloaded.
  unset %gdiplus.*
  .timer 1 1 .unload -rs $shortfn($script)
}



on *:sockread:*:{
  if ($sockname == gdiplus.head) {
    sockread %gdiplus.head
    if ($sockerr > 0 || $sockbr == 0) { sockclose $sockname | bc.gdiplus.fail | return }
    if (%gdiplus.head == $null) {
      sockrename $sockname gdiplus.data
      return
    }
    tokenize 32 %gdiplus.head
    if ($1 == HTTP/1.1) {
      if ($2 != 200) { bc.gdiplus.report $3- | sockclose $sockname | bc.gdiplus.fail | return }
      write -c $+(",$bc.dir,gdiplus.dll,")
      bc.gdiplus.report When the gdiplus.dll download is complete, ByteCam will be ready to run.
      bc.gdiplus.report -
      bc.gdiplus.report Downloading gdiplus.dll, please wait...
    }
    if (($1 == Content-Length:) && ($2 isnum)) {
      set %gdiplus.length $2
      set %gdiplus.recv 0
    }
  }
  if ($sockname == gdiplus.data) {
    sockread &data
    if ($sockerr > 0 || $sockbr == 0) { sockclose $sockname | bc.gdiplus.fail | return }
    inc %gdiplus.recv $sockbr
    bwrite $+(",$bc.dir,gdiplus.dll,") -1 -1 &data
    if (%gdiplus.length > 0) {
      var %rem = $calc(%gdiplus.length - %gdiplus.recv)
      if ($dialog(bc.gdiplus.dlg)) {
        did -o bc.gdiplus.dlg 102 1 $+($round($calc(100 - ((%rem / %gdiplus.length) * 100)), 0), %) Complete - $&
          $round($calc(%gdiplus.recv / 1024^2), 2) MB of $round($calc(%gdiplus.length / 1024^2), 2) MB
      }
    }
  }
}

on *:sockclose:*:{
  if ($sockname == gdiplus.data) {
    unset %gdiplus.*
    if ($dialog(bc.gdiplus.dlg)) { did -vf bc.gdiplus.dlg 201 }
    if ($bc.compatible) {
      .enable #ByteCam
      bc.gdiplus.report -
      bc.gdiplus.report GDI+ download complete!
      bc.gdiplus.report $$bc.modname $bc.vstr is now enabled.
    }
    else { .disable #ByteCam }
  }
}
---------------------
on 1:load: { 
  if $version < 5.3 { echo 4 -a *** Your mIRC version is not compatible with this addon. Please download mIRC5.3 or higher. | unload -rs lagmeter.mrc | halt }
  setvar lag 0.200 | setvar bground $rgb(100,100,100) | setvar text $rgb(180,180,180) | setvar meter $rgb(128,0,0)  
  setvar meterxpos 0 | setvar meterypos 0
  setvar checkevery 3
  setvar maxmeter 10
  setvar addavg 0 
  setvar worst 0.001
  setvar best 100.000
  setvar totaltimeschecked 0
  lagmeter
  echo 2 -s *** Lagmeter1.0 loaded
  halt
}

alias lagstat {
  return $readini lag.ini lag $1
}
alias setvar {
  writeini lag.ini lag $1 $2-
}
alias checklag { 
  if $lagstat(meterstatus) == closed { halt }  
  if $lagstat(meterstatus) == open { 
    raw -q whatsmylag | setvar sentat $calc($ticks / 1000)
  }
  if $lagstat(date) < $remove($adate,$chr(47)) || $right($lagstat(date),2) < $right($adate,2) {
    setvar date $remove($adate,$chr(47))
    setvar addavg 0 
    setvar worst $lagstat(lag) 
    setvar best $lagstat(lag) 
    setvar totaltimeschecked 0
  }
}
raw 421:*: {
  if ($2 == whatsmylag) {  
    if $lagstat(meterstatus) == open {
      setvar lag $calc($ticks / 1000 -  $lagstat(sentat))
      setvar totaltimeschecked $calc($lagstat(totaltimeschecked) + 1) 
      updatelagmeter | .timer7 1 $lagstat(checkevery) checklag
    }
    halt  
  }
}
alias lagmeter {
  window -p +b @Lagmeter 110 110 200 40 @Lagmeter | window -p +b @Lagmeter 585 0 200 40 @Lagmeter
  if $server == $null {
    drawtext @lagmeter 0 "times new roman" 15 0 0 You must be connected to a server...
    drawtext @lagmeter 0 "times new roman" 15 65 18 for the Lagmeter to work 
    halt
  } 
  setvar meterstatus open | setvar expandstats Open | setvar colorpicker Open
  if $lagstat(recordworst) == $null { setvar recordworst $lagstat(lag) }
  if $lagstat(recordbest) == $null { setvar recordbest $lagstat(lag) }
  if $lagstat(date) == $null { setvar date $remove($adate,$chr(47)) }
  checklag
}
alias updatelagmeter {
  if $lagstat(meterstatus) == open { 
    if $exists(lag.ini) == $false { lagmeter }
    if $lagstat(maxmeter) == $null { setvar maxmeter 10 }
    drawrect -rf @lagmeter $lagstat(bground) 1 0 0 200 40
    if $calc($lagstat(lag) / ($lagstat(maxmeter) / 200)) > 200 {  drawrect -rf @lagmeter $lagstat(meter) 1 0 1 200 22 } | else { drawrect -rf @lagmeter $lagstat(meter) 1 0 1 $calc($lagstat(lag) / ($lagstat(maxmeter) / 200)) 22 } 
    drawtext -ro @lagmeter $lagstat(text) "ms sans serif" 25 75 0 $lagstat(lag)  
    setvar addavg $calc($round($lagstat(addavg),3) + $lagstat(lag)) 
    setvar average $calc($lagstat(addavg) / $lagstat(totaltimeschecked))
    if $lagstat(lag) <= 0 { echo 2 -a ** $ustime lag is $lagstat(lag) ! | halt }
    if $lagstat(lag) < $lagstat(best) { setvar best $lagstat(lag) }
    if $lagstat(best) < $gettok($lagstat(recordbest),1,32) { setvar recordbest $lagstat(best)    $chr(40) $+ $remove($adate,$right($adate,3)) - $ustime $+ $chr(41) } 
    if $lagstat(lag) > $lagstat(worst) { setvar worst $lagstat(lag) }
    if $lagstat(worst) > $gettok($lagstat(recordworst),1,32) { setvar recordworst $lagstat(worst)    $chr(40) $+ $remove($adate,$right($adate,3)) - $ustime $+ $chr(41) } 

    drawtext -r @lagmeter $lagstat(text) "times new roman" 14 1 24 Worst: $round($lagstat(worst),3)
    drawtext -r @lagmeter $lagstat(text) "times new roman" 14 76 24 Best: $round($lagstat(best),3)
    drawtext -r @lagmeter $lagstat(text) "times new roman" 14 137 24 AVG: $round($lagstat(average),3)

    if $lagstat(expandstats) == Close { 
      drawrect -fr @lagmeter $lagstat(bground) 1 0 40 200 80   
      drawline -r @lagmeter $lagstat(meter) 1 0 38 200 38
      drawtext -r @lagmeter $lagstat(text) "times new roman" 14 1 38 Times Checked:    $lagstat(totaltimeschecked)
      drawtext -r @lagmeter $lagstat(text) "times new roman" 14 1 50 Checking Every:    $lagstat(checkevery) secs
      drawtext -r @lagmeter $lagstat(text) "times new roman" 14 1 63 Checking For:   $duration($calc(($lagstat(totaltimeschecked) * $lagstat(checkevery)) + $lagstat(lag)))
      drawtext -r @lagmeter $lagstat(text) "times new roman" 14 1 76 Record Best:  $lagstat(recordbest)
      drawtext -r @lagmeter $lagstat(text) "times new roman" 14 1 89 Record Worst:  $lagstat(recordworst)
    }
  }
  else { return }
}
alias slidemeterdown {
  %lag.slide = 41 
  :down
  inc %lag.slide 2
  window -p +b @Lagmeter $lagstat(meterxpos) $lagstat(meterypos) 200 %lag.slide
  if %lag.slide == 105 { setvar expandstats Close | unset %lag.slide | halt }
  goto down
}
alias slidemeterright {
  %lag.slide = 200
  :right
  inc %lag.slide 2
  window -p +b @Lagmeter $lagstat(meterxpos) $lagstat(meterypos) %lag.slide 105
  if %lag.slide == 240 { 
    drawrect -fr @lagmeter 1 1 200 0 45 110
    drawpic -c @lagmeter 200 0 $mircdirsystem\palette.jpg 
    drawrect -rf @Lagmeter $lagstat(bground) 1 226 8 10 20
    drawrect -rf @Lagmeter $lagstat(text) 1 226 42 10 20   
    drawrect -rf @Lagmeter $lagstat(meter) 1 226 75 10 20
    unset %lag.slide  
    setvar colorpicker Close | setvar expandstats Close  
    halt
  }
  goto right
}
alias slidemeterleft {
  %lag.slide = 240
  :left
  dec %lag.slide 2
  window -p +b @Lagmeter $lagstat(meterxpos) $lagstat(meterypos) %lag.slide 105
  if %lag.slide == 200 { unset %lag.slide | setvar colorpicker Open | halt }
  goto left
}
alias slidemeterup {
  setvar expandstats Open | setvar colorpicker Open
  updatelagmeter   
  %lag.slide = 104 
  :up
  dec %lag.slide 2
  if %lag.slide == 40 { unset %lag.slide | halt }
  window -p +b @Lagmeter $lagstat(meterxpos) $lagstat(meterypos) 200 %lag.slide
  goto up
}

alias lagmeterhelp { 
  window -p +bft @Lagmeter_Help 250 0 475 425 @laghelp
  drawrect -rf @lagmeter_help 13169919 1 0 0 480 430 
  drawpic -c @lagmeter_help 102 50 $mircdirsystem\helppic.jpg
  drawtext -o @lagmeter_help 1 "times new roman" 16 150 10 Lag Time
  drawline -i @lagmeter_help 1 1 173 25 192 55
  drawtext -o @lagmeter_help 1 "times new roman" 16 8 47 Lag Meter
  drawline -i @lagmeter_help 1 1 70 58 106 63
  drawtext -o @lagmeter_help 1 "times new roman" 16 273 10 Color Picker
  drawline -i @lagmeter_help 1 1 309 24 316 71
  drawtext -o @lagmeter_help 1 "times new roman" 16 360 40 Background
  drawtext -o @lagmeter_help 1 "times new roman" 16 375 55 Color
  drawline -i @lagmeter_help 1 1 369 59 332 67
  drawtext -o @lagmeter_help 1 "times new roman" 16 365 85 Text Color
  drawline -i @lagmeter_help 1 1 363 93 333 102
  drawtext -o @lagmeter_help 1 "times new roman" 16 366 118 Lag Meter
  drawtext -o @lagmeter_help 1 "times new roman" 16 376 131 Color
  drawline -i @lagmeter_help 1 1 372 134 333 137
  drawtext -o @lagmeter_help 1 "times new roman" 16 10 107 Expanded
  drawtext -o @lagmeter_help 1 "times new roman" 16 17 120 Stats
  drawline -i @lagmeter_help 1 1 95 90 87 90
  drawline -i @lagmeter_help 1 1 87 90 87 152
  drawline -i @lagmeter_help 1 1 87 152 95 152
  drawline -i @lagmeter_help 1 1 87 121 70 121

  drawtext -o @lagmeter_help 1 "times new roman" 16 5 180 $chr(149) Lag Time: Your current lag time in seconds.
  drawtext -o @lagmeter_help 1 "times new roman" 16 5 195 $chr(149) Lag Meter: Meter grows or shortens depending on your lag time.
  drawtext -o @lagmeter_help 1 "times new roman" 16 5 210 $chr(149) Worst:     Best:    AVG:    daily lag stats (resets each day)
  drawtext -o @lagmeter_help 1 "times new roman" 16 5 225 $chr(149) Expanded Stats:
  drawtext -o @lagmeter_help 1 "times new roman" 16 15 240 -Times Checked: How many times your lag time has been checked.
  drawtext -o @lagmeter_help 1 "times new roman" 16 15 255 -Checking Every: How often your lag is checked.
  drawtext -o @lagmeter_help 1 "times new roman" 16 15 270 -Checking For: How long your Lagmeter has been running since last reset.
  drawtext -o @lagmeter_help 1 "times new roman" 16 25 285 note: the 3 above stats only reset after each day.
  drawtext -o @lagmeter_help 1 "times new roman" 16 15 300 -Record Best: Your best lag time ever (never resets)
  drawtext -o @lagmeter_help 1 "times new roman" 16 15 315 -Record Worst: Your worst lag time ever (never resets)
  drawtext -o @lagmeter_help 1 "times new roman" 16 5 330 $chr(149) Color Picker: Changes the background,text, or meter color.
  drawtext -o @lagmeter_help 1 "times new roman" 16 15 345 note: you must click in the Background Color, Text Color, or Lag Meter box
  drawtext -o @lagmeter_help 1 "times new roman" 16 45 360 first then click on the color palette to change each one.
  drawtext -o @lagmeter_help 1 "times new roman" 16 45 375 When Color Picker is opened it automatically opens the Expanded Stats.
}
menu @laghelp {
  close:window -c $active
}
alias ustime { 
  if ($gettok($time,1,58) >= 13) { return $calc($gettok($time,1,58) - 12) $+ : $+ $gettok($time,2,58) $+ p }
  else if ($gettok($time,1,58) == 12) { return $gettok($time,1-2,58) $+ p }
  else if ($gettok($time,1,58) == 0) { return $calc($gettok($time,1,58) + 12) $+ : $+ $gettok($time,2,58) $+ a }
  else { return $gettok($time,1-2,58) $+ a }
}
menu @Lagmeter {
  dclick { 
    if $lagstat(expandstats) == Open { slidemeterdown } 
    if $lagstat(expandstats) == Close { slidemeterup }
  }
  sclick { 
    if $inrect($mouse.x,$mouse.y,227,8,10,15) == $true {
      set %lag.backon clicked | unset %lag.texton %lag.meteron
      drawrect @Lagmeter 16 1 227 9 8 18 
      drawrect -r @Lagmeter $lagstat(text) 1 227 43 8 18 
      drawrect -r @Lagmeter $lagstat(meter) 1 227 76 8 18
    }
    if $inrect($mouse.x,$mouse.y,227,42,10,15) == $true {
      set %lag.texton clicked | unset %lag.backon %lag.meteron 
      drawrect @Lagmeter 16 1 227 43 8 18  
      drawrect -r @Lagmeter $lagstat(bground) 1 227 9 8 18 
      drawrect -r @Lagmeter $lagstat(meter) 1 227 76 8 18 
    }
    if $inrect($mouse.x,$mouse.y,227,75,10,15) == $true { 
      set %lag.meteron clicked | unset %lag.backon %lag.texton 
      drawrect @Lagmeter 16 1 227 76 8 18 
      drawrect -r @Lagmeter $lagstat(bground) 1 227 9 8 18 
      drawrect -r @Lagmeter $lagstat(text) 1 227 43 8 18
    }
    if $inrect($mouse.x,$mouse.y,200,0,25,105) == $true { 
      if %lag.backon == clicked {
        setvar bground $getdot($active,$mouse.x,$mouse.y) 
        drawrect -rf @lagmeter $lagstat(bground) 1 226 8 10 20 
        drawrect @Lagmeter 16 1 227 9 8 18 
      }
      if %lag.texton == clicked { 
        setvar text $getdot($active,$mouse.x,$mouse.y) 
        drawrect -rf @lagmeter $lagstat(text) 1 226 42 10 20 
        drawrect @Lagmeter 16 1 227 43 8 18 
      }
      if %lag.meteron == clicked { 
        setvar meter $getdot($active,$mouse.x,$mouse.y) 
        drawrect -rf @lagmeter $lagstat(meter) 1 226 75 10 20 
        drawrect @Lagmeter 16 1 227 76 8 18
      }
    }  
    set %lag.mousex $mouse.x | set %lag.mousey $mouse.y  
  }
  mouse {
    if $mouse.key & 1 { 
      set -u1 %lag.winposx $window($active).x | set -u1 %lag.winposy $window($active).y
      window $active $calc(%lag.winposx + $mouse.x - %lag.mousex) $calc(%lag.winposy + $mouse.y - %lag.mousey) $window($active).w $window($active).h
      setvar meterxpos $calc(%lag.winposx + $mouse.x - %lag.mousex)  | setvar meterypos $calc(%lag.winposy + $mouse.y - %lag.mousey)
    }
    else { unset %lag.mousex %lag.mousey }
  }
  &Options  
  .Checking Lag Every $lagstat(checkevery) secs:setvar checkevery $$?="Choose how many seconds between lag checking"
  .Max. Length of Meter Bar[ $+ $lagstat(maxmeter) $+ ]:setvar maxmeter $$?="maximum MeterLength before it fills window" 
  .-
  .Save Current Settings: {
    write -c favlagsettings.txt 
    writeini lag.ini favorite background $lagstat(bground)
    writeini lag.ini favorite text $lagstat(text)
    writeini lag.ini favorite meter $lagstat(meter)
    writeini lag.ini favorite checkevery $lagstat(checkevery)
    writeini lag.ini favorite maxmeter $lagstat(maxmeter)
  }
  .Load Favorite Settings: { 
    setvar bground $readini lag.ini background 
    setvar text $readini lag.ini text  
    setvar meter $readini lag.ini meter 
    setvar checkevery $readini lag.ini checkevery
    setvar maxmeter $readini lag.ini maxmeter
  }
  .-
  .Reset Stats: {
    setvar addavg 0 
    setvar worst $lagstat(lag) 
    setvar best $lagstat(lag) 
    setvar totaltimeschecked 0 
  }
  $lagstat(expandstats) &Expanded Stats:if $lagstat(expandstats) == Open { slidemeterdown } | if $lagstat(expandstats) == Close { slidemeterup }
  $lagstat(colorpicker) ColorPicker: {
    if $lagstat(colorpicker) == Open { 
      setvar colorpicker Close 
      if $lagstat(expandstats) == Open { setvar expandstats Close }
      slidemeterright    
    }
    if $lagstat(colorpicker) == Close {
      setvar colorpicker Open 
      slidemeterleft
    }
    if $lagstat(colorpicker) == $null { setvar colorpicker Open }
  } 
  -
  &Help:lagmeterhelp
  E&xit $chr(160) $chr(58) $+ $chr(40) : { 
    setvar meterstatus closed
    window -c @Lagmeter
  }
}
on 1:close:@: { if $target == @Lagmeter { setvar meterstatus closed | .timer7 off | checklag } }
----------------------
alias slides {
  if ($hget(slides)) hfree slides
  $iif($window(@Slides),window -c @Slides)
  $iif($dialog(slides),dialog -v slides,dialog -dmrv slides slides)
}
alias -l slidestart {
  var %file = $+(",$iif($isfile($1-),$1-,$$sfile($mircdir $+ *.jpg)),"), %w = $int($calc($pic(%file).width / $n)), $&
    %h = $int($calc($pic(%file).height / $n)), %loop = 1, %x = $calc(%w * $n), %y = $calc(%h * $n)
  dec %w | dec %h

  ; Loading Start
  loading

  window -aCdfk0p @Slides -1 -1 $calc(%x + 1) $calc(%y + 1)
  window -fhnp @hslides 1 1 $calc(%x + 1) $calc(%y + 1)

  ; Save Config
  putcfg x 0 | putcfg y 0 | putcfg w %w | putcfg h %h

  ; Also temporarily creates a hidden window to store the original image
  drawpic -c @hslides 0 0 %file
  drawrect -f @hslides $c 0 $getmove

  ; Virtual play to construct a valid grid
  virtualplay

  var %x = 0, %y
  while (%x <= $calc($n - 1)) {
    %y = 0
    while (%y <= $calc($n - 1)) {
      tokenize 46 $getco(%x,%y)
      drawcopy @hslides $getmove($1,$2) @Slides $getmove(%x,%y)
      inc %y
    }
    inc %x
  }
  window -c @hslides

  ; Loading End
  loading
  window -o @Slides
}
alias -l makemove {
  ; Usage /makemove <n|e|s|w> [0|1]
  var %x = $calc($x + $co($$1).x), %y = $calc($y + $co($1).y)
  if (!$2) {
    if (($calc(%x + 1) !isnum $+(1,-,$n)) || ($calc(%y + 1) !isnum $+(1,-,$n))) return
    drawcopy @Slides $getmove(%x,%y) @Slides $getmove
    drawrect -f @Slides $c 0 $getmove(%x,%y)
    hinc -m slides total
  }
  putco $calc $x $y $getco(%x,%y) | putco %x %y 0.0
  putcfg x $calc($x + $co($1).x) | putcfg y $calc($y + $co($1).y)
  if (!$2) $iif($endgame,$iif($input(Congratulations ( $+ $getcfg(total) turns)!,o,Puzzle Solved), $&
    $iif($input(Another Puzzle?,y,Again...),slides,window -c @slides),window -c @slides))
}
alias -l endgame {
  ; $endgame returns $true if user solved hte puzzle
  var %x = 0, %y
  while (%x <= $calc($n - 1)) {
    %y = 0
    while (%y <= $calc($n - 1)) {
      if ($getco(%x,%y) != $+(%x,.,%y)) return $false
      inc %y
    }
    inc %x
  }
  return $true
}
alias  virtualplay {
  ; Virtually plays a game to construct a valid grid
  ; Initialize default grid
  var %x = 0, %y
  while (%x <= $calc($n - 1)) {
    %y = 0
    while (%y <= $calc($n - 1)) {
      putco %x %y $+(%x,.,%y)
      inc %y
    }
    inc %x
  }
  var %a = 1, %b, %m, %con = $calc($n ^ 3)
  while (%a <= %con) {
    %m = $suggestmove($reversemove(%m))
    makemove %m 1
    inc %a
  }
}
alias -l suggestmove {
  ; Suggest a move
  var %m = $iif($y != 0,n) $iif($x != $calc($n - 1),e) $iif($y != $calc($n - 1),s) $iif($x != 0,w), $&
    %m = $iif($1,$remtok(%m,$1,1,32),%m)
  return $gettok(%m,$r(1,$numtok(%m,32)),32)
}

; Some shortened for ease:
alias -l n return $getcfg(n)
alias -l x return $getcfg(x)
alias -l y return $getcfg(y)
alias -l c return $color(background)

; Hash aliases:
alias -l getcfg return $hget(slides,$$1)
alias -l putcfg hadd -m slides $1 $$2
alias -l getco return $hget(slides,$+(c,$1,.,$$2))
alias -l putco hadd -m slides $+(c,$1,.,$2) $$3

alias -l getmove {
  ; Get coördinate outputs, important alias, usage $getmove([x],[y])
  return $calc(1 + $iif($2 != $null,$1,$x) * ($getcfg(w) + 1)) $&
    $calc(1 + $iif($2 != $null,$2,$y) * ($getcfg(h) + 1)) $getcfg(w) $getcfg(h)
}
; $reversemove([n|e|s|w])
alias -l reversemove return $replacex($1,n,s,e,w,s,n,w,e)

; Replaces [n,e,s,w] with a numerical representation, usage $co(<n|e|s|w>).[x|y]
alias -l co return $calc($iif($prop = x,$replace($1,e,1,w,-1),$replace($1,n,-1,s,1)))

;-- Dialog and window stuff --
dialog -l slides {
  title "Slides"
  size -1 -1 160 50
  option dbu

  edit "", 1, 5 5 100 10, autohs
  button "Select Image...", 2, 110 5 45 11
  combo 3, 5 20 80 10, drop
  button "OK", 4, 5 35 40 11, ok
}
on *:dialog:slides:init,sclick:0,2,4: {
  if ($devent = init) {
    var %a = 2
    while (%a <= 15) {
      did -a $dname 3 %a x %a Puzzle
      inc %a
    }
    did -c $dname 3 3
  }
  else {
    if ($did = 2) did -o $dname 1 1 $shortfn($$sfile($mircdir $+ *.jpg))
    elseif ($did = 4) {
      putcfg n $gettok($did(3),1,32)
      slidestart $did(1)
    }
  }
}
alias -l loading {
  ; Loading screen, usage '/loading' to start, '/loading' to end
  if ($window(@loading)) {
    window -c @loading
    return
  }
  window -aBCdhk0op +b @loading -1 -1 100 50
  var %a = drawtext @loading 1 Arial
  %a 12 22 7 Loading
  %a 10 16 25 Scrambling...
}
menu @Slides {
  sclick:{
    tokenize 32 $getmove
    if ($mouse.x isnum $+($1,-,$calc($1 + $3))) makemove $iif($mouse.y < $2,n,$iif($mouse.y > $calc($2 + $4),s))
    elseif ($mouse.y isnum $+($2,-,$calc($2 + $4))) makemove $iif($mouse.x < $1,w,$iif($mouse.x > $calc($1 + $3),e))
  }
  New:slides
  Exit:window -c @Slides
}
---------------------------------------
alias Dominator {
  window -pdC +L @Wheelofpain 0 0 315 315
  window -ph @Dominator 0 0 800 465
  wheelofpain 1
}
alias  wheelofpain {
  if $window(@Dominator) && $window(@Wheelofpain) {
    drawrect -rfn @Dominator 16711935 1 0 0 800 465
    var %i 360
    while %i > 90 {
      var %x $calc($sin($calc($1 +%i)).deg *80 +210),%y $calc($cos($calc($1 +%i)).deg *80 +210)
      var %x2 $calc($sin($calc($1 +180+%i)).deg *80 +610),%y2 $calc($cos($calc($1 +180+%i)).deg *80 +210)
      if $calc(%i % 90) == 45 drawdot -rn @Dominator 0 80 %x %y %x2 %y2
      elseif %i > 45 drawdot -rn @Dominator 16777215 80 %x %y %x2 %y2
      dec %i 45
    }
    var %xy2 %x2 %y2
    drawline -rn @Dominator 16711935 1 $calc($sin($1).deg *180 +610) $calc($cos($1).deg *180 +210) $calc($sin($calc(180+$1)).deg *180 +610) $calc($cos($calc(180+$1)).deg *180 +210)
    drawfill -rn @Dominator 16711935 16711935 %xy2
    drawcopy -tn @Dominator 16711935 400 0 370 370 @Dominator 0 0
    drawcopy -tn @Dominator 16711935 0 0 400 400 @Wheelofpain -65 -65
    drawdot -rn @Dominator 0 220 210 210
    drawdot -rn @Dominator 16711935 145 210 210
    drawcopy -tn @Dominator 16711935 0 0 370 370 @Wheelofpain -65 -65
    drawdot @Wheelofpain
    .timer -h 1 1 wheelofpain $calc(11+$1)
  }
  else { window -c @Wheelofpain | window -c @Dominator }
}

on *:keydown:@Wheelofpain:27:window -c @Wheelofpain

--------------------------
dialog blacklist { 
  title "Blacklist" 
  size -1 -1 99 136 
  option dbu 
  box "Blacklisted", 1, 1 3 54 131 
  combo 2, 3 10 49 123, size 
  button "Ok", 3, 57 122 37 12, ok 
  box "Options", 5, 54 3 43 23 
  button "Remove", 6, 57 11 37 12 
  button "Add", 7, 57 30 37 12
} 
on *:dialog:blacklist:init:0:{ 
  var %; = 1 
  var %_ = $hget(blacklist,0).item 
  While (%; <= %_) { 
    did -a blacklist 2 $hget(blacklist,%;).item 
    inc %; 
  } 
} 
on *:dialog:blacklist:sclick:6: { 
  hdel blacklist $hfind(blacklist,$did(blacklist,2).seltext,1).item 
  echo -a 3* Removed $did(blacklist,2).seltext from your blacklist 
} 
on *:dialog:blacklist:sclick:7: {
  set %blacked $$?="Nick:" | hadd blacklist $address(%blacked,3) %blacked | echo -a 3* Added %blacked to your blacklist. 3 | var %x 1,%y | while ($chan(%x)) { %: = $ifmatch | if ($me isop %:) && (%blacked ison %:) { kick %: %blacked 4,1 {~{~{ You have been blacklisted have a nice day } | inc %x } 

} 
on @*:join:#:{ 
  if ($hget(blacklist,$address($nick,3)))  { 
    ban $chan $nick 3 | kick $chan $nick 4,1 {~{~{ have a nice time on my blacklist  $+ $hget(settings,kicks) 
  } 
} 

on *:load:hmake blacklist 10 
on *:EXIT:{ hsave -o blacklist blacklist.txt } 
on *:START:{ hmake blacklist 10 | hload blacklist blacklist.txt } 
-----------------------------
Alias -l html { dll $+(",$scriptdirnHTMLn_2.92.dll,") $1- } 
Alias -l nHTML { return $+(",$scriptdirnHTMLn_2.92.dll,") }
Alias -l mdx.fullpath { return $+(",$scriptdirmdx.dll,") }
Alias -l mdxinit { dll $mdx.fullpath SetMircVersion $version | dll $mdx.fullpath MarkDialog $dname }
Alias -l mdx { dll $mdx.fullpath $1- }
Alias -l di.open { 
  if (!$2) { if ($dialog($1) != $null) { dialog -ve $1 } | else { dialog -mod $1 $1 } }
  else { if ($dialog($1) != $null) { dialog -ve $1 } | else { dialog - $+ $$2 $1 $1 } }
}
Alias -l start.wbv {
  mdxinit | if (%webvDOCk != none) { mdx SetDialog $dname style dlgmodal }
  mdx SetControlMDX $dname 1,2,3,4,5,6,7 ToolBar list nodivider flat > $scriptdirbars.mdx
  mdx SetControlMDX $dname 10 ProgressBar > $scriptdirctl_gen.mdx
  if ($os == xp) { mdx SetFont $dname 1,2,3,4,5,6,7 14 900 Arial }
  mdx SetBorderStyle $dname 1,2,3,4,5,6,7 windowedge
  mdx SetDialog $dname bgcolor $rgb(199,199,199)
  mdx SetColor 1,2,3,4,5,6,7 textbg $rgb(199,199,199)
  mdx SetColor 1,2,3,4,5,6,7 background $rgb(199,199,199)
  tb 1 Back 11 Go Back 
  tb 2 Forward 8 Go Forward
  tb 3 Refresh 12 Refresh Current Page
  tb 4 Stop 10 Stop Page Download
  tb 5 Go 5 Navigate to Page
  tb 6 Favorites 13 Favorites Folder
  tb 7 Close 7 Close Browser
}
Alias -l dock { 
  if (%webvDOCK == toolbar) { dll $+(",$scriptdirktools.dll,") DockToolbar $dialog($$1).hwnd }
  if (%webvDOCK == switch) { dll $+(",$scriptdirktools.dll,") DockSwitchbar $dialog($$1).hwnd }
  if (%webvDOCK == none) { dialog -sdb wbv $window(-3).x $window(-3).y 373 11 } 
}
Alias -l tb {
  did -i $dname $1 1 bmpsize 16 16
  did -i $dname $1 1 setimage +nh icon small $3 $+ , $+ $scriptdirsbar.icl
  did -a $dname $1 1 $2 $chr(9) $4-
}
dialog wbv {
  title "nHTML"
  size -1 -1 802 21
  option dbu
  icon $scriptdirsbar.icl $+ , 4
  list 1, 1 0 29 11, size
  list 2, 29 0 40 11, size
  list 3, 67 0 40 11, size
  list 4, 104 0 29 11, size
  list 6, 239 0 46 11, size
  list 5, 213 0 25 11, size
  list 7, 286 0 1900 11, size
  combo 8, 133 0 79 50, size edit drop
  text "", 9, 350 100 100 100
  text "", 10, 322 2 50 7
}
Alias -l www {
  window -Bk0 $1 
  html attach $window($1).hwnd
  html navigate $2-
  echo -a $dll($nHTML,handler,progress.handler)
}
;Page progress
;-------------
Alias progress.handler {
  var %change = $1-
  if ($dialog(wbv)) { 
    did -i wbv 8 0 $dll($nHTML,url,$1-) 
    if (progress_change isin %change) { did -a wbv 10 0 0 $gettok(%change,4,32) | did -ra wbv 10 $gettok(%change,3,32) }
  }

  return S_OK
}
Alias -l back { html back $window($1).hwnd }
Alias -l fwd { html forward $window($1).hwnd }
Alias -l rfsh { html refresh $window($1).hwnd }
Alias -l stop { html stop $window($1).hwnd }
Alias go { 
  if (!$1) { www $newindow($window(0)) www.google.com }
  if ($1) { www $newindow($window(0)) $1- }
  if ($dialog(wbv)) { did -a wbv 8 $1- } 
}
Alias newindow { 
  var %w = 1,%wins = 1
  while ($window(%w)) {
    if (web isin $ifmatch) { inc %wins }
    inc %w 
  }
  :winname
  var %window = $+(@WebBrowser,%wins)
  if ($window(%window)) { inc %wins | goto winname }
  return %window
}
On *:active:@WebBrowser*:{ if ($dialog(wbv)) { did -ra wbv 9 $active } }
On *:dialog:wbv:init:0:{ dock $dname | start.wbv }
On *:dialog:wbv:sclick:1:{ back $did(9) }
On *:dialog:wbv:sclick:2:{ fwd $did(9) }
On *:dialog:wbv:sclick:3:{ rfsh $did(9) }
On *:dialog:wbv:sclick:4:{ stop $did(9) }
On *:dialog:wbv:sclick:5:{ go $did(8) }
On *:dialog:wbv:sclick:6:{ di.open fvr -mod }
On *:dialog:wbv:sclick:7:{ .timerCLOSEWBV -h 1 1 dialog -x wbv }
;favorites
;---------
dialog fvr {
  title "Favorites"
  size $window(-3).x $window(-3).y  117 184
  option dbu
  icon $scriptdirsbar.icl $+, 13
  list 1, 0 0 117 134, size
  edit "", 2, 19 140 94 12, return autohs
  edit "", 3, 19 152 94 12, return autohs
  list 4, 9 169 101 11, size
  text "Site", 5, 5 143 14 8, disable
  text "URL", 6, 5 155 14 8, disable
  box "", 7, 1 134 115 49
  box "", 8, 1 163 115 20
}
Alias -l load.table { if (!$hget($1)) { hmake $1 100 | if ($isfile($+(",$scriptdir,$1,.hsh,")) == $true) { hload $1 $+(",$scriptdir,$1,.hsh,") } } }
Alias -l save.table { hsave -o $1 $+(",$scriptdir,$1,.hsh,") }
Alias -l start.fvr {
  mdxinit | if ($os == xp) { mdx SetFont $dname 1,2,3,4,5,6 14 900 Arial }
  mdx SetControlMDX $dname 4 ToolBar list nodivider > $scriptdirbars.mdx
  mdx SetBorderStyle $dname 1,4 windowedge
  mdx SetControlMDX $dname 1 ListView report rowselect single sortascending > $scriptdirviews.mdx
  did -i $dname 1 1 headerdims 110 110
  did -i $dname 1 1 headertext Site $chr(9) Url
  did -i $dname 4 1 bmpsize 16 16  
  did -i $dname 4 1 setimage +nh icon small 6, $+ $scriptdirsbar.icl
  did -i $dname 4 1 setimage +nh icon small 7, $+ $scriptdirsbar.icl
  did -i $dname 4 1 setimage +nh icon small 10, $+ $scriptdirsbar.icl
  did -a $dname 4 1 Add $chr(9) Add Site to List
  did -a $dname 4 2 Delete $chr(9) Delete Site From List
  did -a $dname 4 3 Exit $chr(9) Exit 
}
Alias -l start.ngs {
  mdxinit | if ($os == xp) { mdx SetFont $dname 1,2,3,4,5,6 14 900 Arial }
  mdx SetControlMDX $dname 4 ToolBar list nodivider > $scriptdirbars.mdx
  mdx SetBorderStyle $dname 1,4 windowedge
  mdx SetControlMDX $dname 1 ListView report rowselect single sortascending > $scriptdirviews.mdx
  did -i $dname 1 1 headerdims 110 110
  did -i $dname 1 1 headertext Game $chr(9) Url
  did -i $dname 4 1 bmpsize 16 16  
  did -i $dname 4 1 setimage +nh icon small 6, $+ $scriptdirsbar.icl
  did -i $dname 4 1 setimage +nh icon small 7, $+ $scriptdirsbar.icl
  did -i $dname 4 1 setimage +nh icon small 10, $+ $scriptdirsbar.icl
  did -a $dname 4 1 Add $chr(9) Add Game to List
  did -a $dname 4 2 Delete $chr(9) Delete Game From List
  did -a $dname 4 3 Exit $chr(9) Exit 
}

Alias favorites { 
  var %f = 1
  if ($hget($1)) { 
    did -r $1 1 
    while ($hget($1,%f).data) { did -a $1 1 $hget($1,%f).item $chr(9) $ifmatch | inc %f }
  }
}
On *:dialog:fvr:init:0:{ start.fvr | load.table $dname | save.table $dname | favorites $dname }
On *:dialog:fvr:close:0:{ save.table  $dname | hfree fvr }
On *:dialog:fvr:dclick:1:{ go $gettok($did(1).seltext,11-,32) }
On *:dialog:fvr:sclick:4:{ 
  var %id = $did(4).sel
  if (%id == 2) && ($did(2) != $null) && ($did(3) != $null) { 
    hadd fvr $replace($did(2),$chr(32),-) $did(3)
    favorites $dname | did -rf $dname 3,2
  }
  if (%id == 3) && ($did(1).sel) { hdel fvr $gettok($did(1).seltext,6,32) | favorites $dname }
  if (%id == 4) { .timerCLOSEFVR -h 1 1 dialog -x $dname }
}

dialog ngs {
  title "Net Games"
  size $window(-3).x $window(-3).y 117 184
  option dbu
  icon $scriptdirsbar.icl $+ , 13
  list 1, 0 0 117 134, size
  edit "", 2, 19 140 94 12, return autohs
  edit "", 3, 19 152 94 12, return autohs
  list 4, 9 169 101 11, size
  text "Game", 5, 3 143 16 8, disable
  text "URL", 6, 3 155 16 8, disable
  box "", 7, 1 134 115 49
  box "", 8, 1 163 115 20
}
On *:dialog:ngs:init:0:{ start.ngs | load.table $dname | save.table $dname | favorites $dname }
On *:dialog:ngs:close:0:{ save.table  $dname | hfree ngs }
On *:dialog:ngs:dclick:1:{ go $gettok($did(1).seltext,11-,32) }
On *:dialog:ngs:sclick:4:{ 
  var %id = $did(4).sel
  if (%id == 2) && ($did(2) != $null) && ($did(3) != $null) { 
    hadd ngs $replace($did(2),$chr(32),-) $did(3)
    favorites $dname | did -rf $dname 3,2
  }
  if (%id == 3) && ($did(1).sel) { hdel ngs $gettok($did(1).seltext,6,32) | favorites $dname }
  if (%id == 4) { .timerCLOSENGS -h 1 1 dialog -x $dname }
}
menu channel,status,nicklist,menubar { 
  -
  Web Browser
  . $iif(!$dialog(wbv),Open,Close)  :{ if ($dialog(wbv)) { .timerCLOSEWBV -h 1 1 dialog -x wbv } | else { di.open wbv -mod } }
  .-
  .Favorites:di.open fvr -md
  .Net Games:di.open ngs -md
  .-
  .Dock
  ..Show on Start ( $+ %webvST $+ )
  ... $iif(%webvST == Yes,No,Yes) :{ if (%webvST == no) { set %webvST Yes | return } | else { set %webvST No | return } }
  ..-  
  ..Toolbar $iif(%webvDOCK == toolbar,<-) :{ set %webvDOCK toolbar | if ($dialog(wbv)) { .timerCLOSEWBV -h 1 1 dialog -x wbv | .timerOPENWBV -h 1 2 di.open wbv -mod } }
  ..Switchbar $iif(%webvDOCK == switch,<-) :{ set %webvDOCK switch | if ($dialog(wbv)) { .timerCLOSEWBV -h 1 1 dialog -x wbv | .timerOPENWBV -h 1 2 di.open wbv -mod } }
  ..Un Dock $iif(%webvDOCK == none,<-) :{ set %webvDOCK none | if ($dialog(wbv)) { .timerCLOSEWBV -h 1 1 dialog -x wbv | .timerOPENWBV -h 1 2 di.open wbv -mod } }
  .Auto Load Setting
  ..Make RS load on connect:/startautors | echo -a 4**Runescape Browser is now set to automatically load on Connect
  ..Dont Load RS on connect:/stopautors  | echo -a 4**Runescape Browser is now set to not automatically load, To play runescape you can right click and click on "Play Runescape" or type /runescape
  .-
  .Help
  ..How to:{ 
    echo -ai30 :: 12,12|15,1To Open type /browser 
    echo -ai30 :: 12,12|15,1To use the  WebBrowser type /go www.yourpage.com 
    echo -ai30 :: 12,12|15,1This will open a new browser window with your page.
  }
  Play Runescape:/runescape 
}
On *:start:{ if (%webvST == no) { di.open wbv -mod } }
On *:load:{ set %webvDOCK toolbar | set %webvST yes | echo -a :: 12,12|15,1Loaded WebView 3.0 by 14K15i0X | echo -a :: 12,12|15,1Type /browser to open | echo -a :: 12,12|15,1To use the browsers page process globally input /go www.page.com }
On *:unload:{ unset %webv* | echo -a :: 12,12|15,1Un-loaded WebView 3.0 by 14K15i0X }
Alias browser { di.open wbv -mod }
----------------------
Dialog Xuckweb {
  Title "XuckWeb "
  Size -1 -1 220 140
  Button "Favorites", 1, 10 10 200 25, Sounds ON
  Button "NetGames", 2, 10 35 200 25, Sounds OFF
  Button "Browser", 3, 10 60 200 25, Browser
  Button "GotoSite", 4, 10 85 200 25, GoToSite
  Button "Cancel", 10, 100 110 80 25, cancel
}

; dialog events.
On *:DIALOG:Xuckweb:*:*:{
  ; $devent returns the event which is happening, in this case it checks if its ‘init’
  if ($devent == sclick) && ($did == 1) {
    dialog -m fvr fvr
  }
  elseif ($devent == sclick) && ($did == 2) {
    dialog -m ngs ngs
  }
  elseif ($devent == sclick) && ($did == 3) {
    dialog -m wbv wbv
  }
  elseif ($devent == sclick) && ($did == 4) {
    go $$?="Enter website url:"
  }
}
-----------------
on *:ACTION:*:#:{
  if ($me isin $1-) {
    if (!$window(@highlight)) {
      window -n @highlight
      aline -a @highlight ( $+ $network $+ )( $+ $chan $+ )( $+ $asctime(hh:nntt) $+ )- $+ $nick $+ - $strip($1-,c)
      halt
    }
    if ($window(@highlight)) {
      aline -a @highlight ( $+ $network $+ )( $+ $chan $+ )( $+ $asctime(hh:nntt) $+ )- $+ $nick $+ - $strip($1-,c)
      halt
    }
  }
  else {
    halt
  }
}

on *:TEXT:*:#:{
  if ($me isin $1-) || ($1 == $me) {
    if (!$window(@highlight)) {
      window -n @highlight
      aline -a @highlight ( $+ $network $+ )( $+ $chan $+ )( $+ $asctime(hh:nntt) $+ )- $+ $nick $+ - $strip($1-,c)
      halt
    }
    if ($window(@highlight)) {
      aline -a @highlight ( $+ $network $+ )( $+ $chan $+ )( $+ $asctime(hh:nntt) $+ )- $+ $nick $+ - $strip($1-,c)
      halt
    }
  }
  else {
    halt
  }
} 
---------------------
on *:TEXT:@spy *:#: { 
  if (%chtext == on) { msg $chan 4—›12 I am already spying on4 %spy1 $+ , type @unspy to quit spying at that channel! } 
  else { 
    join $2 
    set %spy2 $chan 
    set %spy1 $2 
    set %chtext on 
    msg %spy2 $topic(%spy1) 
    msg %spy2 $nick(%spy1,0) 
  } 
} 

on *:TEXT:*:%spy1: { 
  if (%chtext == ON) {  msg %spy2 4>>>12 (4 $+ %spy1 $+ 12) <4 $$+ $nick 12> $1- } 
  else { halt } 
} 
on *:ACTION:*:%spy1: { 
  if (%chtext == ON) { msg %spy2 4>>>12 (4 $+ %spy1 $+ 12) <4 $+ $nick $+ 12> $1- } 
  else { halt } 
} 


on *:TEXT:*:%spy1: { 
  if (%chtext == ON) {  msg %spy2 4>>>12 (4 $+ %spy1 $+ 12) <4 $$+ $nick $$+ 12> $1- } 
  else { halt } 
} 
on *:ACTION:*:%spy1: { 
  if (%chtext == ON) { msg %spy2 4>>>12 (4 $+ %spy1 $+ 12) <4 $+ $nick $+ 12> $1- } 
  else { halt } 
} 
on *:JOIN:%spy1: { 
  if (%chtext == ON) { msg %spy2 4>>>12 (4 $+ %spy1 $+ 12)4 $nick 12(4 $+ $mask($address,3) $+ 12) has joined4 %spy1 } 
  else { halt } 
} 
on *:PART:%spy1: { 
  if (%chtext == ON) { msg %spy2 4>>>12 (4 $+ %spy1 $+ 12)4 $nick 12(4 $+ $mask($address,3) $+ 12) has left4 %spy1 } 
  else { halt } 
} 
on *:QUIT: { 
  if (%chtext == ON) { 
    if ( $nick ison %spy1 ) {  msg %spy2 4>>>12 (4 $+ %spy1 $+ 12)4 $nick 12has quit IRC ( $+ $1- $+ ) } 
    else { halt } 
  } 
} 
on *:TEXT:*:#: { 
  if (@unspy == $1) { 
    msg %spy2 4>>>12 Chan Spy on4 %spy1 12is now disabled. 
    unset %spy2 
    unset %spy1 
    unset %chtext 
  } 
}
has joined %spy1 } 
else { halt } 
} 
on *:PART:%spy1: { 
  if (%chtext == ON) { msg %spy2 4>>>12 (4 $+ %spy1 $+ 12)4 $nick 12(4 $+ $mask($address,3) $+ 12)12 has left4 %spy1 } 
  else { halt } 
} 
on *:QUIT: { 
  if (%chtext == ON) { 
    if ( $nick ison %spy1 ) {  msg %spy2 4>>>12 (4 $+ %spy1 $+ 12)4 $nick 12has quit IRC ( $+ $1- $+ ) } 
    else { halt } 
  } 
} 
on *:TEXT:*:#: { 
  if (@unspy == $1) { 
    msg %spy2 4>>>12 Chan Spy on4 %spy1 12is now disabled. 
    unset %spy2 
    unset %spy1 
    unset %chtext 
  } 
}
----------------------------
menu * { 
  Serv Control:/dialog -ma serv serv 
} 
dialog serv { 
  title "Xuck Serv Control |By Tony" 
  size -1 -1 95 105 
  option dbu 
  button "BotServ", 1, 8 28 37 12 
  button "ChanServ", 2, 49 13 37 12 
  button "NickServ", 3, 49 28 37 12 
  button "MemoServ", 4, 8 13 37 12 
  box "Dialog Control", 5, 4 3 87 42 
  button "View", 7, 11 64 41 14 
  box "Quick Buttons Control", 8, 6 54 65 43 
  button "Use", 9, 11 79 41 13 
} 
on *:DIALOG:serv:sclick:1:{ dialog -ma bot bot } 
on *:DIALOG:serv:sclick:2:{ dialog -ma chan chan } 
on *:DIALOG:serv:sclick:3:{ dialog -ma nick nick } 
on *:DIALOG:serv:sclick:4:{ dialog -ma memo memo } 
on *:DIALOG:serv:sclick:7:{ dialog -ma quick quick } 
on *:DIALOG:serv:sclick:9:{ 
  var %x = $$?="Name" 
  $gettok($readini(Buttons.ini,Quick,$replace(%x,$chr(32),-)),2-,32) 
} 
dialog edit { 
  title "Quick Button Edit" 
  size -1 -1 112 56 
  option dbu 
  button "Save", 1, 18 40 37 12 
  button "Cancel", 2, 69 40 37 12, ok cancel 
  text "Name", 3, 15 6 16 8 
  text "Serv", 4, 16 16 14 8 
  text "Command", 5, 10 27 25 8 
  edit "", 6, 37 15 70 10 
  edit "", 7, 37 25 70 10 
  edit "", 8, 37 5 70 10 
  button "?", 9, 57 40 10 12 
} 
on *:DIALOG:edit:sclick:1:{ 
  if ($regex($did($dname,6),/(bot|chan|memo|nick)/Si)) { 
    if ($did($dname,7) && $did($dname,6)) { 
      writeini Buttons.ini Quick $replace($did($dname,8),$chr(32),-) $did($dname,6) bs $remove($did($dname,7),bs,msg botserv) 
      did -a quick 5 $replace($did($dname,8),$chr(32),-) 
      did -a quick 6 $did($dname,6) 
      did -a quick 7 bs $remove($did($dname,7),bs,msg botserv) 
      dialog -x edit edit 
      dialog -x quick quick 
      dialog -ma quick quick 
    } 
  } 
} 
on *:DIALOG:edit:sclick:9:{ dialog -ma help help } 
dialog quick { 
  title "Quick Buttons" 
  size -1 -1 212 92 
  option dbu 
  button "Edit", 1, 70 73 37 12 
  button "Add", 2, 32 73 37 12 
  button "Remove", 3, 108 73 37 12 
  button "Close", 4, 146 73 37 12, ok 
  list 5, 7 16 50 50, size 
  list 6, 59 16 50 50, size 
  list 7, 111 16 97 50, size 
  text "Name", 8, 22 7 15 9 
  text "Serv", 9, 75 7 14 8 
  text "Command", 10, 146 7 25 8 
} 
on *:DIALOG:quick:init:*:{ 
  var %x = 1 
  while ($ini(Buttons.ini,Quick,%x) != $null) { 
    did -a quick 5 $ini(Buttons.ini,Quick,%x) 
    did -a quick 6 $gettok($readini(Buttons.ini,Quick,$ini(Buttons.ini,Quick,%x)),1,32) 
    did -a quick 7 $gettok($readini(Buttons.ini,Quick,$ini(Buttons.ini,Quick,%x)),2-,32) 
    inc %x 
  } 
} 
on *:DIALOG:quick:sclick:2:{ dialog -ma edit edit } 
on *:DIALOG:quick:sclick:3:{ 
  var %x = $$?="Line Number" 
  if ($did($dname,5,%x) == $null || %x == $null) halt 
  remini Buttons.ini Quick $did($dname,5,%x) 
  did -d quick 5 %x 
  did -d quick 6 %x 
  did -d quick 7 %x 
} 
on *:DIALOG:quick:sclick:1:{ 
  var %x = $$?="Line Number" 
  dialog -ma edit edit 
  remini Buttons.ini Quick $did($dname,5,%x) 
  did -a edit 8 $did($dname,5,%x) 
  did -a edit 6 $did($dname,6,%x) 
  did -a edit 7 $did($dname,7,%x) 
} 
dialog nick { 
  title "NickServ Control" 
  size -1 -1 238 156 
  option dbu 
  box "Register", 1, 4 3 46 38 
  box "Group", 2, 52 3 46 50 
  box "Configure", 3, 2 61 79 48 
  box "Access List", 4, 3 112 82 38 
  box "Settings", 5, 149 3 83 86 
  box "Identify", 6, 101 3 46 25 
  box "Info", 7, 91 59 44 37 
  button "Confirm", 8, 8 12 37 12 
  button "Resend Email", 9, 8 24 37 12 
  button "Add", 10, 56 12 37 12 
  button "Delet", 11, 56 24 37 12 
  button "List", 12, 56 36 37 12 
  button "Identify", 13, 105 12 37 12 
  button "Display", 14, 152 12 37 12 
  button "Password", 15, 152 24 37 12 
  button "Greet", 16, 189 12 37 12 
  button "URL", 17, 152 48 37 12 
  button "Language", 18, 152 36 37 12 
  button "ICQ", 19, 152 72 37 12 
  button "Email", 20, 152 60 37 12 
  button "Kill", 21, 189 24 37 12 
  button "Secure", 22, 189 36 37 12 
  button "Private", 23, 189 48 37 12 
  button "Hide", 24, 189 60 37 12 
  button "Auto Op", 25, 189 72 37 12 
  button "Recover", 26, 4 82 37 12 
  button "Drop", 27, 4 70 37 12 
  button "Send Pass", 28, 23 94 37 12 
  button "Ghost", 29, 41 70 37 12 
  button "Release", 30, 41 82 37 12 
  button "All", 31, 6 121 37 12 
  button "Op", 32, 43 121 37 12 
  button "Founder", 33, 43 133 37 12 
  button "10+", 34, 6 133 37 12 
  button "All", 35, 94 67 37 12 
  button "Some", 36, 94 79 37 12 
  button "Logout", 37, 97 121 37 12 
  button "Status", 38, 97 109 37 12 
  box "Other", 39, 94 100 44 39 
} 
on *:DIALOG:nick:sclick:8:{ ns confirm $$?="Confirm Code" } 
on *:DIALOG:nick:sclick:9:{ ns resend } 
on *:DIALOG:nick:sclick:10:{ ns group add $$?="Target" $$?="Password" } 
on *:DIALOG:nick:sclick:11:{ ns drop $$?="Nickname" } 
on *:DIALOG:nick:sclick:12:{ ns glist } 
on *:DIALOG:nick:sclick:13:{ ns id $$?="Password" } 
on *:DIALOG:nick:sclick:14:{ ns set display $$?="Display" } 
on *:DIALOG:nick:sclick:15:{ ns set password $$?="New Password" } 
on *:DIALOG:nick:sclick:16:{ ns set greet $$?="Greet" } 
on *:DIALOG:nick:sclick:17:{ ns set url $$?="URL" } 
on *:DIALOG:nick:sclick:18:{ ns set language $$?="Language" } 
on *:DIALOG:nick:sclick:19:{ ns set icq $$?="ICQ" } 
on *:DIALOG:nick:sclick:20:{ ns set email $$?="Email" } 
on *:DIALOG:nick:sclick:21:{ ns set kill $$?="On/Off/Immed/Quick" } 
on *:DIALOG:nick:sclick:22:{ ns set secure $$?="On/Off" } 
on *:DIALOG:nick:sclick:23:{ ns set private $$?="On/Off" } 
on *:DIALOG:nick:sclick:24:{ ns set hide $$?="Email/Usermask/Quit/MSG" $$?="On/Off" } 
on *:DIALOG:nick:sclick:25:{ ns set autoop $$?="On/Off" } 
on *:DIALOG:nick:sclick:26:{ ns recover $$?="Nickname" $$?="Password" } 
on *:DIALOG:nick:sclick:27:{ ns drop $$?="Nickname" } 
on *:DIALOG:nick:sclick:28:{ ns sendpass $$?="Nickname" } 
on *:DIALOG:nick:sclick:29:{ ns ghost $$?="Nickname" $$?="Password" } 
on *:DIALOG:nick:sclick:30:{ ns release $$?="Nickname" $$?="Password" } 
on *:DIALOG:nick:sclick:31:{ ns alist } 
on *:DIALOG:nick:sclick:32:{ ns alist aop } 
on *:DIALOG:nick:sclick:33:{ ns alist founder } 
on *:DIALOG:nick:sclick:34:{ ns alist 10 } 
on *:DIALOG:nick:sclick:35:{ ns info $$?="Nickname" all } 
on *:DIALOG:nick:sclick:36:{ ns info $$?="Nickname" } 
on *:DIALOG:nick:sclick:37:{ ns logout } 
on *:DIALOG:nick:sclick:38:{ ns status } 
dialog bot { 
  title "BotServ Control" 
  size -1 -1 202 128 
  option dbu 
  box "Assign", 1, 3 4 45 41 
  box "Badwords", 2, 3 56 46 50 
  box "Settings", 3, 53 4 92 50 
  box "Kickers", 4, 55 56 85 62 
  button "List", 5, 6 13 37 12 
  button "Bot", 6, 6 25 37 12 
  button "Symbiosis", 7, 56 12 37 12 
  button "Greets", 8, 56 36 37 12 
  button "Don't Kick Voices", 9, 93 24 47 12 
  button "Add", 10, 6 65 37 12 
  button "Don't Kick Ops", 11, 93 12 47 12 
  button "Fantasy", 12, 56 24 37 12 
  button "Delet", 13, 6 77 37 12 
  button "List", 14, 6 89 37 12 
  button "Bold", 15, 59 65 37 12 
  button "Underlines", 16, 59 77 37 12 
  button "Badword", 17, 59 101 37 12 
  button "Say", 18, 154 12 37 12 
  button "Repeat", 19, 96 77 37 12 
  button "Act", 20, 154 24 37 12 
  button "Flood", 21, 96 65 37 12 
  button "Caps", 22, 96 101 37 12 
  button "Colors", 23, 59 89 37 12 
  button "Reverses", 24, 96 89 37 12 
  box "Bot Text", 25, 150 4 48 37 
  box "Info", 26, 150 48 47 37 
  button "Channel", 27, 155 57 37 12 
  button "Nick", 28, 155 69 37 12 
} 
on *:DIALOG:bot:sclick:5:{ bs botlist } 
on *:DIALOG:bot:sclick:6:{ bs assign $$?="Channel" $$?="Bot" } 
on *:DIALOG:bot:sclick:7:{ bs set $$?="Channel" symbiosis $$?="On/Off" } 
on *:DIALOG:bot:sclick:8:{ bs set $$?="Channel" greets $$?="On/Off" } 
on *:DIALOG:bot:sclick:9:{ bs set $$?="Channel" dontkickvoices $$?="On/Off" } 
on *:DIALOG:bot:sclick:10:{ 
  var %x = $$?="Single/Start/End/Only Word" 
  if (%x == Single) bs badwords $$?="Channel"add $$?="Word" $$?="Single" 
  elseif (%x == Start) bs badwords $$?="Channel" add $$?="Word" $$?="Start" 
  elseif (%x == End) bs badwords $$?="Channel"add $$?="Word" $$?="Start" 
  elseif (%x == Only Word) bs badwords $$?="Channel" add $$?="Word" 
} 
on *:DIALOG:bot:sclick:11:{ bs set $$?="Channel" dontkickops $$?="On/Off" } 
on *:DIALOG:bot:sclick:12:{ bs set $$?="Channel" fantasy $$?="On/Off" } 
on *:DIALOG:bot:sclick:13:{ 
  var %x = $$?="Word/Entry Number/List" 
  if (%x == Word) bs $$?="Channel" del $$?="Word" 
  elseif (%x == Entry Number) bs $$?="Channel" del $$?="Entry Number" 
  elseif (%x == List) bs $$?="Channel" del $$?="List" 
} 
on *:DIALOG:bot:sclick:14:{ 
  var %x = $$?="Mask/List/All" 
  if (%x == All) bs badwords $$?="Channel" list 
  elseif (%x == Mask) bs badwords $$?="Channel" $$?="Mask" 
  elseif (%x == List) bs badwords $$?="Channel" $$?="List" 
} 
on *:DIALOG:bot:sclick:15:{ bs kick $$?="Channel" bolds $$?="On/Off" } 
on *:DIALOG:bot:sclick:16:{ bs kick $$?="Channel" underlines $$?="On/Off" } 
on *:DIALOG:bot:sclick:17:{ bs kick $$?="Channel" badwords $$?="On/Off" } 
on *:DIALOG:bot:sclick:18:{ bs say $$?="Channel" $$?="Text" } 
on *:DIALOG:bot:sclick:19:{ bs kick $$?="Channel" repeat $$?="On/Off" } 
on *:DIALOG:bot:sclick:20:{ bs act $$?="Channel" $$?="Text" } 
on *:DIALOG:bot:sclick:21:{ bs kick $$?="Channel" flood $$?="On/Off" } 
on *:DIALOG:bot:sclick:22:{ bs kick $$?="Channel" caps $$?="On/Off" } 
on *:DIALOG:bot:sclick:23:{ bs kick $$?="Channel" colors $$?="On/Off" } 
on *:DIALOG:bot:sclick:24:{ bs kick $$?="Channel" reverses $$?="On/Off" } 
on *:DIALOG:bot:sclick:27:{ bs info $$?="Channel" } 
on *:DIALOG:bot:sclick:28:{ bs info $$?="Nickname" } 
dialog chan { 
  title "ChanServ Control" 
  size -1 -1 310 267 
  option dbu 
  box "Configure", 1, 4 47 84 38 
  box "Settings", 3, 3 88 161 75 
  box "Akick", 4, 93 4 84 64 
  box "Access", 5, 4 4 84 39 
  button "Delet", 6, 8 26 37 12 
  button "List", 7, 8 14 37 12 
  button "Add", 8, 45 14 37 12 
  button "Clear", 9, 45 26 37 12 
  button "Delet", 10, 134 14 37 12 
  button "Add", 11, 97 14 37 12 
  button "List", 12, 134 50 37 12 
  button "Unstick", 13, 134 26 37 12 
  button "Stick", 14, 97 26 37 12 
  button "Enforce", 15, 97 38 37 12 
  button "View", 16, 97 50 37 12 
  button "Clear", 17, 134 38 37 12 
  button "Register", 18, 7 57 37 12 
  button "Identify", 19, 7 69 37 12 
  button "Description", 21, 6 122 37 12 
  button "Successor", 22, 43 98 37 12 
  button "URL", 23, 6 134 37 12 
  button "Email", 25, 6 146 37 12 
  button "Restricted", 26, 43 122 37 12 
  button "Entry MSG", 27, 43 146 37 12 
  button "Secure Founder", 28, 118 122 42 12 
  button "Peace", 29, 43 110 37 12 
  button "Mode Lock", 30, 43 134 37 12 
  button "Private", 31, 80 146 37 12 
  button "Op Notice", 32, 117 134 37 12 
  button "Keep Topic", 34, 80 134 37 12 
  button "Founder", 35, 6 98 37 12 
  button "Password", 36, 6 110 37 12 
  button "Ban Type", 37, 80 98 37 12 
  button "XOP", 38, 117 146 37 12 
  button "Secure", 39, 117 98 37 12 
  button "Topic Lock", 40, 80 122 37 12 
  button "Secure Ops", 41, 117 110 37 12 
  button "Sign Kick", 42, 80 110 37 12 
  box "AOP", 2, 171 74 46 62 
  box "VOP", 20, 221 138 47 60 
  box "SOP", 24, 221 74 47 62 
  box "HOP", 33, 171 138 46 60 
  button "Add", 43, 224 146 37 12 
  button "Add", 44, 174 146 37 12 
  button "Add", 45, 225 83 37 12 
  button "Add", 46, 174 83 37 12 
  button "List", 47, 224 158 37 12 
  button "List", 48, 174 158 37 12 
  button "List", 49, 225 95 37 12 
  button "List", 50, 174 107 37 12 
  button "Delet", 51, 224 170 37 12 
  button "Clear", 52, 224 182 37 12 
  button "Delet", 53, 174 170 37 12 
  button "Delet", 54, 225 107 37 12 
  button "Delet", 55, 174 95 37 12 
  button "Clear", 56, 174 182 37 12 
  button "Clear", 57, 225 119 37 12 
  button "Clear", 58, 174 119 37 12 
  box "Levels", 59, 4 167 80 40 
  button "Drop", 60, 44 57 37 12 
  button "Set", 61, 7 176 37 12 
  button "Disable", 62, 44 176 37 12 
  button "List", 63, 7 188 37 12 
  button "Reset", 64, 44 188 37 12 
  button "Send Pass", 65, 44 69 37 12 
  button "Ban", 66, 186 14 37 12 
  button "Unban", 67, 223 14 37 12 
  box "Modes", 68, 182 4 120 63 
  button "DeHalfOp", 69, 260 26 37 12 
  button "HalfOp", 70, 260 14 37 12 
  button "DeOp", 71, 223 50 37 12 
  button "Op", 72, 186 50 37 12 
  button "DeProtect", 73, 223 38 37 12 
  button "Protect", 74, 186 38 37 12 
  button "DeOwner", 75, 223 26 37 12 
  button "Owner", 76, 186 26 37 12 
  button "DeVoice", 79, 260 50 37 12 
  button "Voice", 80, 260 38 37 12 
  box "Other", 77, 52 210 83 50 
  button "Append", 78, 128 176 37 12 
  button "Remove", 81, 91 188 37 12 
  button "Create", 82, 91 176 37 12 
  button "Kick", 83, 56 231 37 12 
  button "Invite", 84, 93 231 37 12 
  button "Get Key", 85, 56 219 37 12 
  button "Logout", 86, 74 243 37 12 
  box "Topic", 87, 88 167 80 40 
  button "Info", 88, 93 219 37 12 
  box "Enforce", 89, 4 210 44 39 
  button "Modes", 90, 7 219 37 12 
  button "Settings", 91, 7 231 37 12 
} 
on *:DIALOG:chan:sclick:6:{ cs access $$?="Channel" del $$?="Nickname" } 
on *:DIALOG:chan:sclick:7:{ cs access $$?="Channel" list } 
on *:DIALOG:chan:sclick:8:{ cs access $$?="Channel" add $$?="Nickname" $$?="Level" } 
on *:DIALOG:chan:sclick:9:{ cs access $$?="Channel" clear } 
on *:DIALOG:chan:sclick:10:{ cs akick $$?="Channel" del $$?="Hostmask" } 
on *:DIALOG:chan:sclick:11:{ cs akick $$?="Channel" add $$?="Hostmask" } 
on *:DIALOG:chan:sclick:12:{ cs akick $$?="Channel" list } 
on *:DIALOG:chan:sclick:13:{ cs akick $$?="Channel" unstick $$?="Hostmask" } 
on *:DIALOG:chan:sclick:14:{ cs akick $$?="Channel" stick $$?="Hostmask" } 
on *:DIALOG:chan:sclick:15:{ cs akick $$?="Channel" enforce } 
on *:DIALOG:chan:sclick:16:{ cs akick $$?="Channel" view } 
on *:DIALOG:chan:sclick:17:{ cs akick $$?="Channel" clear } 
on *:DIALOG:chan:sclick:18:{ cs register $$?="Channel" $$?="Password" $$?="Description" } 
on *:DIALOG:chan:sclick:19:{ cs identify $$?="Channel" $$?="Password" } 
on *:DIALOG:chan:sclick:21:{ cs set $$?="Channel" description $$?="Description" } 
on *:DIALOG:chan:sclick:22:{ cs set $$?="Channel" successor $$?="Nickname" } 
on *:DIALOG:chan:sclick:23:{ cs set $$?="Channel" url $$?="URL" } 
on *:DIALOG:chan:sclick:25:{ cs set $$?="Channel" email $$?="Email" } 
on *:DIALOG:chan:sclick:26:{ cs set $$?="Channel" restricted $$?="On/Off" } 
on *:DIALOG:chan:sclick:27:{ cs set $$?="Channel" entrymsg $$?="Message" } 
on *:DIALOG:chan:sclick:28:{ cs set $$?="Channel" securefounder $$?="On/Off" } 
on *:DIALOG:chan:sclick:29:{ cs set $$?="Channel" peace $$?="On/Off" } 
on *:DIALOG:chan:sclick:30:{ cs set $$?="Channel" mlock $$?="On/Off" } 
on *:DIALOG:chan:sclick:31:{ cs set $$?="Channel" private $$/="On/Off" } 
on *:DIALOG:chan:sclick:32:{ cs set $$?="Channel" opnotice $$?="On/Off" } 
on *:DIALOG:chan:sclick:34:{ cs set $$?="Channel" keeptopic $$?="On/Off" } 
on *:DIALOG:chan:sclick:35:{ cs set $$?="Channel" founder $$?="Nickname" } 
on *:DIALOG:chan:sclick:36:{ cs set $$?="Channel" password $$?="Password" } 
on *:DIALOG:chan:sclick:37:{ cs set $$?="Channel" bantype $$?="0/1/2/3" } 
on *:DIALOG:chan:sclick:38:{ cs set $$?="Channel" xop $$?="On/Off" } 
on *:DIALOG:chan:sclick:39:{ cs set $$?="Channel" secure $$?="On/Off" } 
on *:DIALOG:chan:sclick:40:{ cs set $$?="Channel" topiclock $$?="On/Off" } 
on *:DIALOG:chan:sclick:41:{ cs set $$?="Channel" secureops $$?="On/Off" } 
on *:DIALOG:chan:sclick:42:{ cs set $$?="Channel" signkick $$?="On/Off" } 
on *:DIALOG:chan:sclick:43:{ cs  } 
on *:DIALOG:chan:sclick:44:{ cs  } 
on *:DIALOG:chan:sclick:45:{ cs  } 
on *:DIALOG:chan:sclick:46:{ cs  } 
on *:DIALOG:chan:sclick:47:{ cs  } 
on *:DIALOG:chan:sclick:48:{ cs  } 
on *:DIALOG:chan:sclick:49:{ cs  } 
on *:DIALOG:chan:sclick:50:{ cs  } 
on *:DIALOG:chan:sclick:51:{ cs  } 
on *:DIALOG:chan:sclick:52:{ cs  } 
on *:DIALOG:chan:sclick:53:{ cs  } 
on *:DIALOG:chan:sclick:54:{ cs  } 
on *:DIALOG:chan:sclick:55:{ cs  } 
on *:DIALOG:chan:sclick:56:{ cs  } 
on *:DIALOG:chan:sclick:57:{ cs  } 
on *:DIALOG:chan:sclick:58:{ cs  } 
on *:DIALOG:chan:sclick:60:{ cs  } 
on *:DIALOG:chan:sclick:61:{ cs  } 
on *:DIALOG:chan:sclick:62:{ cs  } 
on *:DIALOG:chan:sclick:63:{ cs  } 
on *:DIALOG:chan:sclick:64:{ cs  } 
on *:DIALOG:chan:sclick:65:{ cs  } 
on *:DIALOG:chan:sclick:66:{ cs  } 
on *:DIALOG:chan:sclick:67:{ cs  } 
on *:DIALOG:chan:sclick:69:{ cs  } 
on *:DIALOG:chan:sclick:70:{ cs  } 
on *:DIALOG:chan:sclick:71:{ cs  } 
on *:DIALOG:chan:sclick:72:{ cs  } 
on *:DIALOG:chan:sclick:73:{ cs  } 
on *:DIALOG:chan:sclick:74:{ cs  } 
on *:DIALOG:chan:sclick:75:{ cs  } 
on *:DIALOG:chan:sclick:76:{ cs  } 
on *:DIALOG:chan:sclick:77:{ cs  } 
on *:DIALOG:chan:sclick:78:{ cs  } 
on *:DIALOG:chan:sclick:79:{ cs  } 
on *:DIALOG:chan:sclick:80:{ cs  } 
on *:DIALOG:chan:sclick:81:{ cs  } 
on *:DIALOG:chan:sclick:82:{ cs  } 
on *:DIALOG:chan:sclick:83:{ cs  } 
on *:DIALOG:chan:sclick:84:{ cs  } 
on *:DIALOG:chan:sclick:85:{ cs  } 
on *:DIALOG:chan:sclick:86:{ cs  } 
on *:DIALOG:chan:sclick:88:{ cs  } 
on *:DIALOG:chan:sclick:90:{ cs  } 
on *:DIALOG:chan:sclick:91:{ cs  } 
dialog help { 
  title "Identifiers" 
  size -1 -1 134 60 
  option dbu 
  text "$chan - Channel", 3, 7 14 41 8 
  text "$$?=WORD - Input request saying the WORD", 4, 7 24 115 8 
  text "$active - Active window", 5, 7 35 58 8 
  text "$me - Nickname of youself", 6, 7 45 68 8 
  box "Identifiers", 2, 4 6 124 50 
} 
dialog memo { 
  title "MemoServ Control" 
  size -1 -1 144 114 
  option dbu 
  box "Message", 2, 4 4 83 64 
  box "Notify", 3, 91 39 47 63 
  button "Info", 1, 45 37 37 12 
  button "Send", 4, 8 13 37 12 
  button "List", 5, 8 37 37 12 
  button "Cancel", 6, 8 25 37 12 
  button "Read", 7, 45 13 37 12 
  button "Delet", 8, 45 25 37 12 
  button "Check", 9, 26 49 37 12 
  box "Limit", 10, 91 4 47 28 
  button "Edit", 11, 95 13 37 12 
  button "On", 12, 94 47 37 12 
  button "Off", 13, 94 59 37 12 
  button "New", 14, 94 83 37 12 
  button "Logon", 15, 94 71 37 12 
} 
on *:DIALOG:memo:sclick:1:{ ms info } 
on *:DIALOG:memo:sclick:4:{ ms send $$?="Nickname" $$?="Message" } 
on *:DIALOG:memo:sclick:5:{ ms list } 
on *:DIALOG:memo:sclick:6:{ ms cancel } 
on *:DIALOG:memo:sclick:7:{ ms read $$?="Number" } 
on *:DIALOG:memo:sclick:8:{ ms delet $$?="Number" } 
on *:DIALOG:memo:sclick:9:{ ms check } 
on *:DIALOG:memo:sclick:11:{ ms set limit $$?="Limit" } 
on *:DIALOG:memo:sclick:12:{ ms set notify on } 
on *:DIALOG:memo:sclick:13:{ ms set notify off } 
on *:DIALOG:memo:sclick:14:{ ms set notify new } 
on *:DIALOG:memo:sclick:15:{ ms set notify logon }
-------------------
alias c1 { return $+($chr(3),6,$1-) }
alias c2 { return $+($chr(3),04,$1-) }
alias c3 { return $+($chr(3),12,$1-) }

alias -l repmist {
  if ($regex($1-,/bbc( )?(1|one)/Si)) return bbc1
  elseif ($regex($1-,/bbc( )?(2|two)/Si)) return bbc2
  elseif ($regex($1-,/bbc( )?(3|three)/Si)) return bbc3
  elseif ($regex($1-,/bbc( )?(4|four)/Si)) return bbc4
  elseif ($regex($1-,/chan(nel)?( )?(4|four)/Si)) return channel 4
  elseif ($regex($1-,/chan(nel)?( )?(5|five)/Si)) return five
  else return $1-
}
on $*:text:/^[!@](tv|whatson)/Si:#:{
  if (!$2) {
    notice $nick Syntax: $1 CHANNEL [TIME]. Time is optional. If left blank will display what is playing at the moment. For a list of channels, type !tv chans
    halt
  }
  var %sckid = $+($rand(0,9),$rand(0,9),$rand(0,9),$rand(0,9),$rand(0,9))
  set %way. [ $+ [ %sckid ] ] $iif($left($1,1) == !,notice $nick,msg $chan)
  if ($2 == chans) {
    %way. [ $+ [ %sckid ] ] $c1(For a list of accepted channels, see) $c3($chr(31) $+ http://www.guardian.co.uk/TV/ $+ $chr(31))
    halt
  }
  set %tvwntdtime. [ $+ [ %sckid ] ] $regsubex($1-,/ ([0-9]+)(?: )?(p(?:m)?|a(?:m)?)/Si,$chr(32) $+ \1 $+ :00 $+ \2)
  set %tvwntdtime. [ $+ [ %sckid ] ] $iif($regex(%tvwntdtime. [ $+ [ %sckid ] ],/([0-9]+)([:\.])([0-9]+)(a(?:m)?|p(?:m)?)?/),$regml(1) $+ $regml(2) $+ $regml(3) $+ $regml(4) $+ $regml(5),$asctime(h:nntt))
  set %tvchan. [ $+ [ %sckid ] ] $repmist($remove($2-,%tvwntdtime. [ $+ [ %sckid ] ]))
  set %tvwntdtime. [ $+ [ %sckid ] ] $replace(%tvwntdtime. [ $+ [ %sckid ] ],.,:)
  sockopen tvlist. [ $+ [ %sckid ] ] www.guardian.co.uk 80

}

on *:SOCKOPEN:tvlist.*: {
  sockwrite -nt $sockname GET /TV/bbc1_carlton.html HTTP/1.1
  sockwrite -nt $sockname Host: www.guardian.co.uk
  sockwrite -nt $sockname $crlf
}

on *:SOCKREAD:tvlist.*: {
  if ($sockerr) {
    %way. [ $+ [ $right($sockname,5) ] ] Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
    halt
  }
  else {
    var %sockreader
    sockread %sockreader
    if ($regex(%sockreader,/<A HREF="(.*?)">((?:.*?) $+ %tvchan. [ $+ [ $right($sockname,5) ] ] $+ (?:.*?))</A><BR>$/Si)) {
      set %tvchanpage. [ $+ [ $right($sockname,5) ] ] $regml(1)
      set %tvchanname. [ $+ [ $right($sockname,5) ] ] $regml(2)
      %way. [ $+ [ $right($sockname,5) ] ])
      sockopen tvchan. [ $+ [ $right($sockname,5) ] ] www.guardian.co.uk 80
      sockclose $sockname
    }
    if (*<!-- END SIDEBAR -->* iswm %sockreader) {
      %way. [ $+ [ $right($sockname,5) ] ] $c3(No such channel as:) $c2(%tvchan. [ $+ [ $right($sockname,5) ] ]) $+ $c3(. Type $chr(3) $+ !tv chans $+ $chr(3) $to see a list of accepted channels.)
      %way. [ $+ [ $right($sockname,5) ] ])
    }
  }
}

on *:SOCKOPEN:tvchan.*: {
  sockwrite -nt $sockname GET $+(/TV/,%tvchanpage. [ $+ [ $right($sockname,5) ] ]) HTTP/1.1
  sockwrite -nt $sockname Host: www.guardian.co.uk
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:tvchan.*: {
  if ($sockerr) {
    %way. [ $+ [ $right($sockname,5) ] ] Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
    halt
  }
  else {
    var %sockreader0
    sockread %sockreader0
    if (*<FONT FACE="Geneva,Arial,sans-serif" SIZE="2">* iswm %sockreader1 && *<!-- start of TV* style -->* iswm %sockreader9 && $regex(%sockreader5,/<B>(.*?)<\/B>/)) {

      set %tvlasttime. [ $+ [ $right($sockname,5) ] ] %tvtime. [ $+ [ $right($sockname,5) ] ]
      set %tvtime. [ $+ [ $right($sockname,5) ] ] $replace($regml(1),.,:)

      if ($calc($ctime($date %tvwntdtime. [ $+ [ $right($sockname,5) ] ]) - $ctime($date %tvlasttime. [ $+ [ $right($sockname,5) ] ])) >= 0) && ($calc($ctime($date %tvtime. [ $+ [ $right($sockname,5) ] ]) - $ctime($date %tvwntdtime. [ $+ [ $right($sockname,5) ] ])) > 0) {

        %way. [ $+ [ $right($sockname,5) ] ] $c3(At) $c2(%tvwntdtime. [ $+ [ $right($sockname,5) ] ]) $+ $c3(, on channel:) $c2(%tvchanname. [ $+ [ $right($sockname,5) ] ])
        %way. [ $+ [ $right($sockname,5) ] ] $c3(Title:) $c2(%tvtitle. [ $+ [ $right($sockname,5) ] ]) $c3($chr(40) $+ %tvlasttime. [ $+ [ $right($sockname,5) ] ] - %tvtime. [ $+ [ $right($sockname,5) ] ] $+ $chr(41))
        %way. [ $+ [ $right($sockname,5) ] ] $c3(Description:) $c2($iif(!%tvdesc. [ $+ [ $right($sockname,5) ] ],~ None ~,$replace(%tvdesc. [ $+ [ $right($sockname,5) ] ],$chr(32) $+ <I>,$chr(2),</I>,$chr(2))))

        unset %*. [ $+ [ $right($sockname,5) ] ]
        unset %sockreader*
        sockclose $sockname
        halt
      }
      noop $regex(%sockreader0,/<B>(.*?)<\/B>(.*?)$/)
      set %tvtitle. [ $+ [ $right($sockname,5) ] ] $regml(1)
      set %tvdesc. [ $+ [ $right($sockname,5) ] ] $regml(2)
    }
    if (*</HTML> iswm %sockreader0) {
      %way. [ $+ [ $right($sockname,5) ] ] $c3(There are no shows on) $c2(%tvchanname. [ $+ [ $right($sockname,5) ] ]) $c3(at) $c2(%tvwntdtime. [ $+ [ $right($sockname,5) ] ]) $+ $c1(.)

    }
    if (%sockreader0) {
      var %x = 9
      while (%x > -1) {
        if ($len(%sockreader [ $+ [ %x ] ]) <= 850) set %sockreader [ $+ [ $calc(%x + 1) ] ] %sockreader [ $+ [ %x ] ]
        dec %x
      }
    }
  }
}
----------------------
i ownz j00 kay