xTrivia — File Browser

xTriviav1.0 / xTriviav1.0 / xTriviaByRibellina / xtrivia / bot / Addons / Giochi / ZigZag.mrc

ZigZag.mrc — 38.03 KB — Download this file

;--------------------------------------------------------------
zigzag 2.0
by kitesurf

Per caricare lo script: /load -rs zigzag.pan
Per il corretto funzionamento dello script assicurarsi
che il dizionario sia contenuto nella sottocartella Dictionary.
;--------------------------------------------------------------


on 1:NICK:{ 
  if (%gamezigzag_stato != OFF) && ( $nick != $newnick ) {
    zigzag_search $nick
    if (%trovato == 1) {
      %zigzag_chnickline = $read -l %pos zigzagclass.txt
      %zigzag_chnickline = $puttok(%zigzag_chnickline,$newnick,1,46)
      write -l %pos zigzagclass.txt %zigzag_chnickline
    }
    zigzag_manchesearch $nick
    if (%trovato == 1) {
      %zigzag_chnickline = $read -l %pos zigzagmanche.txt
      %zigzag_chnickline = $puttok(%zigzag_chnickline,$newnick,1,46)
      write -l %pos zigzagmanche.txt %zigzag_chnickline
    }  
  }
}
;on 1:JOIN:%zigzag_canale:{ if (%gamezigzag_stato != OFF) { .msg $nick 8,2Β·.ΒΈ_.->11 [11Z0i11GZ0a11G]0 in corso su %zigzag_canale $+ . 11!aiuto0 per le istruzioni8 <-.ΒΈ._.Β·   } }
on 1:TEXT:!punti:%zigzag_canale:{
  if (%gamezigzag_stato != OFF) {
    zigzag_search $nick
    if (%trovato == 1) {
      .msg $nick Il tuo punteggio Γ¨ %zigzag_ptsquery 
    }
  }
}

on 1:TEXT:!valori:%zigzag_canale:{ if (%gamezigzag_stato != OFF) { msg %zigzag_canale 8,2Valori: 11a=1 b=3 c=1 d=3 e=1 f=3 g=3 h=6 i=1 j=8 k=8 l=2 m=2 n=2 o=1 p=3 q=6 r=1 s=1 t=1 u=3 v=3 w=8 x=8 y=8 z=5  } }
on 1:TEXT:!aiuto:%zigzag_canale: zigzag_help $nick

on 1:TEXT:*:?:{
  if (%gamezigzag_stato == ON) && (%zigzag_manche == OFF) && ($1 != $null) && ($nick != $me) { .msg $nick Manche terminata. Non posso accettare la tua richiesta }
  if (%gamezigzag_stato == ON) && (%zigzag_manche == ON) && ($1 != $null) && ($nick != $me) {
    set %zigzag_string $1
    set %zigzag_starlet $left(%zigzag_string,1)
    set %zigzag_trovato $read($scriptdirdictionary\ $+ italiano. [ $+ [ %zigzag_starlet ] ],w,%zigzag_string,1)
    if ( %zigzag_trovato == %zigzag_string ) && ($len(%zigzag_string) >= %zigzag_limite) {
      zigzag_manchesearch $nick
      if (%trovato == 0) {
        set %zigzag_fileline $nick
        set %zigzag_fileline $instok(%zigzag_fileline,%zigzag_string,2,46)
        set %zigzag_fileline $addtok(%zigzag_fileline,-,46)
        write zigzagmanche.txt %zigzag_fileline
      }
      if (%trovato == 1) {
        set %zigzag_fileline $read -l %pos zigzagmanche.txt
        set %zigzag_wrdtok $gettok(%zigzag_fileline,2,46)
        set %zigzag_wrdtok $addtok(%zigzag_wrdtok,%zigzag_string,32) 
        set %zigzag_fileline $puttok(%zigzag_fileline,%zigzag_wrdtok,2,46)
        write -l %pos zigzagmanche.txt %zigzag_fileline   
      }
    }
  }
}

alias zigzag_start {
  if ( %gamezigzag_stato == ON ) || ( %gamezigzag_stato == PAUSE ) { if ( $?!="Sei sicuro/a di voler avviare il gioco? Potrebbe essere giΓ  attivo oppure in pausa? " == $true ) { set %gamezigzag_stato OFF  } }
  if (%gamezigzag_stato == OFF) || (%gamezigzag_stato == $null) {
    unset %zigzag*
    set %zigzag_canale $?="Su che canale avviare il gioco?"
    if ( %zigzag_canale !ischan ) { echo -a Canale non valido | halt }
    set %zigzag_target $?="Inserisci il numero di punti da totalizzare per vincere:"
    if (%zigzag_target !isnum) { echo -a Non hai inserito un valore valido. Fai ripartire il quiz | halt }
    set %gamezigzag_stato ON
    set %zigzag_manche OFF
    set %zigzag_durata 90
    set %zigzag_pausetime 30
    set %zigzag_manchenum 0
    if ($exists(zigzagrecord.txt) == $false) zigzag_generahs
    set %zigzag_record $read -l 11 zigzagrecord.txt
    set %zigzag_reckeeper $gettok(%zigzag_record,1,35)
    set %zigzag_record $gettok(%zigzag_record,2,35)
    if $exists(zigzagclass.txt) { .remove zigzagclass.txt }
    if $exists(zigzagmanche.txt) { .remove zigzagmanche.txt }
    notice %zigzag_canale 0,12ZiG ZaG aTTiVaTo Su 04 %zigzag_canale 
    msg %zigzag_canale 8,2_.·°¯°·.¸_.->4 [Z8i4G] [Z8a4G]0 by4 BrEiL0 AtTiVatO!!!8 <-.¸._.·°¯°·.¸_ 
    msg %zigzag_canale 8,2¯°·.¸¸.·°¯°·.¸_.>0,2 **11,2 Si vince a8,2 %zigzag_target $+ 11,2 punti0,2 **8,2 <.¸_¸..·°¯°·.¸¸.·°¯' 
    echo -a 11,2 Fai partire la prima manche quando vuoi dal pannello col tasto START GAME
    dialog -m zigzaggame zigzaggame
  }
}

