MISHScript: General Help System (GHS) — File Browser

MISHScriptGeneralHelpSystemGHSv4.10 / MISHScriptGeneralHelpSystemGHSv4.10 / GHS / mishghs.mrc

mishghs.mrc — 42.15 KB — Download this file

;=====================================================
; Project : MISHScript 4.10
; Script  : General Help System
;=====================================================
; Author  : Merlin (merlin@mishscript.de)
; Homepage: http://www.mishscript.de
; Date    : January 2006
; Revision: 4.10
; FileName: mishghs.mrc
;=====================================================
ON 1:LOAD: {
  SET %ghslogo MishGHS 4.10
  writeini $+($shortfn($scriptdir),mishghs.ini) GHSSetup GHSPath $shortfn($scriptdir)
  IF ($script(mishinit.mrc)) {
    .disable #ghslogo
    $addmod(MishGHS)
  }
  ELSE { 
    .enable #ghslogo 
    .remove $+($shortfn($scriptdir),..\modinst.mrc))
  }
  echo -s 13 $+ %ghslogo $+ :3*** Loading...
  echo -s 13 $+ %ghslogo $+ :3*** Compatibility Check...
  IF (($os == 3.1) || ($version < 6.16)) {
    echo -s 13 $+ %ghslogo $+ :3*** Compatibility Check: 4Failed
    echo -s 13 $+ %ghslogo $+ :3*** 4This script requires you have a version of mIRC of 6.16 or higher
    echo -s 13 $+ %ghslogo $+ :3*** 4Unloading %ghslogo ...
    UNSET %ghslogo
    .timer 1 4  .unload -rs $script
    HALT
  }
  ELSE {
    echo -s 13 $+ %ghslogo $+ :3*** Compatibility Check: 3Passed
    IF ($script(mishinit.mrc) == $null) {
      echo -s 13 $+ %ghslogo $+ :3*** Use 13F53 (Function Key 5) to start the GHS
      echo -s 13 $+ %ghslogo $+ :3*** Use 13Shift-F53 to open the GHS Help file
    }
    echo -s 13 $+ %ghslogo $+ :3*** A new Submenu13 %ghslogo 3has been created - Enjoy our Addon :)
    SET %ghslogo MishGHS 4.10 | .enable #ghslogo
  }
  :end
}
ON 1:START: {
  SET %ghslogo MishGHS 4.10
  IF ($script(mishinit.mrc) != $null) { .disable #ghslogo }
  ELSE { .enable #ghslogo }
  writeini $+($shortfn($scriptdir),mishghs.ini) GHSSetup GHSPath $shortfn($scriptdir)
}
menu menubar {
  Modules
  .%ghslogo
  ..Unload %ghslogo { ghsunload }
}
alias ghsunload {
  echo -s 13 $+ %ghslogo $+ :3*** De-Installation started
  echo -s 13 $+ %ghslogo $+ :3*** Removing files ... This may take a moment
  IF ($script(mishinit.mrc)) {
    $_opt.set(n1,6,0) |  $delmod(MishGHS) 
    %i = 1
    WHILE (%i <= $ini($ghsini,GHSPackage,0)) {
      IF ($readini($ghsini,GHSPackage,$ini($ghsini,GHSPackage,%i)) == 1) {
        $delmod($ini($ghsini,GHSPackage,%i))
      }
      INC %i
    }
  }
  VAR %gspath $ghspath
  .remove $+(%gspath,..\GHSInstall.txt)
  VAR %_temp = $findfile($+(%gspath,sounds\),*.*,0,.remove $shortfn($1-))
  VAR %_temp = $findfile($+(%gspath,icons\),*.*,0,.remove $shortfn($1-))
  VAR %_temp =  $findfile(%gspath,*.*,0,.remove $shortfn($1-))
  .rmdir $+(%gspath,icons)
  .rmdir $+(%gspath,sounds)
  .rmdir %gspath
  VAR %tn = $hget(0)
  WHILE (%tn > 0) { 
    IF ($left($hget(%tn),3) == GHS) { hfree $hget(%tn) }
    dec %tn 
  }
  .disable #helper
  echo -s 13 $+ %ghslogo $+ :3*** De-Installation successfull ... Thank you for using this AddOn
  .unload -rs mishghs.mrc
  UNSET %ghslogo %gspath
}

menu nicklist {
  -
  $+(%ghslogo,$chr(58)) Help -> $snick(#,1) { SET %h_chan $active | SET %h_nick $snick(#,1) | mishghs } 
}

alias ghspath  { RETURN $readini($+($shortfn($scriptdir),mishghs.ini),GHSSetup,GHSPath) }
alias ghsini    { RETURN $+($ghspath,mishghs.ini) }
alias ghssound  { RETURN $+($ghspath,sounds\) }
alias ghsicon   { RETURN $+($ghspath,icons\,$1)) }
; This makes sure we are inside the screen height/width
alias -l ghspos {
  IF (($gettok($readini($ghsini,GHSSetup,GHSPos),1,32) > $window(-1).w) || ($gettok($readini($ghsini,GHSSetup,GHSPos),2,32) > $window(-1).h)) {
    writeini $ghsini GHSSetup GHSPos -1 -1
  }
}
alias mishghs { 
  SET %h_chan $active
  VAR %ghsprefix = $readini($ghsini,GHSSetup,Prefix)
  VAR %ghspostfix = $readini($ghsini,GHSSetup,Postfix)
  SET %h_nick $replace($+(%ghsprefix,$snick(#,1),%ghspostfix),&_k,,&_b,,&_u,,&_r,,&_o,)
  ghspos
  $iif($dialog(Mish.GHS), dialog -ne Mish.GHS,dialog -mdo Mish.GHS Mish.GHS)
}
;  
dialog Mish.GHS {
  title "General Help System (GHS)"
  size -1 123 128 177
  option dbu
  icon $ghsicon(mishlogo.ico), 0
  tab "GHS Main", 100, 1 0 125 159
  box "Quick Help Buttons", 110, 3 16 60 31, tab 100
  button "Ask 1", 111, 5 24 18 10, disable tab 100
  button "Ask 2", 112, 5 35 18 10, disable tab 100
  button "Ask 3", 113, 24 24 18 10, disable tab 100
  button "Ask 4", 114, 24 35 18 10, disable tab 100
  button "Ask 5", 115, 43 24 18 10, disable tab 100
  button "Ask 6", 116, 43 35 18 10, disable tab 100
  button "Chatting", 117, 64 24 24 10, disable tab 100
  button "Channel", 118, 64 35 24 10, disable tab 100
  box "Rules", 119, 62 16 28 31, tab 100
  box "Nick Select", 130, 89 16 35 31, tab 100
  button "Select A New Nick", 131, 91 24 31 21, tab 100 multi
  box "", 140, 3 43 121 26, tab 100
  edit "Selected Nick to help", 141, 5 48 117 10, tab 100 read center
  edit "Active Channel", 142, 5 57 117 10, tab 100 read center
  text "Help Themes", 150, 5 70 52 7, tab 100
  combo 151, 4 78 54 76, disable tab 100 sort size drop
  text "Help Topics", 160, 4 89 52 7, tab 100
  list 161, 3 96 55 62, disable tab 100 sort size
  text "Help Lines", 170, 61 70 59 7, tab 100
  list 171, 59 77 65 81, disable tab 100 sort size
  tab "Help Themes", 200
  icon 201, 117 3 8 8,  $ghsicon(save0.png), 0, tab 200
  box "Available Themes", 220, 3 16 52 90, tab 200
  combo 221, 6 24 46 53, tab 200 sort size edit
  button "Add", 222, 7 77 22 12, disable tab 200
  button "Del", 223, 31 77 22 12, disable tab 200
  button "Create Table", 224, 7 91 46 12, disable tab 200
  box "Avaliable Topics", 230, 54 16 70 90, tab 200
  combo 231, 57 24 64 67, tab 200 sort size edit
  button "Add", 232, 57 91 22 12, disable tab 200
  button "Del", 233, 99 91 22 12, disable tab 200
  box "Available Items", 240, 3 106 121 51, tab 200
  combo 241, 6 114 66 40, tab 200 sort size edit drop
  edit "", 242, 5 125 117 30, tab 200 multi vsbar
  button "Add", 243, 74 113 14 11, tab 200
  button "Del", 244, 89 113 14 11, tab 200
  button "View", 245, 105 113 16 11, tab 200
  box "", 400, 2 160 56 15
  check "Send as Notice", 401, 4 165 48 8
  button "E X I T", 999, 84 162 42 13, cancel
  menu "Setup", 500
  item "GHS Helper Sounds", 501, 500, ok
  item "GHS Nick Format", 502, 500, ok

  menu "Help", 600
  item "GHS Help", 601, 600, ok
  item break, 602, 600
  item "MISHScript Homepage", 603, 600
}
ON *:DIALOG:Mish.GHS:INIT:*: {
  IF (($script(mishinit.mrc)) && ($readini($mishset,MISHScript,DialogTips) == 1)) {
    VAR %ttl =  $ttdll(Mark,$dialog($dname).hwnd)
    %i = 111
    WHILE (%i <= 116) { 
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > %i)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > %i $_lcget(%MishLang,DTT07001))
      INC %i 1
    }
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 117)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 117 $_lcget(%MishLang,DTT07002))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 118)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 118 $_lcget(%MishLang,DTT07003))  
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 131)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 131 $_lcget(%MishLang,DTT07004))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 141)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 141 $_lcget(%MishLang,DTT07005))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 142)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 142 $_lcget(%MishLang,DTT07005))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 151)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 151 $_lcget(%MishLang,DTT07006))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 161)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 161 $_lcget(%MishLang,DTT07007))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 171)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 171 $_lcget(%MishLang,DTT07008))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 221)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 221 $_lcget(%MishLang,DTT07021))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 222)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 222 $_lcget(%MishLang,DTT07022))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 223)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 223 $_lcget(%MishLang,DTT07023))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 224)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 224 $_lcget(%MishLang,DTT07024))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 231)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 231 $_lcget(%MishLang,DTT07025))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 232)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 232 $_lcget(%MishLang,DTT07026))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 233)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 233 $_lcget(%MishLang,DTT07027))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 241)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 241 $_lcget(%MishLang,DTT07028))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 242)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 242 $_lcget(%MishLang,DTT07029))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 243)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 243 $_lcget(%MishLang,DTT07030))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 244)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 244 $_lcget(%MishLang,DTT07031))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 245)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 245 $_lcget(%MishLang,DTT07032))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 401)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 401 $_lcget(%MishLang,DTT07009))
    VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 999)
    VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 999 $_lcget(%MishLang,DTT07010))
  }
  SET %_Topic $readini($ghsini,GHSSetup,GHSTheme)
  ; We get the selected nick and the channel
  IF ((%h_nick != $null) && (%h_nick ison %h_chan)) { did -ra $dname 141 Helping %h_nick | did -e $dname 111,112,113,114,115,116,117,118,151,161,171 }
  ELSE { did -ra $dname 141 WARNING: You MUST select a nick first!!! | did -b $dname 111,112,113,114,115,116,117,118,151,161,171 }
  IF ((%h_chan != $null) && ($left(%h_chan,1) == $chr(35))) { did -ra $dname 142 in %h_chan | did -e $dname 111,112,113,114,115,116,117,118,151,161,171 } 
  ELSE { did -ra $dname 142 WARNING: You MUST be on a channel!!!  | did -b $dname 111,112,113,114,115,116,117,118,151,161,171 }
  IF ((%h_nick == $null) && (%h_nick !ison %h_chan)) || ((%h_chan == $null) && ($left(%h_chan,1) != $chr(35))) { did -b $dname 111,112,113,114,115,116,117,118,151,161,171 }
  ; Loading of the general GHS tables
  %htab = GHS.General
  %hfile = $+($ghspath,%htab,.hsh)
  IF (!$hget(%htab)) { hmake %htab 10 }
  IF ($isfile(%hfile)) { hload  %htab %hfile }
  ; Get the GHS.Rules table
  %htab = GHS.Rules
  %hfile = $+($ghspath,%htab,.hsh)
  IF (!$hget(%htab)) { hmake %htab 10 }
  IF ($isfile(%hfile)) { hload  %htab %hfile }
  ; Cleaning out all lists
  did -r $dname 151,161,171,221,231,241
  ; We get the Help Themes 
  did -r $dname 151
  didtok $dname 151 44 $hget(GHS.General,Help.Groups)
  ; Don't add General to Themes list
  did -d $dname 151 $didwm($dname,151,General,1)
  did -ra $dname 221 General
  didtok $dname 221 44 $didtok($dname,151,44)
  did -ra $dname 150 Help Themes: $did($dname,151).lines

  did -cf $dname 151,161,171 1
  did -cf $dname 151 $didwm($dname,151,%_Topic,1)
  ; We clean out all lists
  did -r $dname 161,171,231,241
  ; We assign the theme we need to load
  %_sel = $+(GHS.,%_Topic,.,*.hsh)
  ; We make and load all tables available for the selected theme
  %i = 1
  WHILE (%i <= $findfile($ghspath,%_sel,0)) {
    %htab = $replace($remove($nopath($findfile($ghspath,%_sel,%i)),.hsh),$chr(32),_)
    %hfile = $replace($findfile($ghspath,%_sel,%i),$chr(32),_)
    IF (!$hget(%htab)) { hmake  %htab 10 }
    IF ($isfile(%hfile)) { hload  %htab %hfile }
    INC %i 1
  }
  ; We load the topics list for that item
  %i = 1
  SET %_seltbl $replace($+(GHS.,$did($dname,151).seltext,.Topics),$chr(32),_)
  WHILE (%i <= $hget(%_seltbl,0).data) {
    did -a $dname 161 $replace($hget(%_seltbl,%i).data,_,$chr(32))
    INC  %i 1
  }
  did -ra $dname 160 Help Topics: $did($dname,161).lines

  ; We load the items for the topics
  %i = 1
  WHILE (%i <= $hget($+(GHS.,$did($dname,151).seltext,.General),0).item) {
    ; We never show _&1 lines
    IF (_& !isin $hget($+(GHS.,$did($dname,151).seltext,.General),%i).item) {
      did -a $dname 171 $replace($hget($+(GHS.,$did($dname,151).seltext,.General),%i).item,_,$chr(32))
    }
    INC  %i 1
  }
  did -ra $dname 170 Help Lines: $did($dname,171).lines
  did -c $dname 161,171 1
  did $iif($readini($ghsini,GHSSetup,GHSNotice) == 1,-c,-u) $dname 401
  did -b $dname 241,242,243,244,245
}
; Quick Ask Buttons
ON *:DIALOG:Mish.GHS:SCLICK:111,112,113,114,115,116,117,118: {
  ; The Quick Ask buttons are numbered from 1 to 6
  ; Also the 2 Warn buttons
  %_sel = $calc($did - 110)
  msg %h_chan $t2g($hget(GHS.General,%_sel))
}
; Select a new nick
ON *:DIALOG:Mish.GHS:SCLICK:131: {
  did -b $dname 111,112,113,114,115,116,117,118,151,161,171
  SET %h_chan $active
  SET %h_nick $snick(%h_chan,1)

  IF ((%h_nick != $null) && (%h_chan != $null)) {
    ; We get the selected nick and the channel
    IF ((%h_nick != $null) && (%h_nick ison %h_chan)) { did -ra $dname 141 Helping %h_nick | did -e $dname 111,112,113,114,115,116,117,118,151,161,171 }
    ELSE { did -ra $dname 141 WARNING: You MUST select a nick first!!! | did -b $dname 111,112,113,114,115,116,117,118,151,161,171 }
    IF ((%h_chan != $null) && ($left(%h_chan,1) == $chr(35))) { did -ra $dname 142 in %h_chan | did -e $dname 111,112,113,114,115,116,117,118,151,161,171 } 
    ELSE { did -ra $dname 142 WARNING: You MUST be on a channel!!!  | did -b $dname 111,112,113,114,115,116,117,118,151,161,171 }
  }
  VAR %ghsprefix = $readini($ghsini,GHSSetup,Prefix)
  VAR %ghspostfix = $readini($ghsini,GHSSetup,Postfix),
  SET %h_nick $replace($+(%ghsprefix,$snick(%h_chan,1),%ghspostfix),&_k,,&_b,,&_u,,&_r,,&_o,)

}
; Help Themes
ON *:DIALOG:Mish.GHS:SCLICK:151: {
  ; We selected a help theme
  ; We clean out all lists
  did -r $dname 161,171,231,241
  ; We assign the theme we need to load
  %_sel = $+(GHS.,$did($dname,151).seltext,.,*.hsh)
  ; We make and load all tables available for the selected theme
  %i = 1
  WHILE (%i <= $findfile($ghspath,%_sel,0)) {
    %htab = $replace($remove($nopath($findfile($ghspath,%_sel,%i)),.hsh),$chr(32),_)
    %hfile = $replace($findfile($ghspath,%_sel,%i),$chr(32),_)
    IF (!$hget(%htab)) { hmake %htab 10 }
    IF ($isfile(%hfile)) { hload %htab %hfile }
    INC %i 1
  }
  ; We load the topics list for that them
  %i = 1
  SET %_seltbl $replace($+(GHS.,$did($dname,151).seltext,.Topics),$chr(32),_)
  WHILE (%i <= $hget(%_seltbl,0).data) {
    did -a $dname 161 $replace($hget(%_seltbl,%i).data,_,$chr(32))
    INC  %i 1
  }
  did -ra $dname 160 Help Topics: $did($dname,161).lines
  ; We load the items for the topics
  %i = 1
  WHILE (%i <= $hget($+(GHS.,$did($dname,151).seltext,.General),0).item) {
    ; We never show _&1 lines
    IF (_& !isin $hget($+(GHS.,$did($dname,151).seltext,.General),%i).item) {
      did -a $dname 171 $replace($hget($+(GHS.,$did($dname,151).seltext,.General),%i).item,_,$chr(32))
    }
    INC  %i 1
  }
  did -ra $dname 170 Help Lines: $did($dname,171).lines
  did -c $dname 161,171 1
  writeini $ghsini GHSSetup GHSTheme $did($dname,151).seltext
}
; Topic List
ON *:DIALOG:Mish.GHS:SCLICK:161: {
  did -r $dname 171
  ; We set the table name for the theme and topic
  SET %_seltbl $replace($+(GHS.,$did($dname,151).seltext,.,$did($dname,161).seltext),$chr(32),_)
  ; We load all topics and add them to the items list
  %i = 1
  WHILE (%i <= $hget(%_seltbl,0).item) {
    ; We never show _&1 lines
    IF (_& !isin $hget(%_seltbl,%i).item) {
      did -a $dname 171 $replace($hget(%_seltbl,%i).item,_,$chr(32)) 
    }
    INC  %i 1
  }
  did -ra $dname 170 Help Lines: $did($dname,171).lines
}
; Help Lines List
ON *:DIALOG:Mish.GHS:SCLICK:171: {
  SET %_selitem $replace($did($dname,171).seltext,$chr(32),_)
  %_line = $hget($replace($+(GHS.,$did($dname,151).seltext,.,$did($dname,161).seltext),$chr(32),_),%_selitem)
  ; When using Rules topic we send always to channel!
  IF ($did($dname,161).seltext == Rules) { msg %h_chan $t2g(%_line) | halt }
  ;check for chr 248
  VAR %i = 1
  IF ($numtok(%_line,248) > 1) {
    IF ($readini($ghsini,GHSSetup,GHSNotice) == 1) { SET %output notice $strip(%h_nick) }
    ELSE { SET %output msg %h_chan %h_nick $+ , }
    IF (%i == 1) {
      ; Is Notice set then we show "...sent to %h_nick via /notice..."
      ; otherwise we ignore the "..sent to %h_nick via /notice..."
      IF ($readini($ghsini,GHSSetup,GHSNotice) == 1) {
        msg %h_chan $gettok(%_line,1,248) send to %h_nick via /notice...
        VAR %_line = $gettok(%_line,2-,248)
      }
      ELSE { VAR %_line = $gettok(%_line,2-,248) }
      WHILE (%i <= $numtok(%_line,248)) { %output $t2g($gettok(%_line,%i,248)) | INC %i }
    }
  }
  ELSE {  
    IF ($readini($ghsini,GHSSetup,GHSNotice) == 1) { SET %output notice $strip(%h_nick) }
    ELSE { SET %output msg %h_chan %h_nick $+ , }
    %output $t2g(%_line) 
  }
  VAR %n = 0
  :next
  ; Checking if more lines for this item
  INC %n 1
  SET %_sitem $+(%_selitem,_&,%n)
  %_line = $hget($replace($+(GHS.,$did($dname,151).seltext,.,$did($dname,161).seltext),$chr(32),_),%_sitem)
  IF (%_line == $null) { UNSET %i %n %_sitem %_line | halt }
  ; GHSDelay is set to 2 seconds
  .timerGHS 1 $readini($ghsini,GHSSetup,GHSDelay) notice $strip(%h_nick) $t2g(%_line)
  goto next
}
;
;TAB 200: Themes
; 1. Add/delete themes, topics and items
; 2. Modify items
ON *:DIALOG:Mish.GHS:Edit:221: { 
  IF ($did($dname,221).text == $null) { UNSET %_seltheme | did -b $dname 222,223 | did -g $dname 201 $ghsicon(save1.png) }
  ELSEIF (%_seltheme == General) { did -b $dname 222,223 | did -g $dname 201 $ghsicon(save0.png) }
  ELSE { did -e $dname 222 | did -b $dname 223 | did -g $dname 201 $ghsicon(save1.png) }
}
;Select Theme
ON *:DIALOG:Mish.GHS:SCLICK:221: {
  did -g $dname 201 $ghsicon(save0.png)
  did -r $dname 231,241,242
  did -b $dname 232,233,241,242,243,244,245
  %_seltheme = $did($dname,221).seltext
  ; Special handling for GHS.General
  IF ($did($dname,221).seltext == General) {
    did -ra $dname 243 Chg
    did -r $dname 231,241,242
    ; We load the buttons: Ask1-6, Chat warning and channel rules
    %htab = GHS.General
    %hfile = GHS.General.hsh
    IF (!$hget(%htab)) { hmake %htab 10 }
    IF ($isfile(%hfile)) { hload %htab %hfile }
    did -ra $dname 231 Ask Buttons
    did -a $dname 231 Chatting Button
    did -a $dname 231 Channel Button
    did -c $dname 231 1
    did -e $dname 231
    ; Deleting not allowed
    did -b $dname 222,223
  }
  ELSE {
    did -ra $dname 243 Add
    %_sel = $+(GHS.,$did($dname,221).seltext,.hsh)
    ; Loading selected Theme tables
    %i = 1
    WHILE (%i <= $findfile($ghspath,%_sel,0)) {
      %htab = $replace($remove($nopath($findfile($ghspath,%_sel,%i)),.hsh),$chr(32),_)
      %hfile = $replace($findfile($ghspath,%_sel,%i),$chr(32),_)
      IF (!$hget(%htab)) { hmake %htab 10 }
      IF ($isfile(%hfile)) { hload %htab %hfile }
      INC %i 1
    }
    ; Loading available topics for first table in list
    SET %_seltbl $replace($+(GHS.,$did($dname,221).seltext,.Topics),$chr(32),_)
    %i = 1
    WHILE (%i <= $hget(%_seltbl,0).data) {
      did -a $dname 231 $replace($hget(%_seltbl,%i).data,_,$chr(32))
      INC  %i 1
    }
    ; Loading available items for first topic in list
    %i = 1
    WHILE (%i <= $hget($+(GHS.,$did($dname,231).seltext,.General),0).item) {
      did -a $dname 241 $replace($hget($+(GHS.,$did($dname,231).seltext,.General),%i).item,_,$chr(32))
      INC  %i 1
    }
    did -c $dname 241 1
    did -e $dname 223
  }
}
; Add Theme
ON *:DIALOG:Mish.GHS:SCLICK:222: {
  did -g $dname 201 $ghsicon(save1.png)
  did -r $dname 231
  IF ($did($dname,221).text != General) {
    ; We check if a name was entered and the table has not been created
    IF (($did(221).text) && (!$isfile($+($ghspath,GHS.,$replace($did(221).text,$chr(32),_),.General,.hsh)))) { 
      did -a $dname 221 $replace($did($dname,221).text,$chr(32),_)
      did -cf $dname 221 $didwm($dname,221,$replace($did($dname,221).text,$chr(32),_),1) 
      didtok $dname 231 44 General,How To,Info,Resources,Rules,Script Resources,Settings,Tutorial,What Is
      did -b $dname 231
      ; Update Themes list in the GHS Tab
      did -r $dname 151
      didtok $dname 151 44 $didtok($dname,221,44)
      ; Don't add General to Themes list
      did -d $dname 151 $didwm($dname,151,General,1)
      did -ra $dname 150 Help Themes: $did($dname,151).lines
      VAR %_set = General,How To,Info,Resources,Rules,Script Resources,Settings,Tutorial,What Is
      hmake $+(GHS.,$replace($did($dname,221).text,$chr(32),_),.Topics) 10
      %i = 1
      WHILE (%i <= $numtok(%_set,44)) {
        hadd $+(GHS.,$replace($did($dname,221).text,$chr(32),_),.Topics) $iif(%i < 9,$+(0,%i),%i) $replace($gettok(%_set,%i,44),$chr(32),_)
        %h_tbl = $+(GHS.,$replace($did($dname,221).text,$chr(32),_),.,$replace($gettok(%_set,%i,44),$chr(32),_))
        %h_file = $+($ghspath,GHS.,$replace($did($dname,221).text,$chr(32),_),.,$replace($gettok(%_set,%i,44),$chr(32),_),.hsh)
        hmake %h_tbl 10
        hadd %h_tbl Empty Empty InfoøNo data
        hsave -o %h_tbl %h_file
        INC %i 1
      }
      hfree $+(GHS.,$replace($did($dname,221).text,$chr(32),_),.Rules)
      hmake $+(GHS.,$replace($did($dname,221).text,$chr(32),_),.Rules)
      hsave -o GHS.Rules $+($ghspath,GHS.,$replace($did($dname,221).text,$chr(32),_),.Rules.hsh)
      hload $+(GHS.,$replace($did($dname,221).text,$chr(32),_),.Rules) $+($ghspath,GHS.,$replace($did($dname,221).text,$chr(32),_),.Rules.hsh)
    }
  }
  did -e $dname 224
  did -b $dname 151,161,171,222,999

}
; Del Theme
ON *:DIALOG:Mish.GHS:SCLICK:223: {
  did -g $dname 201 $ghsicon(save1.png)
  IF ($did(221,$did(221).sel)) {
    dialog -ni Mish.GHS
    IF ($input(You are about to remove a Help Theme! $crlf All files will be permanently removed! $crlf Are you abolutely sure?,ywv,GHS Theme Removal Warning) == $no) { dialog -oe Mish.GHS | halt }
    dialog -oe Mish.GHS
    hfree -w $+(GHS.,$did($dname,221).seltext,.*)
    %_temp = $findfile($ghspath,$+(GHS.,$did($dname,221).seltext,.*),0,.remove $1-)
    IF ($readini($+($ghspath,mishghs.ini),GHSPackage,$+(GHS,$did($dname,221).seltext)) != $null) {
      writeini $+($ghspath,mishghs.ini) GHSPackage $+(GHS,$did($dname,221).seltext) 0
      remini $mishset $+(GHS,$did($dname,221).seltext)
    }
    ; Adding changed theme list to the GHS.General table
    did -d $dname 221 $did(221).sel 
    did -c $dname 221 $did(221,1)
    did -r $dname 231
    did -b $dname 222,223,224
    ; Update Themes list in the GHS Tab
    did -r $dname 151
    didtok $dname 151 44 $didtok($dname,221,44)
    ; Don't add General to Themes list
    did -d $dname 151 $didwm($dname,151,General,1)
    did -ra $dname 150 Help Themes: $did($dname,151).lines
    ; Adding changed theme list to the GHS.General table
    hadd GHS.General Help.Groups $didtok($dname,151,44)
    hsave -o GHS.General $+($ghspath,GHS.General,.hsh)
    did -c $dname 151,221 1
    did -r $dname 161,171,231,241,242
    did -ra $dname 160 Help Topics: $did($dname,161).lines
    did -ra $dname 160 Help Lines: $did($dname,161).lines
  }
  did -g $dname 201 $ghsicon(save0.png)
}
; Create Theme tables
ON *:DIALOG:Mish.GHS:SCLICK:224: {
  did -g $dname 201 $ghsicon(save1.png)
  VAR %_selname = $did($dname,221).seltext
  VAR %_seltbl = $+(GHS.,$did($dname,221).seltext)
  VAR %_selfile = $+(GHS.,$did($dname,221).seltext,.hsh)
  IF (!$hget($+(%_seltbl,.Topics))) { hmake  $+(%_seltbl,.Topics) 10 }
  %i = 1
  WHILE (%i <= $did($dname,231).lines) {
    hadd $+(%_seltbl,.Topics) $iif(%i < 9,$+(0,%i),%i) $did($dname,231,%i)
    VAR %_sel = $+(%_seltbl,.,$replace($did($dname,231,%i),$chr(32),_))
    IF (!$hget(%_sel)) { hmake %_sel 10 }
    hadd %_sel Empty Empty InfoøNo data
    INC %i 1
  }
  ; Adding changed theme list to the GHS.General table
  did -r $dname 151
  didtok $dname 151 44 $didtok($dname,221,44)
  ; Don't add General to Themes list
  did -d $dname 151 $didwm($dname,151,General,1)
  did -ra $dname 221 General
  didtok $dname 221 44 $didtok($dname,151,44)
  ; Update Themes list in the GHS Tab
  hadd GHS.General Help.Groups $didtok($dname,151,44)
  hsave -o GHS.General $+($ghspath,GHS.General,.hsh)
  did -ra $dname 150 Help Themes: $did($dname,151).lines
  did -e $dname 231
  did -b $dname 224
  did -cf $dname 151 $didwm($dname,151,$readini($ghsini,GHSSetup,GHSTheme),1)
  did -ra $dname 160 Help Topics: $did($dname,161).lines
  did -ra $dname 170 Help Lines: $did($dname,171).lines
  did -g $dname 201 $ghsicon(save0.png)
  did -e $dname 151,161,171,999
  did -c $dname 221 $didwm($dname,221,%_selname,1)
}
; Edit Topic
ON *:DIALOG:Mish.GHS:Edit:231: { 
  IF ($did($dname,231).text == $null) { UNSET %_seltheme | did -b $dname 232,233 | did -g $dname 201 $ghsicon(save1.png) }
  ELSEIF (%_seltheme == General) { did -b $dname 232,233 | did -g $dname 201 $ghsicon(save0.png) }
  ELSE { did -e $dname 232 | did -b $dname 233 | did -g $dname 201 $ghsicon(save1.png) }
}

