alias quest dialog -m aq aq
alias g.chan dialog -m cc cc
alias mode.auto {
  %scra.mode = auto 
  %ischan = $chan
  %ischan2 =     : %ischan
  dialog -md VIP vip
  did -ra VIP 1 %ischan2
}
alias autos.dialog {
  %sdgame = on
  %ischan = $chan
  %ischan2 = PlaY On ChanneL : %ischan
  dialog -md Game Game
  did -ra Game 1 %ischan2
}
alias setup {
  if (($sline(@Game,1).ln == $null) || ($sline(@Game,1).ln == 0)) { halt }
  set %line $sline(@Game,1).ln
  if (%line == 4) {
    set %ischan #$$?="Enter Channel to Play"
    rline @Game 4 2,8Plays on Channel : %ischan
    unset %gscore.*
    halt
  }
  if (%line == 6) { 
    set %forword $$?="Enter Scramble Word!" 
    rline @Game 6 12Word: %forword
  }
  if (%line == 7) { 
    set %forhint $$?="Enter Scramble Hint" 
    rline @Game 7 2,8Hint: %forhint 
  }
  if (%line == 10) { 
    set %delscore2 $$?!="Are You sure?"  
    if (%delscore2 == $true) unset %gscore.* 
    if (%delscore2 == $false) halt
  }
  if (%line == 13) { 
    set %sstop2 $$?!="Are You sure?"  
    if (%sstop2 == $true) { msg %ischan 2          %Edison1 | set %sgame2 OFF | unset %sstop2 | set %sgame2 OFF }
    if (%sstop2 == $false) { unset %sstop2 | halt }
  }
  if (%line == 11) { 
    set %tell2 $$?!="Are You sure?"  
    if (%tell2 == $true) { /msg %ischan 2The correct answer is %forword %Edison1 | unset %tell2  | unset %forword | unset %forhint }
    if (%tell2 == $false) { unset %tell2 | halt }
  }
  if (%line == 12) { 
    if (( %forword == $null ) || ( %forhint == $null )) halt |  enter 
  }
}
alias scramble {
  set %ischan #
  scramble.start                 
}
alias massdid {
  set -u0 %.tdid.min $calc( $gettok($3,1,45) - 1 )
  set -u0 %.tdid.max $gettok($3,2,45)
  :loop | inc %.tdid.min
  did $1 $2 %.tdid.min
  if (%.tdid.min == %.tdid.max) { return } | else { goto loop }
}
alias scramble.start {
  set %forword $$?="Enter scramble word!"
  set %forhint $$?="Enter scramble hint!"
  enter
}
alias scramble.rscore {
  set %delscore2 $$?!="Are You sure?"  
  if (%delscore2 == $true) { unset %gscore.* | unset %delscore2 }
  if (%delscore2 == $false) { unset %delscore2 | halt }
}
alias scramble.tellans {
  set %tell2 $$?!="Are You sure?"  
  if (%tell2 == $true) { /msg %ischan 2The correct answer is %forword %Edison1 | unset %tell2 | unset %forword | unset %forhint }
  if (%tell2 == $false) { unset %tell2 | halt }
}
alias scramble.stop {
  /msg %ischan 2          %Edison1
  /unset %sstop2
  /unset %forword
  /unset %forhint
  /unset %sranword
  /unset %dnr.*
  /unset %nu.t 
  /unset %a4.*
  /.timer1 off
  /.timer2 off
  /.timer4 off
  /.timer5 off
  set %start = ON
}
alias scramble.stop2 {
  /msg %ischan 2          %Edison1
  /unset %sstop2
  /unset %sgame2
  /unset %sdgame
  /unset %forword
  /unset %forhint
  /unset %sranword
  /unset %dnr.*
  /unset %nu.t
  /unset %scra.mode 
  /unset %sdgame
  /unset %sgame2
  /unset %a4.*  
  /.timer1 off
  /.timer2 off
  /.timer3 off
  /.timer4 off
  /.timer5 off
}
alias enter {
  /.timer4 off
  set %forword $lower( %forword )
  set %sranword $scram( %forword )
  set %hintword $hint( %forword )
  set %fhint ON
  unset %vhint
  unset %next 
  /msg %ischan 14[2   14] %Edison1
  /msg %ischan 14[2  14]: %forhint
  /msg %ischan 14[2  14]: %sranword  
  /.timer5 1 150 /enter1
  /.timer2 1 40 /msg %ischan 2            :)))))) %Edison1
}
alias enter1 {
  set %forword $lower( %forword )
  set %sranword $scram( %forword )
  set %hintword $hint( %forword )
  set %fhint ON
  unset %vhint
  unset %next 
  /msg %ischan 14[2   14] %Edison1
  /msg %ischan 14[2  14]: %forhint
  /msg %ischan 14[2  14]: %sranword  
  /.timer1 1 70 /timesup
}
alias timesup { /msg %ischan 2 :))              14(2 %forword 14)
  /.timer5 off
  /.timer1 off
  /.timer2 off
  unset %forword  
  unset %forhint
  inc %gh
  %gg = $lines(dnr.txt)
  if ( %gh > %gg ) { 
    /unset %start 
    %gh = $rand(1,%gg)
    if  ( $lines(dnr.txt) = 2 ) {  halt }
    set %nu.t $read -l $+ %gh dnr.txt
    set %forword $gettok(%nu.t,2,42)
    set %forhint $gettok(%nu.t,1,42)
    /.timer4 1 5 /enter
  }
  set %nu.t $read -l $+ %gh dnr.txt
  set %forword $gettok(%nu.t,2,42)
  set %forhint $gettok(%nu.t,1,42)
  /.timer5 1 5 /enter
}
alias scramble.window  {
  set %ischan #
  set %sgame2 ON
  set %gstop ON
  window -lao @Game 170 30 263 330 ms san sherif
  titlebar @Game Scramble Game %sgame2
  clear @Game
  rline @Game 1 2 double click on text to set!! %Edison
  rline @Game 2  14,15<0,15>14,15<0,15>14,15<0,15>14,15<0,15>14,15<0,15>14,15<0,15>5,10 Auto Scramble AL7OOT^ 0,15<14,15>0,15<14,15>0,15<14,15>0,15<14,15>0,15<14,15>0,15<14,15> 
  rline @Game 3 1 double click on text to set!!
  rline @Game 4 7 Pls  hn : %ischan
  rline @Game 5  
  rline @Game 6 11,10 W 14:3 %forword
  rline @Game 7 11,10 |-|t 14:3 %forhint
  rline @Game 8  
  rline @Game 9   
  rline @Game 10 10RESET SCORE
  rline @Game 11 7TELL ANSWER
  rline @Game 12 15ENTER
  rline @Game 13  13STOP GAME
  rline @Game 14  
  rline @Game 15  
  rline @Game 16  
  rline @Game 17  14,15<0,15>14,15<0,15>14,15<0,15>14,15<0,15>14,15<0,15>14,15<0,15>5,10 Auto Scramble AL7OOT^ 0,15<14,15>0,15<14,15>0,15<14,15>0,15<14,15>0,15<14,15>0,15<14,15> 
  rline @Game 18  
  rline @Game 19 15Click on Enter to Start1____15double click to set!      
}
alias scram {
  unset %a4.* 
  %a4.w = 1 
  :1
  inc %a4.i 
  if (%a4.i > $len($gettok($1-,%a4.w,32))) goto 2 
  %a4.ls = %a4.ls $mid($gettok($1-,%a4.w,32),%a4.i,1) 
  goto 1 
  :2 
  %a4.l = $r(1,$gettok(%a4.ls,0,32)) 
  if (%a4.i) { 
    %a4.wrd = %a4.wrd $gettok(%a4.ls,%a4.l,32) 
    unset %a4.i 
  } 
  else %a4.wrd = %a4.wrd $+ $gettok(%a4.ls,%a4.l,32) 
  if ($len($gettok(%a4.wrd,%a4.w,32)) == $len($gettok($1-,%a4.w,32))) { 
    if ($len(%a4.wrd) == $len($1-)) return %a4.wrd 
    inc %a4.w | %a4.ls = "" 
    goto 1
  } 
  %a4.ls = $deltok(%a4.ls,%a4.l,32) 
  goto 2
}
alias hint {
  unset %ad.* 
  %ad.w = 1 
  :1
  inc %ad.i 
  inc %ad.o 1
  inc %ad.p 2
  inc %ad.q 3
  if (%ad.i > $len($gettok($1-,%ad.w,32))) goto 2 
  %ad.ls = %ad.ls $mid($gettok($1-,%ad.w,32),%ad.i,1) 
  %ad.li = %ad.ls $mid($gettok($1-,%ad.w,32),%ad.o,1) 
  %ad.lu = %ad.ls $mid($gettok($1-,%ad.w,32),%ad.p,1) 
  %ad.lj = %ad.ls $mid($gettok($1-,%ad.w,32),%ad.q,1) 
  goto 1
  :2 
  %ad.l = $r(1,$gettok(%ad.ls,0,32)) 
  %ad.r = 7 
  %ad.s = 1 
  %ad.t = 2 
  if (%ad.i) { 
    %ad.wrd = %ad.wrd $replace($1-,$gettok(%ad.ls,%ad.l,32),?,$gettok(%ad.li,%ad.r,32),?,$gettok(%ad.lu,%ad.s,32),?,$gettok(%ad.lj,%ad.t,32),?) 
    unset %ad.i 
    unset %ad.o 
    unset %ad.p 
    unset %ad.q    
  }
  else %ad.wrd = %ad.wrd $replace($1-,$gettok(%ad.ls,%ad.l,32),?,$gettok(%ad.li,%ad.r,32),?,$gettok(%ad.lu,%ad.s,32),?,$gettok(%ad.lj,%ad.t,32),?) 
  if ($len($gettok(%ad.wrd,%ad.w,32)) == $len($gettok($1-,%ad.w,32))) { 
    if ($len(%ad.wrd) == $len($1-)) return %ad.wrd 
    inc %ad.w | %ad.ls = "" 
    goto 1
  } 
  %ad.ls = $deltok(%ad.ls,%ad.l,32) 
  goto 2
}