on 1:text:!zigzagon*:#:{
  if (($nick !isop %game_channel) && ($nick !ishop %game_channel)) { notice  $nick 7,2 Devi essere almeno % per attivare ZigZag | halt }
  if ($3 == %game_password) {
    if (%gamezigzag_stato == OFF) || (%gamezigzag_stato == $null) {
      unset %zigzag*
      set %zigzag_canale %game_channel 
      set %zigzag_target $2
      if (%zigzag_canale !ischan ) { halt }
      if (%zigzag_target !isnum) { echo 3 -a Non hai inserito un valore valido. Fai ripartire il quiz | halt }
      set %gamezigzag_stato ON 
      set %zigzag_manche OFF 
      set %zigzag_durata 90
      set %zigzag_pausetime 30 
      set %zigzag_manchenum 0
      if ($exists(zigzagrecord.txt) == $false) zigzag_generahs
      set %zigzag_record $read -l 11 zigzagrecord.txt
      set %zigzag_reckeeper $gettok(%zigzag_record,1,35) 
      set %zigzag_record $gettok(%zigzag_record,2,35)
      if $exists(zigzagclass.txt) { .remove zigzagclass.txt }
      if $exists(zigzagmanche.txt) { .remove zigzagmanche.txt }
      msg %zigzag_canale 8,2_.·°¯°·.¸_.->4 [Z8I4G] [Z8a4G]0 by4 BrEiL0 AtTiVatO da $nick 8<-.¸._.·°¯°·.¸_ 
      msg %zigzag_canale 8,2¯°·.¸¸.·°¯°·.¸_.>0,2 **11,2 Si vince a8,2 %zigzag_target $+ 11,2 punti0,2 **8,2 <.¸_¸..·°¯°·.¸¸.·°¯' 
      .timerhub 1 20 zigzag_hub
    }
  }
}
alias zigzag_generahs {
  echo 4 -a inizio scrittura records
  %x = 1
  while ( %x <= 11 ) {
    write zigzagrecord.txt none#0
    inc %x
  }
}

on 1:text:!zigzagoff*:#:{
  if (($nick !isop %game_channel) && ($nick !ishop %game_channel)) { notice  $nick 7,2 Devi essere almeno % per fermare ZigZag | halt }
  if ($2 == %game_password) && (%gamezigzag_stato == ON) {
    if $exists(zigzagclass.txt) { .remove zigzagclass.txt }
    if $exists(zigzagmanche.txt) { .remove zigzagmanche.txt }
    .timer* off
    msg %zigzag_canale 8,2 _.·°¯°·.¸_.->4 [Z8i4G] [Z8a4G]0 by4 BrEiL0 TerMinAtO8,2 <-.¸._.·°¯°·.¸_ 
    msg %zigzag_canale 8,2 [^Β°^Β°^Β°^Β°^Β°^] 0Vince4 %zigzag_1nick 0con11 %zigzag_1pts 0punti8 [^Β°^Β°^Β°^Β°^Β°^] 
    msg %zigzag_canale 8,2 _.·°¯°·.¸_.->11 $me 8,2<-.¸._.·°¯°·.¸_ 
    var %bot_msg_temp $botmsg_popgame(verd,Fermato zigzag su %game_channel,$nick $iif(%zigzag_1nick, β€’ Vince: %zigzag_1nick β€’ Punteggio: %zigzag_1pts))
    set %gamezigzag_stato OFF
    unset %zigzag*
  }
}

alias zigzag_endofgame {
  if ($lines(zigzagclass.txt) > 3) && (%zigzag_target > 499) {
    set %x 1
    while (%x <= $lines(zigzagclass.txt)) {
      set %zigzag_line $read -l %x zigzagclass.txt
      set %zigzag_nick $gettok(%zigzag_line,1,46)
      set %zigzag_pts $gettok(%zigzag_line,2,46)
      set %zigzag_media $calc(%zigzag_pts / %zigzag_manchenum)
      set %y 1
      if (%zigzag_nick == `computer`) goto scstophere
      zigzag_gcs %zigzag_nick
      if (%trovato == 0) {
        while (%y <= 16) {
          set %zigzag_procline $read -l %y zigzagrecord.txt
          set %zigzag_ptsentry $gettok(%zigzag_procline,2,35)
          if (%zigzag_media > %zigzag_ptsentry) {
            set %z %y
            set %zigzag_inline %zigzag_nick $+ $chr(35) $+ %zigzag_media
            msg %zigzag_canale 8,2 %zigzag_nick 11,2conquista la posizione numero8,2 %y 11,2con la media di4,2 %zigzag_media 11,2punti. 
            while (%z <= 2) {
              set %zigzag_temp $read -l %z zigzagrecord.txt
              write -l %z zigzagrecord.txt %zigzag_inline
              set %zigzag_inline %zigzag_temp    
              inc %z          
            } 
            goto scstophere 
          }
          inc %y
        }
      }
      if (%trovato == 1) {
        if (%zigzag_media <= %zigzag_ptsquery) goto scstophere
        write -dl %pos zigzagrecord.txt
        while (%y <= %pos) {
          set %zigzag_procline $read -l %y zigzagrecord.txt
          set %zigzag_ptsentry $gettok(%zigzag_procline,2,35)
          if (%zigzag_media > %zigzag_ptsentry) {
            set %zigzag_inline %zigzag_nick $+ $chr(35) $+ %zigzag_media
            msg %zigzag_canale 8,2 %zigzag_nick 11,2raggiunge la posizione8,2 %y 11,2con la media di4,2 %zigzag_media 11,2punti. 
            write -il %y zigzagrecord.txt %zigzag_inline
            goto scstophere 
          }
          inc %y
        }
      }
      :scstophere
      inc %x
    }
  }
  if $exists(zigzagclass.txt) { .remove zigzagclass.txt }
  if $exists(zigzagmanche.txt) { .remove zigzagmanche.txt }
  msg %zigzag_canale 8,2 _.·°¯°·.¸_.->4 [Z8i4G] [Z8a4G]0 by4 BrEiL0 TerMinAtO8,2 <-.¸._.·°¯°·.¸_ 
  msg %zigzag_canale 8,2 [^Β°^Β°^Β°^Β°^Β°^] 0Vince4 %zigzag_1nick 0con11 %zigzag_1pts 0punti8 [^Β°^Β°^Β°^Β°^Β°^] 
  msg %zigzag_canale 8,2 _.·°¯°·.¸_.->11 $me 8,2<-.¸._.·°¯°·.¸_ 
  var %bot_msg_temp $botmsg_popgame(verd,Terminato zigzag su %game_channel,Vince: %zigzag_1nick β€’ Punteggio: %zigzag_1pts)
  set %gamezigzag_stato OFF
  unset %zigzag*
}

alias zigzag_end_query { 
  if (%gamezigzag_stato == ON) || (%gamezigzag_stato == PAUSE) {
    if ( $?!="Vuoi terminare il gioco? Esso verrΓ  fermato alla fine della prossima manche o di quella in corso " == $true ) { set %zigzag_target -1 }
  }
}