; Select Topic
ON *:DIALOG:Mish.GHS:SCLICK:231: {
  did -g $dname 201 $ghsicon(save0.png)
  IF (%_seltheme == General) {
    did -r $dname 241,242
    did -ra $dname 243 Chg
    IF ($did($dname,231).seltext == Ask Buttons) {
      didtok $dname 241 32 1 2 3 4 5 6
      did -ra $dname 242 $hget(GHS.General,1)
    }
    ELSEIF ($did($dname,231).seltext == Chatting Button) {
      did -ra $dname 241 7
      did -ra $dname 242 $hget(GHS.General,7)
    }
    ELSEIF ($did($dname,231).seltext == Channel Button) {
      did -ra $dname 241 8
      did -ra $dname 242 $hget(GHS.General,8)
    }
    did -c $dname 241,242 1
    did -b $dname 233
    did -e $dname 241,242,243,245
  }
  ELSE {
    did -ra $dname 243 Add
    ; Enable Del button
    did -e $dname 233
    did -e $dname 241,242,243,244,245
    ; Cleaning Item and Data lists 
    did -r $dname 241,242
    %_seltbl = $replace($+(GHS.,$did($dname,221).seltext,.,$did($dname,231).seltext),$chr(32),_)
    ; We load the items for the selected topics
    %i = 1
    WHILE (%i <= $hget(%_seltbl,0).item) {
      did -a $dname 241 $hget(%_seltbl,%i).item
      INC %i 1
    }
    ; Position to first item
    did -cf $dname 241 1
    ; Getting item data
    did -ra $dname 242  $hget(%_seltbl,$did($dname,241).text)
    did -c $dname 242 1
    did -b $dname 243
    did -e $dname 244
  }
}
; Add Topic
ON *:DIALOG:Mish.GHS:SCLICK:232: {
  did -g $dname 201 $ghsicon(save1.png)
  IF ($did(231).text) { 
    %_seltbl = $replace($+(GHS.,$did($dname,221).seltext,.,$did($dname,231).text),$chr(32),_)
    IF (!$hget(%_seltbl)) { hmake -s %_seltbl 10 }
    hadd %_seltbl Empty No data
    hsave -o  %_seltbl $+($ghspath,%_seltbl,.hsh)
    %_num = $calc($hget($+(GHS.,$did($dname,221).seltext,.Topics),0).item + 1) 
    hadd $+(GHS.,$did($dname,221).seltext,.Topics) $iif(%_num < 9, $+(0,%_num),%_num) $did($dname,231).text
    hsave -o $+(GHS.,$did($dname,221).seltext,.Topics) $+($ghspath,GHS.,$did($dname,221).seltext,.Topics,.hsh)
    did -a $dname 231 $replace($did($dname,231).text,$chr(32),_)
    did -c $dname 231 $did(231,1) 
  }
  did -g $dname 201 $ghsicon(save0.png)
}
; Del Topic
ON *:DIALOG:Mish.GHS:SCLICK:233: {
  did -g $dname 201 $ghsicon(save1.png)
  IF ($did(231,$did(231).sel)) { 
    dialog -ni Mish.GHS
    IF ($input(You are about to remove a Help Topic! $crlf All help lines will be permanently removed! $crlf Are you absolutely sure?,ywv,GHS Topic Removal Warning) == $no) { dialog -oe Mish.GHS | halt }
    dialog -oe Mish.GHS
    hdel $+(GHS.,$did($dname,221).seltext,.Topics) $hget($+(GHS.,$did($dname,221).seltext,.Topics),$did($dname,231).seltext).data
    hsave -o $+(GHS.,$did($dname,221).seltext,.Topics) $+($ghspath,GHS.,$did($dname,221).seltext,.Topics,.hsh)
    hfree $replace($+(GHS.,$did($dname,221).seltext,.,$did($dname,231).seltext),$chr(32),_)
    did -d $dname 231 $did(231).sel
    did -c $dname 231 $did(231,1)
    did -b $dname 232,233
    did -r $dname 241,242
  }
  did -g $dname 201 $ghsicon(save0.png)
}
; Item List
ON *:DIALOG:Mish.GHS:EDIT:241: { 
  IF (%_seltheme == General) { did -b $dname 243 } 
  ELSE {
    did -e $dname 243 | did -b $dname 244  | did -g $dname 201 $ghsicon(save1.png)
  }
}
; Select item
ON *:DIALOG:Mish.GHS:SCLICK:241: {
  did -g $dname 201 $ghsicon(save0.png)
  did -e $dname 245
  IF ($did($dname,221).seltext == General) {
    did -ra $dname 243 Chg
    did -ra $dname 242 $hget(GHS.General,$did($dname,241).text)
    did -c $dname 242 1
  }
  ELSE {
    did -ra $dname 243 Add
    did -e $dname 244 
    %_seltbl = $replace($+(GHS.,$did($dname,221).seltext,.,$did($dname,231).seltext),$chr(32),_)
    did -ra $dname 242  $hget(%_seltbl,$did($dname,241).text)
    did -c $dname 242 1
  }
}
; Edit Item
ON *:DIALOG:Mish.GHS:Edit:242: { 
  IF ($did($dname,231).text == $null) { UNSET %_seltheme | did -b $dname 243,244 | did -g $dname 201 $ghsicon(save1.png) }
  ELSE { did -e $dname 243 | did -b $dname 244 | did -g $dname 201 $ghsicon(save1.png) }
}