;---------------------------------------------------= REMOTEs SECTION =-----------------------------------------------------------------------------------------
#uncontinue off
on 1:text:%forword:%ischan: {
  if ( %vhint == ON ) { inc %gscore. [ $+ [ $nick ] ] 2
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) <= 4 ) { inc %gscore. [ $+ [ $nick ] ] 2  
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) = 5 ) { inc %gscore. [ $+ [ $nick ] ] 3
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) = 6 ) { inc %gscore. [ $+ [ $nick ] ] 4  
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) >= 7 ) { inc { %gscore. [ $+ [ $nick ] ]  $len(%forword) }
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  :good
  /.timer5 off
  /.timer1 off
  /.timer2 off
  set %next = ON
  /unset %vhint
  /unset %fhint 

}
on 1:text: :%ischan: {
  if ( ( %next == $null ) ) { /msg %ischan  $nick ,         7=) }
  else {
    if ( %sgame2 == ON ) {
      rline @Game 6 W 14:3 %forword
      rline @Game 7 7|-|1280t 14:3 %forhint 
    } 
    if ( %sdgame == ON ) {
      did -ra Game 3 
      did -ra Game 5 
    }
    if ( %scra.mode = auto ) {
      inc %gh
      %gg = $lines(dnr.txt)
      if ( %gh > %gg ) { 
        /unset %start 
        %gh = $rand(1,%gg)
        if  ( $lines(dnr.txt) = 2 ) {  halt }
        set %nu.t $read -l $+ %gh dnr.txt
        set %forword $gettok(%nu.t,2,42)
        set %forhint $gettok(%nu.t,1,42)
        enter
      }
      set %nu.t $read -l $+ %gh dnr.txt
      set %forword $gettok(%nu.t,2,42)
      set %forhint $gettok(%nu.t,1,42)
      /.timer5 1 5 /enter
    }
  }
}  
#uncontinue end