alias zigzag_pause {
  if (%gamezigzag_stato == ON) || (%gamezigzag_stato == PAUSE) {
    if ($botgames_check_rist($nick,silent) != OK) { halt }
    if (%zigzag_manche == ON) { .msg $nick Attendi il termine della manche il corso } 
    if (%zigzag_manche == OFF) {
      if (%gamezigzag_stato == PAUSE) { set %gamezigzag_stato ON | msg %zigzag_canale 8,2°·.¸_.->4 [S8uPe4r] [S8qUar4E]0  -- Il gioco riprende! --8  <-.¸._.·°  | .timernew 1 30 zigzag_hub | halt } 
      if (%gamezigzag_stato == ON) { set %gamezigzag_stato PAUSE | msg %zigzag_canale 8,2°·.¸_.->4 [S8qUar4E]0  -- Gioco in pausa --8 <-.¸._.·°  | halt }
    }
  }
}

on 1:notice:zigzagpausa*:?: {
  if (%gamezigzag_stato == ON) || (%gamezigzag_stato == PAUSE) {
    if (%zigzag_manche == ON) { .msg $nick Attendi il termine della manche il corso } 
    if (%zigzag_manche == OFF) {
      if (%gamezigzag_stato == PAUSE) { set %gamezigzag_stato ON | msg %zigzag_canale 8,2°·.¸_.->4 [S8uPe4r] [S8qUar4E]0  -- Il gioco riprende! --8  <-.¸._.·°  | .timernew 1 30 zigzag_hub | halt } 
      if (%gamezigzag_stato == ON) { set %gamezigzag_stato PAUSE | msg %zigzag_canale 8,2°·.¸_.->4 [S8qUar4E]0  -- Gioco in pausa --8 <-.¸._.·°  | halt }
    }
  }
}

alias zigzag_help {
  if ( %gamezigzag_stato != OFF) && (%zigzag_antiflood != ON) {
    set %zigzag_antiflood ON
    .timer1 1 1 .msg $1 8,2©©© 11[Z0iGZa11G] 8©©© 0- Modalità di gioco : 
    .timer2 1 2 .msg $1 8,2β€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œ 
    .timer3 1 3 .msg $1 11,2Ad ogni manche vengono fornite lettere in due file orizzontali. Devi formare piΓΉ parole possibile con le 
    .timer4 1 4 .msg $1 11,2lettere,  partendo da una lettera qualunque, da sinistra verso destra, 
    .timer5 1 5 .msg $1 11,2spostandosi  a zig zag su caselle anche non adiacenti.  Scrivi 
    .timer6 1 6 .msg $1 11,2queste parole ad una ad una in query a $me . Alla fine della manche vengono calcolati i punteggi 
    .timer7 1 7 .msg $1 11,2in base ai valori delle lettere. Le lettere colorate valgono come bonus: 
    .timer8 1 8 .msg $1 11,29(x2 verde) 8(x3 gialla) 4(x4 rossa) 11sul valore della lettera. 
    .timer9 1 9 .msg $1 8,2β€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œ 
    .timer10 1 10 set %zigzag_antiflood OFF
  }
}

alias zigzag_instr {
  if ( %gamezigzag_stato != OFF ) && (%zigzag_antiflood != ON) {
    set %zigzag_antiflood ON
    .timer1 1 1 msg %zigzag_canale 8,2©©© 4[Z8i4G] [Z8a4G] 8©©© 0- Modalità di gioco : 
    .timer2 1 2 msg %zigzag_canale 8,2β€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œ 
    .timer3 1 3 msg %zigzag_canale 11,2Ad ogni manche vengono fornite lettere in due file orizzontali. Devi formare piΓΉ parole possibile con le 
    .timer4 1 4 msg %zigzag_canale 11,2lettere,  partendo da una lettera qualunque, da sinistra verso destra, 
    .timer5 1 5 msg %zigzag_canale 11,2spostandosi  a zig zag su caselle anche non adiacenti.  Scrivi 
    .timer6 1 6 msg %zigzag_canale 11,2queste parole ad una ad una in query a $me . Alla fine della manche vengono calcolati i punteggi 
    .timer7 1 7 msg %zigzag_canale 11,2in base ai valori delle lettere. Le lettere colorate valgono come bonus: 
    .timer8 1 8 msg %zigzag_canale 11,29(x2 verde) 8(x3 gialla) 4(x4 rossa) 11sul valore della lettera. 
    .timer9 1 9 msg %zigzag_canale 8,2β€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œβ€œ 
    .timer10 1 10 set %zigzag_antiflood OFF
  }
}

on 1:text:!zigzaghelp*:#:{ if (%gamezigzag_stato == ON) zigzag_instr }

alias zigzag_gcs { 
  set %i 1
  set %trovato 0
  while ( ( %i <= 10 ) && ( %trovato == 0 ) ) {
    %riga = $read -l %i zigzagrecord.txt    
    %nome = $gettok(%riga,1,35)
    %zigzag_ptsquery = $gettok(%riga,2,35)
    if ( %nome == $1 ) {
      set %trovato 1 
      set %pos %i
    }
    inc %i 1 
  }
}

alias zigzag_search { 
  %lineefile = $lines(zigzagclass.txt)
  set %i 1
  set %trovato 0
  while ( ( %i <= %lineefile ) && ( %trovato == 0 ) ) {
    %riga = $read -l %i zigzagclass.txt    
    %nome = $gettok(%riga,1,46)
    %zigzag_ptsquery = $gettok(%riga,2,46)
    if ( %nome == $1 ) {
      set %trovato 1 
      set %pos %i
    }
    inc %i 1 
  }
}

alias zigzag_manchesearch { 
  %lineefile = $lines(zigzagmanche.txt)
  set %i 1
  set %trovato 0
  while ( ( %i <= %lineefile ) && ( %trovato == 0 ) ) {
    %riga = $read -l %i zigzagmanche.txt    
    %nome = $gettok(%riga,1,46)
    if ( %nome == $1 ) {
      set %trovato 1 
      set %pos %i
    }
    inc %i 1 
  }
}

alias zigzag_ordina { 
  set %zigzag_nltxt $lines(zigzagclass.txt)
  set %p 1
  while (%p < %zigzag_nltxt) {
    set %x 1
    while (%x < %zigzag_nltxt) {
      set %y $calc(%x + 1 )
      set %zigzag_upper $read -l %x zigzagclass.txt
      set %zigzag_lower $read -l %y zigzagclass.txt
      set %zigzag_uppt  $gettok(%zigzag_upper,2,46)
      set %zigzag_lowpt $gettok(%zigzag_lower,2,46)
      if (%zigzag_uppt < %zigzag_lowpt) {
        write -l %x zigzagclass.txt %zigzag_lower
        write -l %y zigzagclass.txt %zigzag_upper
      }
      inc %x
    } 
    inc %p
  }
  zigzag_ordina_rovescio
}