; Add Item
ON *:DIALOG:Mish.GHS:SCLICK:243: {

  did -g $dname 201 $ghsicon(save1.png)
  IF (%_seltheme == General) {
    IF ($did(241).text) { 
      %_sel = $replace($did($dname,241).text,$chr(32),_)
      did -d $dname 241 $did($dname,241).text
      did -a $dname 241 %_sel
      hadd GHS.General %_sel $remove($replace($didtok($dname,242,13),,&_k,,&_b,,&_u,,&_r,,&_o),$chr(13))
      did -cf $dname 241 $didwm($dname,241,%_sel,1)
    }

  }
  ELSE {
    IF ($did(241).text) {
      %_sel = $replace($did($dname,241).text,$chr(32),_)
      did -d $dname 241 $did($dname,241).text
      did -a $dname 241 %_sel
      hadd $replace($+(GHS.,$did($dname,221).seltext,.,$did($dname,231).seltext),$chr(32),_) %_sel $remove($replace($didtok($dname,242,13),,&_k,,&_b,,&_u,,&_r,,&_o),$chr(13))
      did -cf $dname 241 $didwm($dname,241,%_sel,1)
    }
  }
  did -g $dname 201 $ghsicon(save0.png)
}
; Del Item
ON *:DIALOG:Mish.GHS:SCLICK:244: {
  did -g $dname 201 $ghsicon(save1.png)
  IF ($did(241,$did(241).sel)) { 
    hdel $replace($+(GHS.,$did($dname,221).seltext,.,$did($dname,231).seltext),$chr(32),_) $did($dname,241).seltext
    did -d $dname 241 $did(241).sel
    did -cf $dname 241 $did(241,1)
    did -b $dname 243,244
    did -r $dname 242 
  }
  did -g $dname 201 $ghsicon(save0.png)
}
; Preview selected item data
ON *:DIALOG:Mish.GHS:SCLICK:245: {
  did -g $dname 201 $ghsicon(save0.png)
  IF ($did($dname,242) != $null) {
    echo -s GHS Preview: $remove($replace($didtok($dname,242,13),&_k,,&_b,,&_u,,&_r,,&_o,,&nick,$me),$chr(13))
  }
}
; Set send mode
ON *:DIALOG:Mish.GHS:SCLICK:401: {
  writeini $ghsini GHSSetup GHSNotice $iif($did($dname,401).state == 1,1,0)
}
ON *:DIALOG:Mish.GHS:MENU:501: { SET %ghsrecall mishghs | dialog -x $dname | ghsset }
ON *:DIALOG:Mish.GHS:MENU:502: { SET %ghsrecall mishghs | dialog -x $dname | ghsnickf }