#continue on
on 1:text:%forword:%ischan: {
  if ( %vhint == ON ) { inc %gscore. [ $+ [ $nick ] ] 2
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) <= 4 ) { inc %gscore. [ $+ [ $nick ] ] 2
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) = 5 ) { inc %gscore. [ $+ [ $nick ] ] 3
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) = 6 ) { inc %gscore. [ $+ [ $nick ] ] 4  
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  if ( $len(%forword) >= 7 ) { inc { %gscore. [ $+ [ $nick ] ] $len(%forword) }
    /msg %ischan 2 $nick   %forword $+ ....       !!!!!  | unset %forword

  goto good }
  :good
  /.timer5 off
  /.timer1 off
  /.timer2 off
  set %next = ON
  /unset %vhint
  /unset %fhint 
  /.timer3 1 2 /next
} 
alias next { 
  if ( %sgame2 == ON ) {
    rline @Game 6 W 14:3 %forword
    rline @Game 7 7|-|1280t 14:3 %forhint 
  } 
  if ( %sdgame == ON ) {
    did -ra Game 3 
    did -ra Game 5 
  }
  if ( %scra.mode = auto ) {
    inc %gh
    %gg = $lines(dnr.txt)
    if ( %gh > %gg ) { 
      /unset %start 
      %gh = $rand(1,%gg)
      if  ( $lines(dnr.txt) = 2 ) {  halt }
      set %nu.t $read -l $+ %gh dnr.txt
      set %forword $gettok(%nu.t,2,42)
      set %forhint $gettok(%nu.t,1,42)
      enter
    }
    set %nu.t $read -l $+ %gh dnr.txt
    set %forword $gettok(%nu.t,2,42)
    set %forhint $gettok(%nu.t,1,42)
    /.timer5 1 3 /enter
    /.timer3 off
  }
}  
#continue end