alias zigzag_ordina_rovescio { 
  set %zigzag_nltxt $lines(zigzagmanche.txt)
  set %p 1
  while (%p < %zigzag_nltxt) { 
    set %x 1
    while (%x < %zigzag_nltxt) {
      set %y $calc(%x + 1 )
      set %zigzag_upper $read -l %x zigzagmanche.txt
      set %zigzag_lower $read -l %y zigzagmanche.txt
      set %zigzag_uppt  $gettok(%zigzag_upper,3,46)
      set %zigzag_lowpt $gettok(%zigzag_lower,3,46)
      if (%zigzag_uppt > %zigzag_lowpt) {
        write -l %x zigzagmanche.txt %zigzag_lower
        write -l %y zigzagmanche.txt %zigzag_upper
      }
      inc %x
    }
    inc %p
  }
}

alias zigzag_start_manche { if (%gamezigzag_stato == ON) {
    inc %zigzag_manchenum | set %zigzag_hub OFF
    ;set %zigzag_limite $rand(3,6)
    set %zigzag_limite 3
    set %z 1 | unset %zigzag_grid_line* | unset %zigzag_mult_*
    while (%z <= $calc(2 * 16)) {  sscustomrandom
      set %zigzag_grid_ [ $+ [ %z ] ] %zigzag_rndlet
      if (%zigzag_rndflag == 1) || (%zigzag_rndflag == 31) set %zigzag_mult_ [ $+ [ %z ] ] 2
      if (%zigzag_rndflag == 2) || (%zigzag_rndflag == 32) set %zigzag_mult_ [ $+ [ %z ] ] 3
      if (%zigzag_rndflag == 3) set %zigzag_mult_ [ $+ [ %z ] ] 4
      inc %z
    }
    set %z 1
    while (%z <= 2) {
      set %y 1
      while (%y <= 16) {
        set %w $calc(%z -1)
        set %zigzag_gridpos $calc(%w * 16 + %y)
        if (%zigzag_mult_ [ $+ [ %zigzag_gridpos ] ] == $null) set %zigzag_grid_line [ $+ [ %z ] ] %zigzag_grid_line [ $+ [ %z ] ] $+ 11,2 %zigzag_grid_ [ $+ [ %zigzag_gridpos ] ]
        if (%zigzag_mult_ [ $+ [ %zigzag_gridpos ] ] == 2) set %zigzag_grid_line [ $+ [ %z ] ] %zigzag_grid_line [ $+ [ %z ] ] $+ 9,2 %zigzag_grid_ [ $+ [ %zigzag_gridpos ] ]
        if (%zigzag_mult_ [ $+ [ %zigzag_gridpos ] ] == 3) set %zigzag_grid_line [ $+ [ %z ] ] %zigzag_grid_line [ $+ [ %z ] ] $+ 8,2 %zigzag_grid_ [ $+ [ %zigzag_gridpos ] ]
        if (%zigzag_mult_ [ $+ [ %zigzag_gridpos ] ] == 4) set %zigzag_grid_line [ $+ [ %z ] ] %zigzag_grid_line [ $+ [ %z ] ] $+ 4,2 %zigzag_grid_ [ $+ [ %zigzag_gridpos ] ]
        inc %y
      }
      inc %z
    }
    .timer21 1 1 msg %zigzag_canale 8,2 °·.¸_.->4 [Z8i4G] [Z8a4G]8 .·°¯°·.11 Manche n°0 %zigzag_manchenum 8<-.¸._.·° 
    .timer22 1 2 msg %zigzag_canale %zigzag_grid_line1 
    .timer23 1 2 msg %zigzag_canale %zigzag_grid_line2 
    .timer27 1 3 msg %zigzag_canale 0,2 Forma parole di almeno4 %zigzag_limite 0lettere. 9Verde x2 8Giallo x3 4Rosso x4 
    .timer28 1 4 msg %zigzag_canale 0,2 Scrivi le parole in query a4,2 $me 
    .timer29 1 4 msg %zigzag_canale 0,2 Avete4 %zigzag_durata 0secondi da questo istante 
    .timer30 1 4 set %zigzag_manche ON
    .timer31 1 $calc(%zigzag_durata + 5) { zigzag_alert }
  }
}

alias sscustomrandom {
  set %zigzag_rnd $rand(1,31)
  if (%zigzag_rnd == 1) set %zigzag_rndlet A
  if (%zigzag_rnd == 2) set %zigzag_rndlet A
  if (%zigzag_rnd == 3) set %zigzag_rndlet A
  if (%zigzag_rnd == 4) set %zigzag_rndlet E
  if (%zigzag_rnd == 5) set %zigzag_rndlet E
  if (%zigzag_rnd == 6) set %zigzag_rndlet E
  if (%zigzag_rnd == 7) set %zigzag_rndlet I
  if (%zigzag_rnd == 8) set %zigzag_rndlet I
  if (%zigzag_rnd == 9) set %zigzag_rndlet I
  if (%zigzag_rnd == 10) set %zigzag_rndlet O
  if (%zigzag_rnd == 11) set %zigzag_rndlet O
  if (%zigzag_rnd == 12) set %zigzag_rndlet O
  if (%zigzag_rnd == 13) set %zigzag_rndlet U
  if (%zigzag_rnd == 14) set %zigzag_rndlet U
  if (%zigzag_rnd == 15) set %zigzag_rndlet B
  if (%zigzag_rnd == 16) set %zigzag_rndlet C
  if (%zigzag_rnd == 17) set %zigzag_rndlet D
  if (%zigzag_rnd == 18) set %zigzag_rndlet F
  if (%zigzag_rnd == 19) set %zigzag_rndlet G
  if (%zigzag_rnd == 20) set %zigzag_rndlet H
  if (%zigzag_rnd == 21) set %zigzag_rndlet L
  if (%zigzag_rnd == 22) set %zigzag_rndlet M
  if (%zigzag_rnd == 23) set %zigzag_rndlet N
  if (%zigzag_rnd == 24) set %zigzag_rndlet P
  if (%zigzag_rnd == 25) set %zigzag_rndlet Q
  if (%zigzag_rnd == 26) set %zigzag_rndlet R
  if (%zigzag_rnd == 27) set %zigzag_rndlet S
  if (%zigzag_rnd == 28) set %zigzag_rndlet T
  if (%zigzag_rnd == 29) set %zigzag_rndlet V
  if (%zigzag_rnd == 30) set %zigzag_rndlet Z
  if (%zigzag_rnd == 31) { ssextrand }
  set %zigzag_rndflag $rand(1,70)
}