ON *:DIALOG:Mish.GHS:MENU:601: { run $+($ghspath,GHS.chm) }
ON *:DIALOG:Mish.GHS:MENU:603: { run http://www.mishscript.de }
ON *:DIALOG:Mish.GHS:SCLICK:999: {
  did -g $dname 201 $ghsicon(save0.png)
  writeini $ghsini GHSSetup GHSPos $dialog($dname).x $dialog($dname).y
  ; Saving all active tables
  %i = 1
  WHILE (%i <= $findfile($ghspath,GHS.*,0)) {
    %hfile = $nopath($findfile($ghspath,GHS.*,%i))
    %htab = $remove(%hfile,.hsh)
    IF ($hget(%htab)) { hsave -o %htab $+($ghspath,%hfile) }
    INC %i 1
  }
  UNSET %h_chan %h_nick %i %_Topic %htab %hfile %_sel %_seltbl %_selitem %_line %output %h_tbl %h_file
}
; Coverter aliases
alias t2g { RETURN $replace($1-,&_k,,&_b,,&_r,,&_o,,&_u,,&chan,%h_chan,&me,$me,&nick,%h_nick) }
alias g2t { RETURN $replace($1-,,&_k,,&_b,,&_r,,&_o,,&_u) }
#ghslogo off
alias f5 { SET %h_chan $active | SET %h_nick $snick(#,1) | mishghs }
alias sf5 { run $+($ghspath,GHS.chm) }
CTCP 1:*:*: {
  IF ($1 == VERSION) {
    .quote NOTICE $nick : $+ $chr(1) $+ VERSION-SCRIPT 13 $+ %ghslogo - 3Copyright ©1999-2005 by 3Merlin7 - http://www.mishscript.de $+ $chr(1) | .ignore -tu15 $nick 2
  }
}
#ghslogo end
;===========================================
; Project : MISHScript 4.10
; Script  : GHS Help System Sound Setup
;===========================================
alias ghsset { dialog -mdo GHS.HelpSounds GHS.HelpSounds }
dialog GHS.HelpSounds {
  title "GHS Helper Sound Setup"
  size -1 -1 121 105
  option dbu
  icon $ghsicon(mishlogo.ico), 0
  box "Help Sound:", 50, 1 3 118 41
  check "Play a Sound File on Help Trigger", 51, 6 11 90 10
  button "Browse", 53, 7 31 27 10
  button "Reset", 54, 69 31 27 10
  icon 57, 99 27 17 14,  $ghsicon(Play_OFF.png) , 0
  box "Nick Sound:", 100, 1 47 119 41
  check "Play a Sound File on own Nick", 101, 6 55 90 10
  button "Browse", 103, 6 75 27 10
  button "Reset", 104, 69 75 27 10
  icon 107, 99 71 17 14,  $ghsicon(Play_OFF.png) , 0
  button "Save", 300, 2 90 36 13
  button "Cancel", 301, 83 90 36 13, cancel
  edit "", 52, 6 20 90 10
  edit "", 102, 6 64 90 10
}
ON *:DIALOG:GHS.HelpSounds:*:*:{
  IF ($devent == init) {
    IF (($script(mishinit.mrc)) && ($readini($mishset,MISHScript,DialogTips) == 1)) {
      VAR %ttl = $ttdll(Mark,$dialog($dname).hwnd)
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 51)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 51 $_lcget(%MishLang,DTT13001))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 52)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 52 $_lcget(%MishLang,DTT13002))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 53)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 53 $_lcget(%MishLang,DTT13003))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 54)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 54 $_lcget(%MishLang,DTT13004))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 101)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 101 $_lcget(%MishLang,DTT13005))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 102)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 102 $_lcget(%MishLang,DTT13006))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 103)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 103 $_lcget(%MishLang,DTT13007))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 104)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 104 $_lcget(%MishLang,DTT13008))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 300)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 300 $_lcget(%MishLang,DTT13009))
      VAR %ttl = $ttdll(ToolTip,$dialog($dname).hwnd > 301)
      VAR %ttl = $ttdll(SetText,$dialog($dname).hwnd > 301 $_lcget(%MishLang,DTT13010))
    }
    SET %Mish.HSound 0 , %Mish.NSound 0
    did -u GHS.HelpSounds 51,101
    did -r GHS.HelpSounds 52,102
    SET %Mish.HSound $readini($ghsini,GHSSetup,HSound)
    IF (%Mish.HSound == 1) { did -c GHS.HelpSounds 51 }
    SET %Mish.HSFile $readini($ghsini,GHSSetup,HSoundF)
    IF (%Mish.HSFile) { did -a GHS.HelpSounds 52 $lower($nopath(%Mish.HSFile)) }
    ELSE { did -ra GHS.HelpSounds 52 None | did -ub $dname  51 }
    ;
    SET %Mish.NSound $readini($ghsini,GHSSetup,NSound)
    IF (%Mish.NSound == 1) { did -c GHS.HelpSounds 101  | SET %Mish.NSound 0 }
    SET %Mish.NSFile $readini($ghsini,GHSSetup,NSoundF)
    IF (%Mish.NSFile) { did -a GHS.HelpSounds 102 $lower($nopath(%Mish.NSFile)) }
    ELSE { did -ra GHS.HelpSounds 102 None  | did -ub $dname 101 }
  }
  ELSEIF ($devent == sclick) {
    IF ($did == 53) { .timer -m 1 0 Mish.Help.Sound }
    ELSEIF ($did == 54) { did -bu GHS.HelpSounds 51 | did -ra GHS.HelpSounds 52 None | UNSET %Mish.HSound %Mish.HSFile }
    ELSEIF (($did == 57) &&  (%Mish.HSFile != $null) && ($isfile($shortfn(%Mish.HSFile)))) {
      did -g GHS.HelpSounds 57 $ghsicon(Play_ON.png)
      splay $shortfn(%Mish.HSFile)
      writeini $ghsini GHSSetup HSound $shortfn(%Mish.HSFile)
      did -g GHS.HelpSounds 57 $ghsicon(Play_OFF.png)
    }
    ELSEIF ($did == 103) { .timer -m 1 0 Mish.Nick.Sound }
    ELSEIF ($did == 104) { did -bu GHS.HelpSounds 101 | did -ra GHS.HelpSounds 102 None | UNSET %Mish.NSound %Mish.NSFile }
    ELSEIF (($did == 107) &&  (%Mish.NSFile != $null) && ($isfile($shortfn(%Mish.NSFile)))) {
      did -g GHS.HelpSounds 107 $ghsicon(Play_ON.png))
      splay $shortfn(%Mish.NSFile)
      writeini $ghsini GHSSetup NSound $shortfn(%Mish.NSFile)
      did -g GHS.HelpSounds 107 $ghsicon(Play_OFF.png)
    }
    ELSEIF ($did == 300) {
      IF ($did(GHS.HelpSounds,51).state == 1) { 
        writeini $ghsini GHSSetup HSound 1 | SET %Mish.HSound 1 
        echo $colour(info text) -ta *** GHS Helper Trigger for word $+(',14,Help,,') is $+(3,Enabled,!) - $iif(%Mish.HSFile != $null,Using sound: $+(3,$lower($nopath(%Mish.HSFile)),!))
      }
      ELSE { 
        writeini $ghsini GHSSetup HSound 0 | SET %Mish.HSound 0 
        echo $colour(info text) -ta *** GHS Helper Trigger for word $+(',3,Help,,') is $+(4,Disabled,!) 
      }
      IF (%Mish.HSFile) { writeini $ghsini GHSSetup HSoundF $shortfn(%Mish.HSFile) }
      ELSE { remini $ghsini GHSSetup HSoundF | UNSET %Mish.HSFile }

      IF ($did(GHS.HelpSounds,101).state == 1) { 
        writeini $ghsini GHSSetup NSound 1 | SET %Mish.NSound 1 
        echo $colour(info text) -ta *** GHS Helper Trigger for own nick $+(',14,$me,,') is $+(3,Enabled,!) - $iif(%Mish.HSFile != $null,Using sound: $+(3,$lower($nopath(%Mish.NSFile)),!))
      }
      ELSE { writeini $ghsini GHSSetup NSound 0 | SET %Mish.NSound 0 
        echo $colour(info text) -ta *** GHS Helper Trigger for own nick $+(',14,$me,,') is $+(3,Enabled,!) is $+(4,Disabled,!) 
      }
      IF (%Mish.NSFile) { writeini $ghsini GHSSetup NSoundF $shortfn(%Mish.NSFile) }
      ELSE { remini $ghsini GHSSetup NSoundF | UNSET %Mish.NSFile }

      dialog -x $dname 
      IF (%ghsrecall) { %ghsrecall | UNSET %ghsrecall }
    }
    ELSEIF ($did == 301) { 
      dialog -x $dname 
      IF (%ghsrecall) { %ghsrecall | UNSET %ghsrecall }
    }
  }
}
alias Mish.Help.Sound {
  dialog -ni GHS.HelpSounds
  SET %Mish.Temp $file="Which sound file would you like to associate with the word 'Help' $+ ?" [ $ghssound ]
  IF (%Mish.Temp) {
    did -r GHS.HelpSounds 52
    SET %Mish.HSFile %Mish.Temp
    did -a GHS.HelpSounds 52 $nopath(%Mish.HSFile)
    did -e GHS.HelpSounds 51
    UNSET %Mish.Temp
  }
  dialog -oe GHS.HelpSounds
}
alias Mish.Nick.Sound {
  dialog -ni GHS.HelpSounds
  SET %Mish.Temp $file="Which sound file would you like to associate with your Nick?" [ $ghssound ]

  IF (%Mish.Temp) {
    did -r GHS.HelpSounds 102
    SET %Mish.NSFile %Mish.Temp
    did -a GHS.HelpSounds 102 $nopath(%Mish.NSFile)
    did -e GHS.HelpSounds 101
    UNSET %Mish.Temp
  }
  dialog -oe GHS.HelpSounds
}
#helper off
ON *:TEXT:*help*:#:{
  echo $colour(info text) -ts 10Help request [14In4 $chan 14from4 $nick $+ 10] stating: '7 $+ $strip($1-) $+ 10'
  IF (($inmp3) || ($inwave) || ($inmidi)) { HALT }
  ELSE {
    IF (%Mish.HSound == 1) {
      IF (%Mish.HSFile == $null) { echo $colour(info text) -ta *** 4GHS Warning: Helper Sound Setup has not been done yet - Using default Sounds! | splay -w $+($shortfn($wavedir),sonar.wav) }
      ELSE { splay  $shortfn(%Mish.HSFile) }
    }
  }
}
ON *:TEXT:*:#:{
  IF ($me isin $strip($1-)) {
    echo $colour(info text) -ts  10Nick request [14In4 $chan 14from4 $nick $+ 10] stating: '7 $+ $strip($1-) $+ 10'
    IF (($insong) || ($inwave) || ($inmidi)) { HALT }
    ELSE {
      IF (%Mish.NSound == 1) {
        IF (%Mish.NSFile == $null) { echo $colour(info text) -ta *** 4GHS Warning: Helper Sound Setup has not been done yet - Using default Sounds! | splay -w $+($shortfn($wavedir),roadrun.wav) }
        ELSE { splay -p $shortfn(%Mish.NSFile) }
      }
    }
  }
}
#helper end
alias mhelper {
  IF ($_opt.rval(n1,6) == 0) { goto helperon }
  ELSE { 
    $_opt.set(n1,6,0) | .disable #helper 
    writeini $ghsini GHSSetup GHSSound 1 
    echo $colour(info text) -ta *** Helper Trigger is $+(4,Disabled,!) | halt 
  }
  :helperon { 
    $_opt.set(n1,6,1) | .enable #helper 
    writeini $ghsini GHSSetup GHSSound 0
    echo $colour(info text) -ta *** Helper Trigger is $+(3,Enabled,!)  
  }
}
alias ghsnickf { dialog -mda GHS.NickFormat GHS.NickFormat }
dialog GHS.NickFormat {
  title "GHS - Nick Format"
  size -1 -1 89 57
  option dbu
  icon $ghsicon(mishlogo.ico), 0
  box "Nick Format", 1, 1 2 87 54
  text "Prefix", 2, 4 12 18 8
  edit "", 3, 22 10 53 10
  button "?", 4, 76 10 9 10
  text "Postfix", 5, 4 26 18 8
  edit "", 6, 22 25 53 10
  button "?", 7, 76 25 9 10
  edit "", 10, 3 7 83 31, hide multi read 
  button "Back", 11, 26 40 37 12, hide
  button "Save", 100, 4 40 37 12, ok
  button "Exit", 101, 48 40 37 12, cancel
}
ON *:DIALOG:GHS.NickFormat:INIT:*: {
  did -ra $dname 10 $+(Format Syntax:, $crlf,Bold: &_b - Underline: &_u,$crlf,Reverse: &_r - Default: &_o,$crlf,Colors: &_k##,$chr(44),##)
  did -ra $dname 3 $readini($ghsini,GHSSetup,Prefix)
  did -ra $dname 6 $readini($ghsini,GHSSetup,Postfix)

}
ON *:DIALOG:GHS.NickFormat:SCLICK:4,7: {
  did -h $dname 1,2,3,4,5,6,7,100,101
  did -v $dname 10,11
}

ON *:DIALOG:GHS.NickFormat:SCLICK:11: {
  did -h $dname 10,11
  did -v $dname 1,2,3,4,5,6,7,100,101

}
ON *:DIALOG:GHS.NickFormat:SCLICK:100: {
  IF ($did($dname,3).text != $null) {  writeini $ghsini GHSSetup Prefix $did($dname,3) }
  ELSE {  writeini $ghsini GHSSetup Prefix &_o }
  IF ($did($dname,6).text != $null) {  
    writeini $ghsini GHSSetup Postfix $iif(($right($did($dname,6).text,3) == &_o),$did($dname,6),$+($did($dname,6),&_o))
  }
  ELSE { writeini $ghsini GHSSetup Postfix &_o }
  %ghsrecall
}

ON *:DIALOG:GHS.NickFormat:SCLICK:101: { %ghsrecall }
}