on 1:text::%ischan: {
  /msg %ischan 2      %forword  %Edison1  
  unset %forword  
  unset %forhint
  inc %gh 
  if %gh > $lines(dnr.txt) { scramble.stop2 | halt }
  set %nu.t $read -l $+ %gh dnr.txt
  set %forword $gettok(%nu.t,2,42)
  set %forhint $gettok(%nu.t,1,42)
  enter
}    

on 1:TEXT:**:%ischan: { if ( %forword == $null ) { /notice $nick Scramble Game don't start yet }
else { /.timer6 1 5 /enter2  } }
alias enter2 { /msg %ischan 14[2 14] %Edison1
  /msg %ischan 14[2  14]: %forhint
  /msg %ischan 14[2  14]: %sranword  
}





;---------------------------------------------------= MENU POPUPS SECTION =-----------------------------------------------------------------------------------------

menu @Game {
  dclick /setup
}


;---------------------------------------------------= DIALOGS SECTION =-----------------------------------------------------------------------------------------

dialog ad4ms {
  title "Made By Edison"
  size -1 -1 230 110
  text "      ",1,35 10 180 20
  text "saleh1990@hotmail.com",2,15 40 150 20
  text "HomePage: http://www.geocities.com/Edison_Kw1",3,15 60 250 40
  button "Ok",100,90 85 50 20,ok
}
dialog cc {
  title "   " 
  size -1 -1 200 120
  box "  ",1 ,10 10 180 60
  edit "#",2 ,45 35 100 20 
  button "OK",3 ,30 85 50 20,ok
  button "CanceL",4 ,120 85 50 20,cancel
}
on 1:dialog:cc:sclick:3:{
  set %ch $did(2)
  set %chp $chr(35)
  if (  %chp isin %ch ) { 
    if ( %ch !== %ccp ) { 
      if ( $me !ison %ch ) { echo -a You r Not In %ch | halt }
      set %ischan %ch
      %ischan2 =     : %ischan
      did -ra vip 1 %ischan2
      unset %chp
      unset %ch
    }
    else { halt }
  }
  else { halt }
}
dialog vip {
  title "  "
  box "   ",20,6 6 325 200
  text "     : ",1,30 23 300 30
  size -1 -1 340 230
  button "",6,26 50 50 18
  button " ",7,86 50 64 18
  button " ",8,162 50 70 18
  button " ",9,242 50 70 18
  button "    ",10,94 80 150 17
  text "Auto Game Mode :",4,30 112 120 17
  button " ",13,124 110 64 18
  button "",14,210 110 64 18
  button "   ",15,94 145 150 18
  button "",11,30 170 40 18,ok
  button "",12,270 170 40 18
}
on 1:dialog:vip:sclick:*:{
  if $did = 6 {
    /unset %start 
    %gg = $lines(dnr.txt)
    %nu =  $rand(1,%gg)
    if %nu > $lines(dnr.txt) { %nu = $rand(1,%gg) }
    if  ( $lines(dnr.txt) = 2 ) {  halt }
    set %nu.t $read -l $+ %nu dnr.txt
    set %forword $gettok(%nu.t,2,42)
    set %forhint $gettok(%nu.t,1,42)
    enter
  }
  if ($did == 7) { 
    set %start = ON
    /scramble.stop
  }
  if ($did == 8) { 
    /msg %ischan 2 :))       14(2 %forword 14) %Edison1
    unset %forword  
    unset %forhint
    if %nu > $lines(dnr.txt) { %nu = $rand(1,%gg) }
    set %nu.t $read -l $+ %nu dnr.txt
    set %forword $gettok(%nu.t,2,42)
    set %forhint $gettok(%nu.t,1,42)
    enter
  }
  if ($did == 9) { 
    unset %gscore.* 
    msg %ischan 2    %Edison1
  } 
  if ($did == 10) { 
    unset %ischan
    :echan
    g.chan
    did -ra VIP 1 %ischan2
    set %start = ON
    /unset %sstop2
    /unset %forword
    /unset %forhint
    /unset %ischan
    /unset %sranword
    /unset %gscore.*
    /unset %chan2
    /unset %dnr.*
    /unset %nu.t
    /unset %a4.*
    /unset gg
    /unset gh
  } 
  if ( $did = 11 ) {
    if %sdgame = on || %sgame2 = on { 
      scramble.stop
    }
    set %start = ON
    /unset %sstop2
    /unset %forword
    /unset %forhint
    /unset %ischan
    /unset %sranword
    /unset %gscore.*
    /unset %chan2
    /unset %dnr.*
    /unset %nu.t
    /unset %scra.mode 
    /unset %sgame2
    /unset %sgame2
    /unset %a4.*
    /unset gg
    /unset gh
  }
  if ( $did = 12 ) {
    quest
  }
  if ( $did == 13 ) { .enable #uncontinue | .disable #continue | echo 6 -a     4  }
  if ( $did == 14 ) { .enable #continue | .disable #uncontinue | echo 6 -a    }
  if ( $did == 15 ) { 
    if ( %forword == $null ) { echo 6 -a You don't Start the Scramble yet ! }
    else { /enter }
  }
}
dialog aq {
  title "  Edison Script"
  size -1 -1 324 300
  box "",30, 175 3 135 30
  text " You Have ___ Question",1, 180 15 120 15
  text "",2, 20 45 50 20
  text "",3, 50 45 50 20
  text "",4, 220 45 50 20
  text "   :",5, 25 150 60 20
  text "  :",6, 25  180 60 20

  edit "",11, 20 70 20 20
  edit "",12, 50 70 150 20,autohs
  edit "",13, 220 70 80 20,autohs
  edit "",14, 85 145 150 20,autohs
  edit "",15, 85 175 150 20,autohs

  button "",16, 27 103 30 15
  button "",17, 75 100 35 20
  button "",18, 130 100 60 20
  button "",19, 210 100 35 20
  button "",20, 265 103 30 15
  button "OK",21, 40 220 50 20
  button "Cancel",22, 235 220 50 20

  button "",23,145 265 50 20,ok
}
on *:dialog:aq:init:*:{
  massdid -m aq 11-15
  massdid -b aq 21-22
  if $lines(dnr.txt) = 0 { return } 
  else {
    set %dnr.a $read -l1 dnr.txt
    did -ra aq 11 1
    did -ra aq 12 $gettok(%dnr.a,1,42)
    did -ra aq 13 $gettok(%dnr.a,2,42)
    set %dnr.x You Have $lines(dnr.txt) Question
    did -ra aq 1 %dnr.x
  }
}
on 1:dialog:aq:sclick:*:{
  if ($did = 16) {
    if ($did(11) = 1) || ($did(11) = $null) { return }
    else {
      set %dnr.b $did(11)
      %dnr.c = %dnr.b - 1
      set %dnr.d $read -l $+ %dnr.c dnr.txt
      did -ra aq 11 %dnr.c
      did -ra aq 12 $gettok(%dnr.d,1,42)
      did -ra aq 13 $gettok(%dnr.d,2,42)
    }
  }
  if ($did = 20) {
    set %total.dnr $lines(dnr.txt)
    if ($did(11) = %total.dnr) || ($lines(dnr.txt) = 0 ) { halt }
    else {
      set %dnr.b $did(11)
      %dnr.c = %dnr.b + 1
      set %dnr.d $read -l $+ %dnr.c dnr.txt
      did -ra aq 11 %dnr.c
      did -ra aq 12 $gettok(%dnr.d,1,42)
      did -ra aq 13 $gettok(%dnr.d,2,42)
    }
  }
  if ($did = 17) {
    massdid -b aq 16-20
    massdid -n aq 14-15
    massdid -e aq 21-22
    set %dnr.y add
  }
  if ($did = 18) {
    massdid -b aq 16-20
    massdid -n aq 14-15
    massdid -e aq 21-22
    set %dnr.c $did(11)
    set %dnr.d $read -l $+ %dnr.c dnr.txt
    did -ra aq 14 $gettok(%dnr.d,1,42)
    did -ra aq 15 $gettok(%dnr.d,2,42)
    set %dnr.y change
  }
  if ($did = 19) {
    if $lines(dnr.txt) = 0 { 
      halt
    }
    set %dnr.b $did(11)
    write -dl $+ %dnr.b dnr.txt
    set %dnr.e $lines(dnr.txt)
    if %dnr.e = 0 { 
      massdid -r aq 11-13
      set %dnr.x You Have $lines(dnr.txt) Question
      did -ra aq 1 %dnr.x
      halt
    }
    %dnr.r =  $did(11) +1
    %dnr.f = $did(11)
    %dnr.t = $did(11) - 1
    set %dnr.s $read -l $+ %dnr.t dnr.txt
    set %dnr.o $read -l $+ %dnr.f dnr.txt
    set %dnr.n $read -l $+ %dnr.r dnr.txt
    if ( %dnr.n = $null ) && ( %dnr.o = $null ) { 
      did -ra aq 11 %dnr.t
      did -ra aq 12 $gettok(%dnr.s,1,42)
      did -ra aq 13 $gettok(%dnr.s,2,42)
      set %dnr.x You Have $lines(dnr.txt) Question
      did -ra aq 1 %dnr.x
      halt
    }
    set %dnr.d $read -l $+ %dnr.b dnr.txt
    did -ra aq 12 $gettok(%dnr.d,1,42)
    did -ra aq 13 $gettok(%dnr.d,2,42)
    set %dnr.x You Have $lines(dnr.txt) Question
    did -ra aq 1 %dnr.x
  }
  if ($did = 21) {
    if ( $did(14) = $null ) || ( $did(15) = $null ) { halt }
    else {
      massdid -b aq 21-22
      massdid -m aq 14-15 
      massdid -e aq 16-20
      set %dnr.z $did(14) $+ * $+ $did(15)
      if %dnr.y = add {
        write dnr.txt %dnr.z 
        set %dnr.total $lines(dnr.txt)
        set %dnr.d $read -l $+ %dnr.total dnr.txt
        did -ra aq 11 %dnr.total
        did -ra aq 12 $gettok(%dnr.d,1,42)
        did -ra aq 13 $gettok(%dnr.d,2,42)
      }
      if %dnr.y = change {
        write -l $+ $did(11) dnr.txt %dnr.z
        set %dnr.total $did(11)
        set %dnr.d $read -l $+ %dnr.total dnr.txt
        did -ra aq 11 %dnr.total
        did -ra aq 12 $gettok(%dnr.d,1,42)
        did -ra aq 13 $gettok(%dnr.d,2,42)
      }
      massdid -r aq 14-15
      set %dnr.x You Have $lines(dnr.txt) Question
      did -ra aq 1 %dnr.x
    }
  }
  if ( $did = 22 ) {
    massdid -b aq 21-22
    massdid -m aq 14-15 
    massdid -e aq 16-20
    massdid -r aq 14-15
  }
  if ($did = 23) {
    unset %dnr.*
  }
}
on 1:close:@Game: {
  if ( %sgame2 == ON ) {
    msg %ischan 2          %Edison1
  }
  /set %start ON
  /set %sgame2 OFF
  /.timer5 off
  /.timer1 off
  /.timer2 off
}

dialog Scramble {
  title "Scramble"
  box "Auto Scramble 2000 ",20,6 10 290 100
  text "    : ",1,30 36 300 30
  size -1 -1 300 230
  text "WorD : ", 2,19 57 100 30 
  edit  " Enter The Scramble Word ",3,57 55 149 19
  text "HinT : ",4,19 77 100 30
  edit  " Enter The Scramble Hint ",5,57 75 234 19
  button "Start Game",6,6 140 50 18
  button "Stop Game",7,66 140 64 18
  button "Tell Answer",8,142 140 70 18
  button "Reset Score",9,222 140 70 18
  button "     ",10,74 170 150 17
  button "ExiT",11,10 210 40 18,ok
  button "CleaR",12,250 210 40 18
}
on 1:dialog:Scramble:*:*: {
  if ($devent == sclick) {
    if ($did == 6) { 
      set %forword $did(3)
      set %forhint $did(5)
      if   isin %forword ||  isin %forhint || %forhint = $null || %forword = $null {
        unset %forword 
        unset %forhint
        halt 
      }
      enter
    }
    if ($did == 7) { 
      msg %ischan 2          %Edison1
      /.timer5 off
      /.timer1 off
      /.timer2 off
      /set %start = ON
      /unset %sstop2
      %sdgame = off 
    }
    if ($did == 8) { 
      /msg %ischan 2The CorrecT AnsweR is 14 %forword  unset %forword %Edison1 
      unset %forhint
      did -ra Scramble 3 
      did -ra Scramble 5 
    }
    if ($did == 9) { unset %gscore.* } 
    if ($did == 10) { 
      unset %ischan
      :echan
      g.chan
      did -ra Scramble 1 %ischan2
    } 
    if ($did == 11) { 
      if %forword != $null { 
        msg %ischan 2          %Edison1
        unset %sstop2
        /set %start = ON
        /.timer5 off 
        /.timer1 off
        /.timer2 off
        %sdgame = off 
      }
    }
    if ($did == 12) { 
      did -ra Scramble 3 
      did -ra Scramble 5 
    }
  }
}

menu Channel {
  -
    
  .& 
  ..:/scramble
  ..-
  .. :/scramble.rscore
  .. :/scramble.stop
  ..  :/scramble.tellans 
  .-
  .& :/mode.auto
  .& :/quest

}