alias ssextrand {
  set %zigzag_rndext $rand(1,5)
  if (%zigzag_rndext == 1) set %zigzag_rndlet J
  if (%zigzag_rndext == 2) set %zigzag_rndlet K
  if (%zigzag_rndext == 3) set %zigzag_rndlet X
  if (%zigzag_rndext == 4) set %zigzag_rndlet Y
  if (%zigzag_rndext == 5) set %zigzag_rndlet W
}

alias zigzag_alert {
  msg %zigzag_canale 8,2 °·.¸_.->11 Presto! Mancano solo 10 secondi! 8<-.¸._.·° 
  .timerend 1 10 zigzag_endofmanche
}

alias zigzag_endofmanche {
  set %zigzag_manche OFF
  msg %zigzag_canale 0,2 ~ Tempo Scaduto! ~ Risultati della4 %zigzag_manchenum $+ Βͺ0 manche: 
  zigzag_elabora
  close -m
  set %zigzag_timercount 1
  set %zigzag_fatto 0
  set %zigzag_ntim $calc($lines(zigzagmanche.txt) + 2)
  .timermsg %zigzag_ntim 2 zigzag_resmsg
}

alias zigzag_elabora {
  set %z 1
  set %zigzag_maxlen 0
  while ( %z <= $lines(zigzagmanche.txt) ) {
    set %zigzag_finale 0
    unset %zigzag_depwordstok
    set %zigzag_elline $read -l %z zigzagmanche.txt
    set %zigzag_wordstoken $gettok(%zigzag_elline,2,46) 
    set %zigzag_wordstokenlen $numtok(%zigzag_wordstoken,32)
    set %w 1
    while (%w <= %zigzag_wordstokenlen) {
      set %zigzag_processedword $gettok(%zigzag_wordstoken,%w,32)
      zigzag_verifica %zigzag_processedword
      if (%found == 1) {
        set %zigzag_letpos 1   
        set %zigzag_wordpoints 0
        unset %zigzag_wordart
        set %zigzag_pwl $len(%zigzag_processedword) 
        if (%zigzag_pwl > %zigzag_maxlen) set %zigzag_maxlen %zigzag_pwl
        while (%zigzag_letpos <= %zigzag_pwl) {
          set %zigzag_gpp $gettok(%zigzag_burned,%zigzag_letpos,46) 
          set %zigzag_proclet $lower(%zigzag_grid_ [ $+ [ %zigzag_gpp ] ])
          set %zigzag_procletval $zigzag_ptsxlet(%zigzag_proclet) 
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == 2) set %zigzag_procletval $calc(%zigzag_procletval * 2)
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == 3) set %zigzag_procletval $calc(%zigzag_procletval * 3)
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == 4) set %zigzag_procletval $calc(%zigzag_procletval * 4)
          inc %zigzag_wordpoints %zigzag_procletval
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == $null) {
            if ( $mid(%zigzag_wordart,$pos(%zigzag_wordart,,$pos(%zigzag_wordart,,0)),3) == 11 ) set %zigzag_wordart %zigzag_wordart $+ %zigzag_proclet
            else set %zigzag_wordart %zigzag_wordart $+ 11 $+ %zigzag_proclet
          }
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == 2) set %zigzag_wordart %zigzag_wordart $+ 9 $+ %zigzag_proclet
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == 3) set %zigzag_wordart %zigzag_wordart $+ 8 $+ %zigzag_proclet
          if (%zigzag_mult_ [ $+ [ %zigzag_gpp ] ] == 4) set %zigzag_wordart %zigzag_wordart $+ 4 $+ %zigzag_proclet
          inc %zigzag_letpos
        }  
        inc %zigzag_finale %zigzag_wordpoints
        if (%zigzag_depwordstok == $null) set %zigzag_depwordstok %zigzag_wordart
        else { set %zigzag_depwordstok $addtok(%zigzag_depwordstok,%zigzag_wordart,32) }
      }
      inc %w
    }
    if ($len(%zigzag_depwordstok) > 0) {
      set %zigzag_elline $puttok(%zigzag_elline,%zigzag_depwordstok,2,46)
      set %zigzag_elline $puttok(%zigzag_elline,%zigzag_finale,3,46)
      write -l %z zigzagmanche.txt %zigzag_elline 
    }
    if ($len(%zigzag_depwordstok) == 0) { write -dl %z zigzagmanche.txt | dec %z }
    inc %z
  }
  zigzag_attr_bonus
}

alias zigzag_ptsxlet {
  if ($1 == a) return 1
  if ($1 == b) return 3
  if ($1 == c) return 1
  if ($1 == d) return 3
  if ($1 == e) return 1
  if ($1 == f) return 3
  if ($1 == g) return 3
  if ($1 == h) return 6
  if ($1 == i) return 1
  if ($1 == j) return 8
  if ($1 == k) return 8
  if ($1 == l) return 2
  if ($1 == m) return 2
  if ($1 == n) return 2
  if ($1 == o) return 1
  if ($1 == p) return 3
  if ($1 == q) return 6
  if ($1 == r) return 1
  if ($1 == s) return 1
  if ($1 == t) return 1
  if ($1 == u) return 3
  if ($1 == v) return 3
  if ($1 == x) return 8
  if ($1 == y) return 8
  if ($1 == w) return 8
  if ($1 == z) return 5
}


alias zigzag_verifica {
  set %i 1
  set %found 0
  unset %zigzag_burned
  set %zigzag_word $1
  set %zigzag_starlet $left(%zigzag_word,1)
  while (%i <= $calc(7 * 7)) && (%found == 0) {
    if (%zigzag_grid_ [ $+ [ %i ] ] == %zigzag_starlet ) {
      set %zigzag_burned %i 
      set %zigzag_depth 2
      set %zigzag_node_2 %i
      set %zigzag_counter_2 1
      :sd
      set %zigzag_reflet $mid(%zigzag_word,%zigzag_depth,1)
      set %zigzag_intorno_ [ $+ [ %zigzag_depth ] ] $zigzag_intorno(%zigzag_node_ [ $+ [ %zigzag_depth ] ])
      :nsd
      if (%zigzag_counter_ [ $+ [ %zigzag_depth ] ] <= $numtok(%zigzag_intorno_ [ $+ [ %zigzag_depth ] ],46) ) {
        set %zigzag_subint_ [ $+ [ %zigzag_depth ] ] $gettok(%zigzag_intorno_ [ $+ [ %zigzag_depth ] ],%zigzag_counter_ [ $+ [ %zigzag_depth ] ],46)
        if (%zigzag_grid_ [ $+ [ %zigzag_subint_ [ $+ [ %zigzag_depth ] ] ] ] == %zigzag_reflet) && (%zigzag_depth == $len(%zigzag_word)) && ($istok(%zigzag_burned,%zigzag_subint_ [ $+ [ %zigzag_depth ] ],46) == $false) {
          set %found 1
          set %zigzag_burned $addtok(%zigzag_burned,%zigzag_subint_ [ $+ [ %zigzag_depth ] ],46)
          goto nc
        }
        if (%zigzag_grid_ [ $+ [ %zigzag_subint_ [ $+ [ %zigzag_depth ] ] ] ] == %zigzag_reflet) && (%zigzag_depth != $len(%zigzag_word)) && ($istok(%zigzag_burned,%zigzag_subint_ [ $+ [ %zigzag_depth ] ],46) == $false) {
          set %zigzag_burned $addtok(%zigzag_burned,%zigzag_subint_ [ $+ [ %zigzag_depth ] ],46)
          inc %zigzag_depth
          set %zigzag_node_ [ $+ [ %zigzag_depth ] ] %zigzag_subint_ [ $+ [ $calc(%zigzag_depth -1) ] ]
          set %zigzag_counter_ [ $+ [ %zigzag_depth ] ] 1
          goto sd
        }
        if (%zigzag_grid_ [ $+ [ %zigzag_subint_ [ $+ [ %zigzag_depth ] ] ] ] != %zigzag_reflet) || ($istok(%zigzag_burned,%zigzag_subint_ [ $+ [ %zigzag_depth ] ],46) == $true) {
          inc %zigzag_counter_ [ $+ [ %zigzag_depth ] ]
          goto nsd
        }
      }
      if (%zigzag_counter_ [ $+ [ %zigzag_depth ] ] > $numtok(%zigzag_intorno_ [ $+ [ %zigzag_depth ],46) ) {
        set %zigzag_burned $remtok(%zigzag_burned,%zigzag_node_ [ $+ [ %zigzag_depth ] ],1,46)
        dec %zigzag_depth     
        if (%zigzag_depth == 1) goto nc
        inc %zigzag_counter_ [ $+ [ %zigzag_depth ] ]
        goto sd
      }
    }
    :nc
    inc %i
  }
}

alias zigzag_intorno {
  if ($1 == 1) return 17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32
  if ($1 == 2) return 18.19.20.21.22.23.24.25.26.27.28.29.30.31.32
  if ($1 == 3) return 19.20.21.22.23.24.25.26.27.28.29.30.31.32
  if ($1 == 4) return 20.21.22.23.24.25.26.27.28.29.30.31.32
  if ($1 == 5) return 21.22.23.24.25.26.27.28.29.30.31.32
  if ($1 == 6) return 22.23.24.25.26.27.28.29.30.31.32
  if ($1 == 7) return 23.24.25.26.27.28.29.30.31.32
  if ($1 == 8) return 24.25.26.27.28.29.30.31.32
  if ($1 == 9) return 25.26.27.28.29.30.31.32
  if ($1 == 10) return 26.27.28.29.30.31.32
  if ($1 == 11) return 27.28.29.30.31.32
  if ($1 == 12) return 28.29.30.31.32
  if ($1 == 13) return 29.30.31.32
  if ($1 == 14) return 30.31.32
  if ($1 == 15) return 31.32
  if ($1 == 16) return 32
  if ($1 == 17) return 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16
  if ($1 == 18) return 2.3.4.5.6.7.8.9.10.11.12.13.14.15.16
  if ($1 == 19) return 3.4.5.6.7.8.9.10.11.12.13.14.15.16
  if ($1 == 20) return 4.5.6.7.8.9.10.11.12.13.14.15.16
  if ($1 == 21) return 5.6.7.8.9.10.11.12.13.14.15.16
  if ($1 == 22) return 6.7.8.9.10.11.12.13.14.15.16
  if ($1 == 23) return 7.8.9.10.11.12.13.14.15.16
  if ($1 == 24) return 8.9.10.11.12.13.14.15.16
  if ($1 == 25) return 9.10.11.12.13.14.15.16
  if ($1 == 26) return 10.11.12.13.14.15.16
  if ($1 == 27) return 11.12.13.14.15.16
  if ($1 == 28) return 12.13.14.15.16
  if ($1 == 29) return 13.14.15.16
  if ($1 == 30) return 14.15.16
  if ($1 == 31) return 15.16
  if ($1 == 32) return 16
}
alias zigzag_attr_bonus {
  unset %zigzag_maxnicks
  set %z 1 
  while (%z <= $lines(zigzagmanche.txt)) {
    set %zigzag_elline $read -l %z zigzagmanche.txt
    set %zigzag_wordstoken $gettok(%zigzag_elline,2,46) 
    set %zigzag_wordstokenlen $numtok(%zigzag_wordstoken,32)
    set %zigzag_wordnick $gettok(%zigzag_elline,1,46) 
    set %w 1
    while (%w <= %zigzag_wordstokenlen) {  
      set %zigzag_processedword $gettok(%zigzag_wordstoken,%w,32)
      set %zigzag_processedword $remove(%zigzag_processedword,,11,8,9,4,2,$chr(44))
      if ($len(%zigzag_processedword) == %zigzag_maxlen) && ($istok(%zigzag_maxnicks,%zigzag_wordnick,32) == $false) {
        set %zigzag_ptsnick $gettok(%zigzag_elline,3,46) 
        if (%zigzag_maxnicks == $null) set %zigzag_maxnicks %zigzag_wordnick
        if (%zigzag_maxnicks != $null) set %zigzag_maxnicks $addtok(%zigzag_maxnicks,%zigzag_wordnick,32)
        inc %zigzag_ptsnick 10
        set %zigzag_elline $puttok(%zigzag_elline,%zigzag_ptsnick,3,46)
        write -l %z zigzagmanche.txt %zigzag_elline 
      }
      inc %w 
    }
    inc %z
  }
  zigzag_agg_class
}

alias zigzag_agg_class {
  set %z 1
  while (%z <= $lines(zigzagmanche.txt)) {
    set %zigzag_clline $read -l %z zigzagmanche.txt
    set %zigzag_clnick $gettok(%zigzag_clline,1,46)  
    set %zigzag_manchepts $gettok(%zigzag_clline,3,46)  
    zigzag_search %zigzag_clnick
    if (%trovato == 0) {
      set %zigzag_input %zigzag_clnick
      set %zigzag_input $addtok(%zigzag_clnick,%zigzag_manchepts,46)
      write zigzagclass.txt %zigzag_input
    }  
    if (%trovato == 1) {
      set %zigzag_input $read -l %pos zigzagclass.txt
      set %zigzag_oldpts $gettok(%zigzag_input,2,46)  
      inc %zigzag_oldpts %zigzag_manchepts
      set %zigzag_input $puttok(%zigzag_input,%zigzag_oldpts,2,46)  
      write -l %pos zigzagclass.txt %zigzag_input
    }
    inc %z
  }
  zigzag_ordina
}

alias zigzag_resmsg {
  if ($lines(zigzagmanche.txt) == $null ) || ($lines(zigzagmanche.txt) == 0) && (%zigzag_fatto == 0) { msg %zigzag_canale 11,2 Β€>- Nessuna parola trovata. Che scarsi -<Β€ | set %zigzag_fatto 1 }
  if (%zigzag_timercount <= $lines(zigzagmanche.txt)) {
    set %linez $read -l %zigzag_timercount zigzagmanche.txt    
    set %nick $gettok(%linez,1,46)
    set %words $gettok(%linez,2,46)
    set %wscore $gettok(%linez,3,46)
    if (%words != $null) msg %zigzag_canale 8,2 %nick 0ha trovato0 %words 0e guadagna8 %wscore 0punti
  }
  if (%zigzag_timercount == $calc($lines(zigzagmanche.txt) + 1)) { if ($lines(zigzagmanche.txt) > 0) msg %zigzag_canale 11,2 Parola piΓΉ lunga8 (+10 punti) 11trovata da8 %zigzag_maxnicks }
  if (%zigzag_timercount == $calc($lines(zigzagmanche.txt) + 2)) { .timerpreclass 1 5 zigzag_prepreclass }
  inc %zigzag_timercount
}

alias zigzag_prepreclass {
  if $exists(zigzagmanche.txt) {
    set %zigzag_pnrline $read -l $lines(zigzagmanche.txt) zigzagmanche.txt
    set %zigzag_pnrecord $gettok(%zigzag_pnrline,3,46)
    set %zigzag_pnrkeeper $gettok(%zigzag_pnrline,1,46)
    if (%zigzag_pnrecord > %zigzag_record) {
      msg %zigzag_canale 11,2 Nuovo Record8,2 ( $+ %zigzag_pnrecord $+ ) 11,2di punti in una manche. Il precedente4,2 ( $+ %zigzag_record $+ ) 11,2apparteneva a4,2 %zigzag_reckeeper
      set %zigzag_record %zigzag_pnrecord 
      set %zigzag_reckeeper %zigzag_pnrkeeper
      set %zigzag_pnrline %zigzag_reckeeper $+ $chr(35) $+ %zigzag_record
      write -l 11 zigzagRecord.txt %zigzag_pnrline
    }
    .remove zigzagmanche.txt 
  }
  .timerclass 1 5 zigzag_preclass
}

alias zigzag_preclass {
  set %timercounter 1
  .timerclass 7 2 zigzag_msgclass
}

alias zigzag_msgclass {
  if (%timercounter == 1) { msg %zigzag_canale 4,2©º°¨8 Classifica: 4¨°º© }
  if (%timercounter == 2) { 
    set %zigzag_1line $read -l1 zigzagclass.txt
    set %zigzag_1nick $gettok(%zigzag_1line,1,46)
    set %zigzag_1pts  $gettok(%zigzag_1line,2,46)
    if (%zigzag_1pts == $null) { set %zigzag_1pts - }
    msg %zigzag_canale 0,2 1Β° posto: 8(4 %zigzag_1pts 8)0 %zigzag_1nick 
  }
  if (%timercounter == 3) {
    set %zigzag_2line $read -l2 zigzagclass.txt
    set %zigzag_2nick $gettok(%zigzag_2line,1,46)
    set %zigzag_2pts  $gettok(%zigzag_2line,2,46)
    if (%zigzag_2pts == $null) { set %zigzag_2pts - }
    msg %zigzag_canale 0,2 2Β° posto: 8(4 %zigzag_2pts 8)0 %zigzag_2nick 
  }
  if (%timercounter == 4) {
    set %zigzag_3line $read -l3 zigzagclass.txt
    set %zigzag_3nick $gettok(%zigzag_3line,1,46)
    set %zigzag_3pts  $gettok(%zigzag_3line,2,46)
    if (%zigzag_3pts == $null) { set %zigzag_3pts - }
    msg %zigzag_canale 0,2 3Β° posto: 8(4 %zigzag_3pts 8)0 %zigzag_3nick 
  }
  if (%timercounter == 5) {
    set %zigzag_4line $read -l4 zigzagclass.txt
    set %zigzag_4nick $gettok(%zigzag_4line,1,46)
    set %zigzag_4pts  $gettok(%zigzag_4line,2,46)
    if (%zigzag_4pts == $null) { set %zigzag_4pts - }
    msg %zigzag_canale 0,2 4Β° posto: 8(4 %zigzag_4pts 8)0 %zigzag_4nick 
  }
  if (%timercounter == 6) {
    set %zigzag_5line $read -l5 zigzagclass.txt
    set %zigzag_5nick $gettok(%zigzag_5line,1,46)
    set %zigzag_5pts  $gettok(%zigzag_5line,2,46)
    if (%zigzag_5pts == $null) { set %zigzag_5pts - }
    msg %zigzag_canale 0,2 5Β° posto: 8(4 %zigzag_5pts 8)0 %zigzag_5nick 
  }
  if (%timercounter == 7) { .timerhub 1 %zigzag_pausetime zigzag_hub }
  inc %timercounter
}

alias zigzag_hub {
  if ( (( %zigzag_1pts > %zigzag_2pts ) && ( %zigzag_1pts >= %zigzag_target )) || (!($exists(zigzagclass.txt)) && (%zigzag_target == -1)) ) { zigzag_endofgame }
  else { if (%gamezigzag_stato == ON) { msg %zigzag_canale 8,2°·.¸_.->0 Tra4 50 secondi la prossima manche! 8<-.¸._.·° | .timernew 1 5 zigzag_start_manche | set %zigzag_hub ON } }
}

menu channel,menubar {
  -
  Giochi
  .Zigzag
  ..Let's go:zigzag_start 
  ..Dialog ON:dialog -m zigzagGame zigzagGame
  ..Dialog OFF:dialog -x zigzagGame zigzagGame
  ..Pausa/riprendi:zigzag_pause
  ..End of game:zigzag_end_query
  ..Istruzioni:zigzag_instr
  -
}
dialog zigzagGame {
  title "Scara Quick Plus Game"
  size -1 -1 239 336
  icon $mircdirskin\1.ico, 0
  option pixels
  box "zigzag Game Commands Console", 500, 1 1 240 135
  button "Start Game", 501, 1 16 240 30
  button "Pausa/Riprendi", 502, 1 46 240 30
  button "Dai istruzioni", 503, 1 76 240 30
  button "End-Of-Game", 504, 1 136 240 30
  box "Regola tempi di gioco", 510, 1 183 240 120
  text "Aumenta/decrementa di 10 secondi la durata di ogni manche", 511, 68 207 105 40
  button "+10", 512, 6 209 50 30
  button "-10", 513, 187 209 50 30
  text "Aumenta/decrementa di 5 secondi l'attesa tra 2 manches", 514, 69 258 105 40
  button "+5", 515, 6 266 50 30
  button "-5", 516, 187 266 50 30
  button "Chiudi questa finestra", 517, 0 306 240 30, ok
  button "Current zigzag", 518, 1 106 240 30
}

on 1:dialog:zigzagGame:sclick:501: { if (%zigzag_manchenum == 0) && (%zigzag_hub != ON) { zigzag_hub } }

on 1:dialog:zigzagGame:sclick:502: { zigzag_pause }

on 1:dialog:zigzagGame:sclick:503: { zigzag_instr }

on 1:dialog:zigzagGame:sclick:518: {
  if (%gamezigzag_stato != OFF) {
    if (%zigzag_manche == ON ) { 
      msg %zigzag_canale  %zigzag_grid_line1
      msg %zigzag_canale  %zigzag_grid_line2
      msg %zigzag_canale  %zigzag_grid_line3
      msg %zigzag_canale  %zigzag_grid_line4
      msg %zigzag_canale  %zigzag_grid_line5
    }
    else { echo -a Nessuna manche in corso }
  }
} 

on 1:text:!zigzaggrid*:#:{
  if (%gamezigzag_stato != OFF) && ($2 == %game_password) {
    if (%zigzag_manche == ON ) { 
      msg %zigzag_canale  %zigzag_grid_line1
      msg %zigzag_canale  %zigzag_grid_line2
      msg %zigzag_canale  %zigzag_grid_line3
      msg %zigzag_canale  %zigzag_grid_line4
      msg %zigzag_canale  %zigzag_grid_line5
    }
    else { .msg $nick Nessuna manche in corso }
  }
}

on 1:dialog:zigzagGame:sclick:504: { zigzag_end_query }

on 1:dialog:zigzagGame:sclick:513: {
  if (%gamezigzag_stato != OFF) {
    if (%zigzag_durata < 50) { echo -a Non puoi scendere sotto i 40 secondi }
    else {
      dec %zigzag_durata 10
      msg %zigzag_canale 11,2 Il tempo a disposizione per ogni manche Γ¨ ora di8,2 %zigzag_durata 11,2secondi
    }
  }
}

on 1:dialog:zigzagGame:sclick:512: {
  if (%gamezigzag_stato != OFF) {
    inc %zigzag_durata 10
    msg %zigzag_canale 11,2 Il tempo a disposizione per ogni manche Γ¨ ora di8,2 %zigzag_durata 11,2secondi
  }
}

on 1:dialog:zigzagGame:sclick:516: {
  if (%gamezigzag_stato != OFF) {
    if (%zigzag_pausetime < 15) { echo -a Non puoi scendere sotto i 10 secondi }
    else {
      dec %zigzag_pausetime 5
      msg %zigzag_canale 11,2 L'attesa tra due manche Γ¨ ora di9,2 %zigzag_pausetime 11,2secondi
    }
  }
}

on 1:dialog:zigzagGame:sclick:515: {
  if (%gamezigzag_stato != OFF) {
    inc %zigzag_pausetime 5
    msg %zigzag_canale 11,2 L'attesa tra due manche Γ¨ ora di9,2 %zigzag_pausetime 11,2secondi
  }
}

on 1:text:!zigzagm-10*:#: {
  if (%gamezigzag_stato != OFF) && ($2 == %game_password) && (%zigzag_target < 500) {
    if (%zigzag_durata < 50) { .msg $nick Non puoi scendere sotto i 40 secondi }
    else {
      dec %zigzag_durata 10
      msg %zigzag_canale Il tempo a disposizione per ogni manche Γ¨ ora di %zigzag_durata secondi
    }
  }
}

on 1:text:!zigzagm+10*:#: {
  if (%gamezigzag_stato != OFF) && ($2 == %game_password) && (%zigzag_target < 500) {
    inc %zigzag_durata 10
    msg %zigzag_canale Il tempo a disposizione per ogni manche Γ¨ ora di %zigzag_durata secondi
  }
}

on 1:text:!zigzagp-5*:#:{
  if (%gamezigzag_stato != OFF) && ($2 == %game_password) {
    if (%zigzag_pausetime < 15) { .msg $nick Non puoi scendere sotto i 10 secondi }
    else {
      dec %zigzag_pausetime 5
      msg %zigzag_canale L'attesa tra due manche Γ¨ ora di %zigzag_pausetime secondi
    }
  }
}

on 1:text:!zigzagp+5*:#:{
  if (%gamezigzag_stato != OFF)  && ($2 == %game_password) {
    inc %zigzag_pausetime 5
    msg %zigzag_canale L'attesa tra due manche Γ¨ ora di %zigzag_pausetime secondi
  }
}

on 1:text:!zigzagtarget*:#:{
  if (%gamezigzag_stato != OFF)  && ($3 == %game_password) && ($2 > 0) {
    set %zigzag_target $2
    msg %zigzag_canale 11,2 Il punteggio da raggiungere ora Γ¨:8,2 %zigzag_target
  }
}

on 1:text:!zigzaghs:%game_channel:{
  set %i 1
  unset %hs
  while (%i <= 10) {
    set %line $read -l %i zigzagrecord.txt
    set %nick $gettok(%line,1,35)
    set %pts $gettok(%line,2,35)
    if $calc(%i % 2) { set %line 11,2 %Pts $+ 11,2 %nick }  
    else { set %line 9,2 %Pts $+ 9,2 %nick }
    set %hs %hs $+ 4,2 β€’Β·β€’ $+ %line
    inc %i
  }
  set %line $read -l 11 zigzagrecord.txt
  set %nick $gettok(%line,1,35)
  set %pts $gettok(%line,2,35)
  msg %game_channel 11,2 ©º°¨8,2 zigzag High Scores11,2 ¨°º©
  msg %game_channel 11,2 Record punti in una manche:8,2 %nick 8,2 $+ (4,2 %pts  8,2)
  msg %game_channel 11,2 Top Ten media punti: %hs
}