xTrivia — File Browser

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

TeamSquare.mrc — 42.91 KB — Download this file

;--------------------------------------------------------------
squarteam 2.0
by PanToufLe

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


on 1:NICK:{ 
  if (%gamesquarteam_stato != OFF) && ( $nick != $newnick ) {
    squarteam_search $nick
    if (%trovato == 1) {
      %squarteam_chnickline = $read -l %pos squarteamclass.txt
      %squarteam_chnickline = $puttok(%squarteam_chnickline,$newnick,1,46)
      write -l %pos squarteamclass.txt %squarteam_chnickline
    }
    squarteam_manchesearch $nick
    if (%trovato == 1) {
      %squarteam_chnickline = $read -l %pos squarteammanche.txt
      %squarteam_chnickline = $puttok(%squarteam_chnickline,$newnick,1,46)
      write -l %pos squarteammanche.txt %squarteam_chnickline
    }  
  }
}
on 1:JOIN:%squarteam_canale:{ if (%gamesquarteam_stato != OFF) { .msg $nick 8,2·.¸_.->11 [S0qUar11E]0 in corso su %squarteam_canale . 11!aiuto0 per le istruzioni8 <-.¸._.·  } }
on 1:TEXT:!punti:%squarteam_canale:{
  if (%gamesquarteam_stato != OFF) {
    squarteam_search $nick
    if (%trovato == 1) {
      .msg $nick Il tuo punteggio è %squarteam_ptsquery
    }
  }
}

on 1:TEXT:!valori:%squarteam_canale:{ if (%gamesquarteam_stato != OFF) { msg %squarteam_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:%squarteam_canale:{ squarteam_help $nick }

on 1:TEXT:*:?:{
  if (%gamesquarteam_stato == ON) && (%squarteam_manche == OFF) && ($1 != $null) && ($nick != $me) { .msg $nick Manche terminata. Non posso accettare la tua richiesta }
  if (%gamesquarteam_stato == ON) && (%squarteam_manche == ON) && ($1 != $null) && ($nick != $me) {
    set %squarteam_string $1
    set %squarteam_starlet $left(%squarteam_string,1)
    set %squarteam_trovato $read($scriptdirdictionary\ $+ italiano. [ $+ [ %squarteam_starlet ] ],w,%squarteam_string,1)
    if ( %squarteam_trovato == %squarteam_string ) && ($len(%squarteam_string) >= %squarteam_limite) {
      squarteam_manchesearch $nick
      if (%trovato == 0) {
        set %squarteam_fileline $nick
        set %squarteam_fileline $instok(%squarteam_fileline,%squarteam_string,2,46)
        set %squarteam_fileline $addtok(%squarteam_fileline,-,46)
        write squarteammanche.txt %squarteam_fileline
      }
      if (%trovato == 1) {
        set %squarteam_fileline $read -l %pos squarteammanche.txt
        set %squarteam_wrdtok $gettok(%squarteam_fileline,2,46)
        set %squarteam_wrdtok $addtok(%squarteam_wrdtok,%squarteam_string,32)
        set %squarteam_fileline $puttok(%squarteam_fileline,%squarteam_wrdtok,2,46)
        write -l %pos squarteammanche.txt %squarteam_fileline
      }
    }
  }
}

alias squarteam_start {
  if ( %gamesquarteam_stato == ON ) || ( %gamesquarteam_stato == PAUSE ) { if ( $?!="Sei sicuro/a di voler avviare il gioco? Potrebbe essere già attivo oppure in pausa? " == $true ) { set %gamesquarteam_stato OFF  } }
  if (%gamesquarteam_stato == OFF) || (%gamesquarteam_stato == $null) {
    unset %squarteam*
    set %squarteam_canale $?="Su che canale avviare il gioco?"
    if ( %squarteam_canale !ischan ) { echo -a Canale non valido | halt }
    set %squarteam_target $?="Inserisci il numero di punti da totalizzare per vincere:"
    if (%squarteam_target !isnum) { echo -a Non hai inserito un valore valido. Fai ripartire il quiz | halt }
    set %gamesquarteam_stato ON
    set %squarteam_manche OFF
    set %squarteam_durata 10
    set %squarteam_pausetime 10
    set %squarteam_manchenum 0
    if ($exists(squarteamrecord.txt) == $false) squarteam_generahs
    set %squarteam_record $read -l 11 squarteamRecord.txt
    set %squarteam_reckeeper $gettok(%squarteam_record,1,35)
    set %squarteam_record $gettok(%squarteam_record,2,35)
    if $exists(squarteamclass.txt) { .remove squarteamclass.txt }
    if $exists(squarteammanche.txt) { .remove squarteammanche.txt }
    msg %squarteam_canale 8,2_.·°¯°·.¸_.->11 [S0qUar11E-Team]0 by4 #Giochiamo0 AtTiVatO!!!8 <-.¸._.·°¯°·.¸_
    msg %squarteam_canale 8,2¯°·.¸¸.·°¯°·.¸_.>0,2 **11,2 Si vince a8,2 %squarteam_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 squarteamgame squarteamgame
  }
}

on 1:TEXT:!lancia squarteam*:%game_channel:{
  if ($nick isop %game_channel) {
    if (%gamesquarteam_stato == OFF) || (%gamesquarteam_stato == $null) {
      unset %squarteam*
      set %squarteam_chihavinto 11,2 BluE !!! 
      set %squarteam_primo 0
      set %squarteam_secondo 0
      set %squarteam_migliore
      set %squarteam_red
      set %squarteam_blue
      set %squarteam_puntired 0
      set %squarteam_puntiblue 0
      set %squarteam_canale %game_channel
      set %squarteam_target $3
      if ( %squarteam_canale !ischan ) { halt }
      if (%squarteam_target !isnum) { .msg $nick Non hai inserito un valore valido. Fai ripartire il quiz | halt }
      set %gamesquarteam_stato ON
      set %squarteam_manche OFF
      set %squarteam_durata 100
      set %squarteam_pausetime 20
      set %squarteam_manchenum 0
      if ($exists(squarteamrecord.txt) == $false) squarteam_generahs
      set %squarteam_record $read -l 11 squarteamRecord.txt
      set %squarteam_reckeeper $gettok(%squarteam_record,1,35)
      set %squarteam_record $gettok(%squarteam_record,2,35)
      if $exists(squarteamclass.txt) { .remove squarteamclass.txt }
      if $exists(squarteammanche.txt) { .remove squarteammanche.txt }
      msg %squarteam_canale 8,2_.·°¯°·.¸_.->11 [S0qUar11E-Team]0 by4 ^Ang3l^0 AtTiVatO da $nick 8<-.¸._.·°¯°·.¸_
      msg %squarteam_canale 8,2¯°·.¸¸.·°¯°·.¸_.>0,2 **11,2 Si vince a8,2 %squarteam_target $+ 11,2 punti0,2 **8,2 <.¸_¸..·°¯°·.¸¸.·°¯'
      SQTMgenerasquadre
    }
  }
}

alias  SQTMgenerasquadre {
  msg %squarteam_canale 9,2 '©º°¨¨°º©11,2 ©º°¨¨¨°º© 0,2 FoRMiAMo 9,2 Le SqUAdRE 0,2 AvETe 30 SeCOnDI !!! 11,2 ©º°¨¨¨°º©9,2 ©º°¨¨°º©'
  msg %squarteam_canale 9,2 '©º°¨¨°º©11,2 ©º°¨¨¨°º© 0,2 I comandi sono: 11,2 !Gioca Blu 4,2 !Gioca Red 11,2 ©º°¨¨¨°º©9,2 ©º°¨¨°º©'
  .timerhub 1 30 squarteam_hub
}

on 1:TEXT:!gioca blu:%game_channel: {
  if (%gamesquarteam_stato == ON) {
    if $istok(%squarteam_red,$nick,46) {
      msg %squarteam_canale 9,2 '©º°¨ 8,2 $nick  0,2 SeI Già IsCRiTTo!!! 9,2 ¨°º©
    }
    else {
      if $istok(%squarteam_blue,$nick,46) {
        msg %squarteam_canale 9,2 '©º°¨ 8,2 $nick  0,2 SeI Già IsCRiTTo!!! 9,2 ¨°º©
      }
      else {
        msg %squarteam_canale 9,2 '©º°¨ 8,2 $nick  0,2 GiOChERaI nei 11,2BLU 9,2 ¨°º©
        %squarteam_blue = %squarteam_blue $+ $nick $+ .
      }
    }
  }
}


on 1:TEXT:!gioca red:%game_channel: {
  if (%gamesquarteam_stato == ON) {
    if $istok(%squarteam_red,$nick,46) {
      msg %squarteam_canale 9,2 '©º°¨ 8,2 $nick  0,2 SeI Già IsCRiTTo!!! 9,2 ¨°º©
    }
    else {
      if $istok(%squarteam_blue,$nick,46) {
        msg %squarteam_canale 9,2 '©º°¨ 8,2 $nick  0,2 SeI Già IsCRiTTo!!! 9,2 ¨°º©
      }
      else {
        %squarteam_red = %squarteam_red $+ $nick $+ .
        msg %squarteam_canale 9,2 '©º°¨ 8,2 $nick  0,2 GiOChERaI nei 4,2RED 9,2 ¨°º©
      }
    }
  }
}

alias squarteam_generahs {
  %x = 1
  while ( %x <= 11 ) {
    write squarteamrecord.txt none#0
    inc %x
  }
}

on 1:TEXT:!ferma squarteam:%game_channel:{
  if ($nick isop %game_channel) {
    if (%gamesquarteam_stato == ON) {
      if $exists(squarteamclass.txt) { .remove squarteamclass.txt }
      if $exists(squarteammanche.txt) { .remove squarteammanche.txt }
      .timer* off
      msg %squarteam_canale 8,2_.·°¯°·.¸_.->11 [S0qUar11E-Team]00 TerMinAtO8,2 <-.¸._.·°¯°·.¸_
      msg %squarteam_canale 8,2[^°^°^°^°^°^] 0Con4 %squarteam_primo 0 punti vince11 %squarteam_chihavinto 0punti8 [^°^°^°^°^°^]
      set %gamesquarteam_stato OFF
      unset %squarteam*
    }
  }
}

alias squarteam_endofgame {
  if ($lines(squarteamclass.txt) > 3) && (%squarteam_target > 499) {
    set %x 1
    while (%x <= $lines(squarteamclass.txt)) {
      set %squarteam_line $read -l %x squarteamclass.txt
      set %squarteam_nick $gettok(%squarteam_line,1,46)
      set %squarteam_pts $gettok(%squarteam_line,2,46)
      set %squarteam_media $calc(%squarteam_pts / %squarteam_manchenum)
      set %y 1
      if (%squarteam_nick == `computer`) goto scstophere
      squarteam_gcs %squarteam_nick
      if (%trovato == 0) {
        while (%y <= 10) {
          set %squarteam_procline $read -l %y squarteamrecord.txt
          set %squarteam_ptsentry $gettok(%squarteam_procline,2,35)
          if (%squarteam_media > %squarteam_ptsentry) {
            set %z %y
            set %squarteam_inline %squarteam_nick $+ $chr(35) $+ %squarteam_media
            msg %squarteam_canale 8,2 %squarteam_nick 11,2conquista la posizione numero8,2 %y 11,2con la media di4,2 %squarteam_media 11,2punti.
            while (%z <= 10) {
              set %squarteam_temp $read -l %z squarteamrecord.txt
              write -l %z squarteamrecord.txt %squarteam_inline
              set %squarteam_inline %squarteam_temp
              inc %z          
            } 
            goto scstophere 
          }
          inc %y
        }
      }
      if (%trovato == 1) {
        if (%squarteam_media <= %squarteam_ptsquery) goto scstophere
        write -dl %pos squarteamrecord.txt
        while (%y <= %pos) {
          set %squarteam_procline $read -l %y squarteamrecord.txt
          set %squarteam_ptsentry $gettok(%squarteam_procline,2,35)
          if (%squarteam_media > %squarteam_ptsentry) {
            set %squarteam_inline %squarteam_nick $+ $chr(35) $+ %squarteam_media
            msg %squarteam_canale 8,2 %squarteam_nick 11,2 raggiunge la posizione8,2 %y 11,2con la media di4,2 %squarteam_media 11,2punti.
            write -il %y squarteamrecord.txt %squarteam_inline
            goto scstophere 
          }
          inc %y
        }
      }
      :scstophere
      inc %x
    }
  }
  if $exists(squarteamclass.txt) { .remove squarteamclass.txt }
  if $exists(squarteammanche.txt) { .remove squarteammanche.txt }
  msg %squarteam_canale 8,2_.·°¯°·.¸_.->11 [S0qUar11E-Team]00 TerMinAtO8,2 <-.¸._.·°¯°·.¸_
  msg %squarteam_canale 8,2[^°^°^°^°^°^] 0Con4 %squarteam_primo 0 punti vince11 %squarteam_chihavinto 0punti8 [^°^°^°^°^°^]
  set %gamesquarteam_stato OFF
  unset %squarteam*
}

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

alias squarteam_pause {
  if (%gamesquarteam_stato == ON) || (%gamesquarteam_stato == PAUSE) {
    if (%squarteam_manche == ON) { .msg $nick Attendi il termine della manche il corso }
    if (%squarteam_manche == OFF) {
      if (%gamesquarteam_stato == PAUSE) { set %gamesquarteam_stato ON | msg %squarteam_canale 8,2°·.¸_.->11 [S0qUar11E]0  -- Il gioco riprende! --8  <-.¸._.·° | .timernew 1 30 squarteam_hub | halt }
      if (%gamesquarteam_stato == ON) { set %gamesquarteam_stato PAUSE | msg %squarteam_canale 8,2°·.¸_.->4 [S8qUar4E]0  -- Gioco in pausa --8 <-.¸._.·° | halt }
    }
  }
}

on 1:notice:squarteampausa*:?: {
  if ($2 == %game_password) {
    if (%gamesquarteam_stato == ON) || (%gamesquarteam_stato == PAUSE) {
      if (%squarteam_manche == ON) { .msg $nick Attendi il termine della manche il corso }
      if (%squarteam_manche == OFF) {
        if (%gamesquarteam_stato == PAUSE) { set %gamesquarteam_stato ON | msg %squarteam_canale 8,2°·.¸_.->11 [S0qUar11E]0  -- Il gioco riprende! --8  <-.¸._.·° | .timernew 1 30 squarteam_hub | halt }
        if (%gamesquarteam_stato == ON) { set %gamesquarteam_stato PAUSE | msg %squarteam_canale 8,2°·.¸_.->4 [S8qUar4E]0  -- Gioco in pausa --8 <-.¸._.·° | halt }
      }
    }
  }
}

alias squarteam_help {
  if ( %gamesquarteam_stato != OFF) && (%squarteam_antiflood != ON) {
    set %squarteam_antiflood ON
    .timer1 1 1 .msg $1 8,2©©© 11[S0qUa11rE] 8©©© 0- Modalità di gioco :
    .timer2 1 2 .msg $1 8,2“““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““
    .timer3 1 3 .msg $1 11,2Ad ogni manche viene fornito uno schema 5x5 di lettere. Devi formare più parole possibile con le      
    .timer4 1 4 .msg $1 11,2lettere dello schema partendo da una lettera qualunque, spostandosi su caselle adiacenti (anche 
    .timer5 1 5 .msg $1 11,2in diagonale) e non passando 2 volte sulla stessa casella nell'ambito della stessa parola. 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 %squarteam_antiflood OFF
  }
}

alias squarteam_instr {
  if ( %gamesquarteam_stato != OFF ) && (%squarteam_antiflood != ON) {
    set %squarteam_antiflood ON
    .timer1 1 1 msg %squarteam_canale 8,2©©© 11[S0qUar11E] 8©©© 0- Modalità di gioco :
    .timer2 1 2 msg %squarteam_canale 8,2“““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““
    .timer3 1 3 msg %squarteam_canale 11,2Ad ogni manche viene fornito uno schema 5x5 di lettere. Devi formare più parole possibile con le
    .timer4 1 4 msg %squarteam_canale 11,2lettere dello schema partendo da una lettera qualunque, spostandosi su caselle adiacenti (anche
    .timer5 1 5 msg %squarteam_canale 11,2in diagonale) e non passando 2 volte sulla stessa casella nell'ambito della stessa parola. Scrivi
    .timer6 1 6 msg %squarteam_canale 11,2queste parole ad una ad una in query a $me . Alla fine della manche vengono calcolati i punteggi
    .timer7 1 7 msg %squarteam_canale 11,2in base ai valori delle lettere. Le lettere colorate valgono come bonus:
    .timer8 1 8 msg %squarteam_canale 11,29(x2 verde) 8(x3 gialla) 4(x4 rossa) 11sul valore della lettera.
    .timer9 1 9 msg %squarteam_canale 8,2““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““
    .timer10 1 10 set %squarteam_antiflood OFF
  }
}

on 1:notice:squarteamhelp*:?:{ if ($2 == %game_password) && (%gamesquarteam_stato == ON) squarteam_instr }

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

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

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

alias squarteam_ordina {
  set %squarteam_nltxt $lines(squarteamclass.txt)
  set %p 1
  while (%p < %squarteam_nltxt) {
    set %x 1
    while (%x < %squarteam_nltxt) {
      set %y $calc(%x + 1 )
      set %squarteam_upper $read -l %x squarteamclass.txt
      set %squarteam_lower $read -l %y squarteamclass.txt
      set %squarteam_uppt  $gettok(%squarteam_upper,2,46)
      set %squarteam_lowpt $gettok(%squarteam_lower,2,46)
      if (%squarteam_uppt < %squarteam_lowpt) {
        write -l %x squarteamclass.txt %squarteam_lower
        write -l %y squarteamclass.txt %squarteam_upper
      }
      inc %x
    } 
    inc %p
  }
  squarteam_ordina_rovescio
}

alias squarteam_ordina_rovescio {
  set %squarteam_nltxt $lines(squarteammanche.txt)
  set %p 1
  while (%p < %squarteam_nltxt) {
    set %x 1
    while (%x < %squarteam_nltxt) {
      set %y $calc(%x + 1 )
      set %squarteam_upper $read -l %x squarteammanche.txt
      set %squarteam_lower $read -l %y squarteammanche.txt
      set %squarteam_uppt  $gettok(%squarteam_upper,3,46)
      set %squarteam_lowpt $gettok(%squarteam_lower,3,46)
      if (%squarteam_uppt > %squarteam_lowpt) {
        write -l %x squarteammanche.txt %squarteam_lower
        write -l %y squarteammanche.txt %squarteam_upper
      }
      inc %x
    }
    inc %p
  }
}

alias squarteam_start_manche { if (%gamesquarteam_stato == ON) {
    inc %squarteam_manchenum
    set %squarteam_hub OFF
    set %squarteam_limite $rand(3,5)
    set %z 1
    unset %squarteam_grid_line*
    unset %squarteam_mult_*
    unset %squarteam_totale_lettere

    while (%z <= 25) {
      customrandom
      set %squarteam_grid_ [ $+ [ %z ] ] %squarteam_rndlet
      Set %squarteam_totale_lettere %squarteam_totale_lettere $+ . $+ %squarteam_rndlet
      if (%squarteam_rndflag == 1) || (%squarteam_rndflag == 31) set %squarteam_mult_ [ $+ [ %z ] ] 2
      if (%squarteam_rndflag == 2) || (%squarteam_rndflag == 32) set %squarteam_mult_ [ $+ [ %z ] ] 3
      if (%squarteam_rndflag == 3) set %squarteam_mult_ [ $+ [ %z ] ] 4
      inc %z
    }
    set %z 1
    while (%z <= 5) {
      set %y 1
      while (%y <= 5) {
        set %w $calc(%z -1)
        set %squarteam_gridpos $calc(%w * 5 + %y)
        if (%squarteam_mult_ [ $+ [ %squarteam_gridpos ] ] == $null) set %squarteam_grid_line [ $+ [ %z ] ] %squarteam_grid_line [ $+ [ %z ] ] $+ 11,2 %squarteam_grid_ [ $+ [ %squarteam_gridpos ] ]
        if (%squarteam_mult_ [ $+ [ %squarteam_gridpos ] ] == 2) set %squarteam_grid_line [ $+ [ %z ] ] %squarteam_grid_line [ $+ [ %z ] ] $+ 9,2 %squarteam_grid_ [ $+ [ %squarteam_gridpos ] ]
        if (%squarteam_mult_ [ $+ [ %squarteam_gridpos ] ] == 3) set %squarteam_grid_line [ $+ [ %z ] ] %squarteam_grid_line [ $+ [ %z ] ] $+ 8,2 %squarteam_grid_ [ $+ [ %squarteam_gridpos ] ]
        if (%squarteam_mult_ [ $+ [ %squarteam_gridpos ] ] == 4) set %squarteam_grid_line [ $+ [ %z ] ] %squarteam_grid_line [ $+ [ %z ] ] $+ 4,2 %squarteam_grid_ [ $+ [ %squarteam_gridpos ] ]
        inc %y
      }
      inc %z
    }


    .timer21 1 1 msg %squarteam_canale 8,2°·.¸_.->11 [S0qUar11E]8 .·°¯°·.11 Manche n°0 %squarteam_manchenum 8<-.¸._.·°
    .timer22 1 2 msg %squarteam_canale %squarteam_grid_line1
    .timer23 1 2 msg %squarteam_canale %squarteam_grid_line2
    .timer24 1 2 msg %squarteam_canale %squarteam_grid_line3
    .timer25 1 2 msg %squarteam_canale %squarteam_grid_line4
    .timer26 1 2 msg %squarteam_canale %squarteam_grid_line5
    .timer27 1 3 msg %squarteam_canale 0,2Forma parole di almeno4 %squarteam_limite 0lettere. 9Verde x2 8Giallo x3 4Rosso x4
    .timer28 1 4 msg %squarteam_canale 0,2Scrivi le parole in query a4,2 $me
    .timer32 1 5 msg %squarteam_canale 1,1|||squarteam||| %squarteam_totale_lettere $+ . $+ $me $+ . $+ %squarteam_limite
    .timer29 1 5 msg %squarteam_canale 0,2Avete4 %squarteam_durata 0secondi da questo istante
    .timer30 1 5 set %squarteam_manche ON
    .timer31 1 %squarteam_durata { squarteam_alert }
  }
}

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

alias extrand {
  set %squarteam_rndext $rand(1,5)
  if (%squarteam_rndext == 1) set %squarteam_rndlet J
  if (%squarteam_rndext == 2) set %squarteam_rndlet K
  if (%squarteam_rndext == 3) set %squarteam_rndlet X
  if (%squarteam_rndext == 4) set %squarteam_rndlet Y
  if (%squarteam_rndext == 5) set %squarteam_rndlet W
}

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

alias squarteam_endofmanche {
  set %squarteam_manche OFF
  msg %squarteam_canale 0,2 ~ Tempo Scaduto! ~ Risultati della 4 %squarteam_manchenum $+ ª0 manche:
  squarteam_elabora
  close -m
  set %squarteam_timercount 1
  set %squarteam_fatto 0
  set %squarteam_ntim $calc($lines(squarteammanche.txt) + 2)
  .timermsg %squarteam_ntim 2 squarteam_resmsg
}

alias squarteam_elabora {
  set %z 1
  set %squarteam_maxlen 0
  while ( %z <= $lines(squarteammanche.txt) ) {
    set %squarteam_finale 0
    unset %squarteam_depwordstok
    set %squarteam_elline $read -l %z squarteammanche.txt
    set %squarteam_wordstoken $gettok(%squarteam_elline,2,46)
    set %squarteam_wordstokenlen $numtok(%squarteam_wordstoken,32)
    set %w 1
    while (%w <= %squarteam_wordstokenlen) {
      set %squarteam_processedword $gettok(%squarteam_wordstoken,%w,32)
      squarteam_verifica %squarteam_processedword
      if (%found == 1) {
        set %squarteam_letpos 1
        set %squarteam_wordpoints 0
        unset %squarteam_wordart
        set %squarteam_pwl $len(%squarteam_processedword)
        if (%squarteam_pwl > %squarteam_maxlen) set %squarteam_maxlen %squarteam_pwl
        while (%squarteam_letpos <= %squarteam_pwl) {
          set %squarteam_gpp $gettok(%squarteam_burned,%squarteam_letpos,46)
          set %squarteam_proclet $lower(%squarteam_grid_ [ $+ [ %squarteam_gpp ] ])
          set %squarteam_procletval $squarteam_ptsxlet(%squarteam_proclet)
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == 2) set %squarteam_procletval $calc(%squarteam_procletval * 2)
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == 3) set %squarteam_procletval $calc(%squarteam_procletval * 3)
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == 4) set %squarteam_procletval $calc(%squarteam_procletval * 4)
          inc %squarteam_wordpoints %squarteam_procletval
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == $null) {
            if ( $mid(%squarteam_wordart,$pos(%squarteam_wordart,,$pos(%squarteam_wordart,,0)),3) == 11 ) set %squarteam_wordart %squarteam_wordart $+ %squarteam_proclet
            else set %squarteam_wordart %squarteam_wordart $+ 11 $+ %squarteam_proclet
          }
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == 2) set %squarteam_wordart %squarteam_wordart $+ 9 $+ %squarteam_proclet
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == 3) set %squarteam_wordart %squarteam_wordart $+ 8 $+ %squarteam_proclet
          if (%squarteam_mult_ [ $+ [ %squarteam_gpp ] ] == 4) set %squarteam_wordart %squarteam_wordart $+ 4 $+ %squarteam_proclet
          inc %squarteam_letpos
        }  
        inc %squarteam_finale %squarteam_wordpoints
        if (%squarteam_depwordstok == $null) set %squarteam_depwordstok %squarteam_wordart
        else { set %squarteam_depwordstok $addtok(%squarteam_depwordstok,%squarteam_wordart,32) }
      }
      inc %w
    }
    if ($len(%squarteam_depwordstok) > 0) {
      set %squarteam_elline $puttok(%squarteam_elline,%squarteam_depwordstok,2,46)
      set %squarteam_elline $puttok(%squarteam_elline,%squarteam_finale,3,46)
      write -l %z squarteammanche.txt %squarteam_elline
    }
    if ($len(%squarteam_depwordstok) == 0) { write -dl %z squarteammanche.txt | dec %z }
    inc %z
  }
  squarteam_attr_bonus
}

alias squarteam_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 squarteam_verifica {
  set %i 1
  set %found 0
  unset %squarteam_burned
  set %squarteam_word $1
  set %squarteam_starlet $left(%squarteam_word,1)
  while (%i <= 25) && (%found == 0) {
    if (%squarteam_grid_ [ $+ [ %i ] ] == %squarteam_starlet ) {
      set %squarteam_burned %i
      set %squarteam_depth 2
      set %squarteam_node_2 %i
      set %squarteam_counter_2 1
      :sd
      set %squarteam_reflet $mid(%squarteam_word,%squarteam_depth,1)
      set %squarteam_intorno_ [ $+ [ %squarteam_depth ] ] $squarteam_intorno(%squarteam_node_ [ $+ [ %squarteam_depth ] ])
      :nsd
      if (%squarteam_counter_ [ $+ [ %squarteam_depth ] ] <= $numtok(%squarteam_intorno_ [ $+ [ %squarteam_depth ] ],46) ) {
        set %squarteam_subint_ [ $+ [ %squarteam_depth ] ] $gettok(%squarteam_intorno_ [ $+ [ %squarteam_depth ] ],%squarteam_counter_ [ $+ [ %squarteam_depth ] ],46)
        if (%squarteam_grid_ [ $+ [ %squarteam_subint_ [ $+ [ %squarteam_depth ] ] ] ] == %squarteam_reflet) && (%squarteam_depth == $len(%squarteam_word)) && ($istok(%squarteam_burned,%squarteam_subint_ [ $+ [ %squarteam_depth ] ],46) == $false) {
          set %found 1
          set %squarteam_burned $addtok(%squarteam_burned,%squarteam_subint_ [ $+ [ %squarteam_depth ] ],46)
          goto nc
        }
        if (%squarteam_grid_ [ $+ [ %squarteam_subint_ [ $+ [ %squarteam_depth ] ] ] ] == %squarteam_reflet) && (%squarteam_depth != $len(%squarteam_word)) && ($istok(%squarteam_burned,%squarteam_subint_ [ $+ [ %squarteam_depth ] ],46) == $false) {
          set %squarteam_burned $addtok(%squarteam_burned,%squarteam_subint_ [ $+ [ %squarteam_depth ] ],46)
          inc %squarteam_depth
          set %squarteam_node_ [ $+ [ %squarteam_depth ] ] %squarteam_subint_ [ $+ [ $calc(%squarteam_depth -1) ] ]
          set %squarteam_counter_ [ $+ [ %squarteam_depth ] ] 1
          goto sd
        }
        if (%squarteam_grid_ [ $+ [ %squarteam_subint_ [ $+ [ %squarteam_depth ] ] ] ] != %squarteam_reflet) || ($istok(%squarteam_burned,%squarteam_subint_ [ $+ [ %squarteam_depth ] ],46) == $true) {
          inc %squarteam_counter_ [ $+ [ %squarteam_depth ] ]
          goto nsd
        }
      }
      if (%squarteam_counter_ [ $+ [ %squarteam_depth ] ] > $numtok(%squarteam_intorno_ [ $+ [ %squarteam_depth ],46) ) {
        set %squarteam_burned $remtok(%squarteam_burned,%squarteam_node_ [ $+ [ %squarteam_depth ] ],1,46)
        dec %squarteam_depth
        if (%squarteam_depth == 1) goto nc
        inc %squarteam_counter_ [ $+ [ %squarteam_depth ] ]
        goto sd
      }
    }
    :nc
    inc %i
  }
}

alias squarteam_intorno {
  if ($1 == 1) return 2.6.7
  if ($1 == 2) return 1.3.6.7.8
  if ($1 == 3) return 2.4.7.8.9
  if ($1 == 4) return 3.5.8.9.10
  if ($1 == 5) return 4.9.10
  if ($1 == 6) return 1.2.7.11.12
  if ($1 == 7) return 1.2.3.6.8.11.12.13
  if ($1 == 8) return 2.3.4.7.9.12.13.14
  if ($1 == 9) return 3.4.5.8.10.13.14.15
  if ($1 == 10) return 4.5.9.14.15
  if ($1 == 11) return 6.7.12.16.17
  if ($1 == 12) return 6.7.8.11.13.16.17.18
  if ($1 == 13) return 7.8.9.12.14.17.18.19
  if ($1 == 14) return 8.9.10.13.15.18.19.20
  if ($1 == 15) return 9.10.14.19.20
  if ($1 == 16) return 11.12.17.21.22
  if ($1 == 17) return 11.12.13.16.18.21.22.23
  if ($1 == 18) return 12.13.14.17.19.22.23.24
  if ($1 == 19) return 13.14.15.18.20.23.24.25
  if ($1 == 20) return 14.15.19.24.25
  if ($1 == 21) return 16.17.22
  if ($1 == 22) return 16.17.18.21.23
  if ($1 == 23) return 17.18.19.22.24
  if ($1 == 24) return 18.19.20.23.25
  if ($1 == 25) return 19.20.24
}

alias squarteam_attr_bonus {
  unset %squarteam_maxnicks
  set %z 1 
  while (%z <= $lines(squarteammanche.txt)) {
    set %squarteam_elline $read -l %z squarteammanche.txt
    set %squarteam_wordstoken $gettok(%squarteam_elline,2,46)
    set %squarteam_wordstokenlen $numtok(%squarteam_wordstoken,32)
    set %squarteam_wordnick $gettok(%squarteam_elline,1,46)
    set %w 1
    while (%w <= %squarteam_wordstokenlen) {
      set %squarteam_processedword $gettok(%squarteam_wordstoken,%w,32)
      set %squarteam_processedword $remove(%squarteam_processedword,,11,8,9,4,2,$chr(44))
      if ($len(%squarteam_processedword) == %squarteam_maxlen) && ($istok(%squarteam_maxnicks,%squarteam_wordnick,32) == $false) {
        set %squarteam_ptsnick $gettok(%squarteam_elline,3,46)
        if (%squarteam_maxnicks == $null) set %squarteam_maxnicks %squarteam_wordnick
        if (%squarteam_maxnicks != $null) set %squarteam_maxnicks $addtok(%squarteam_maxnicks,%squarteam_wordnick,32)
        inc %squarteam_ptsnick 10
        set %squarteam_elline $puttok(%squarteam_elline,%squarteam_ptsnick,3,46)
        write -l %z squarteammanche.txt %squarteam_elline
      }
      inc %w 
    }
    inc %z
  }
  squarteam_agg_class
}

alias squarteam_agg_class {
  set %z 1
  while (%z <= $lines(squarteammanche.txt)) {
    set %squarteam_clline $read -l %z squarteammanche.txt
    set %squarteam_clnick $gettok(%squarteam_clline,1,46)
    set %squarteam_manchepts $gettok(%squarteam_clline,3,46)
    squarteam_search %squarteam_clnick
    if (%trovato == 0) {
      set %squarteam_input %squarteam_clnick
      set %squarteam_input $addtok(%squarteam_clnick,%squarteam_manchepts,46)
      write squarteamclass.txt %squarteam_input
    }  
    if (%trovato == 1) {
      set %squarteam_input $read -l %pos squarteamclass.txt
      set %squarteam_oldpts $gettok(%squarteam_input,2,46)
      inc %squarteam_oldpts %squarteam_manchepts
      set %squarteam_input $puttok(%squarteam_input,%squarteam_oldpts,2,46)
      write -l %pos squarteamclass.txt %squarteam_input
    }
    inc %z
  }
  squarteam_ordina
}

alias squarteam_resmsg {
  if ($lines(squarteammanche.txt) == $null ) || ($lines(squarteammanche.txt) == 0) && (%squarteam_fatto == 0) { msg %squarteam_canale 11,2 ¤>- Nessuna parola trovata. Che scarsi -<¤ | set %squarteam_fatto 1 }
  if (%squarteam_timercount <= $lines(squarteammanche.txt)) {
    set %linez $read -l %squarteam_timercount squarteammanche.txt
    set %nick $gettok(%linez,1,46)
    set %words $gettok(%linez,2,46)
    set %wscore $gettok(%linez,3,46)
    ;    if (%words != $null) msg %squarteam_canale 8,2 %nick 0ha trovato0 %squarteam_words 0e guadagna8 %wscore 0punti
    if $istok(%squarteam_red,%nick,46) {
      msg %squarteam_canale 4,2 RED  : 8,2 %nick 11,2 con la parola8,2 %words 11,2 vi ha totalizzato8,2 %wscore 11,2 punti8,2 %bonuses
      %squarteam_puntired = %squarteam_puntired + %wscore
    }
    if $istok(%squarteam_blue,%nick,46) {
      msg %squarteam_canale 11,2 BLU  : 8,2 %nick 11,2 con la parola8,2 %words 11,2 vi ha totalizzato8,2 %wscore 11,2 punti8,2 %bonuses
      %squarteam_puntiblue = %squarteam_puntiblue + %wscore
    }
  }
  if (%squarteam_timercount == $calc($lines(squarteammanche.txt) + 1)) { if ($lines(squarteammanche.txt) > 0) msg %squarteam_canale 11,2 Parola più lunga8 (+10 punti) 11trovata da8 %squarteam_maxnicks }
  if (%squarteam_timercount == $calc($lines(squarteammanche.txt) + 2)) { .timerpreclass 1 5 squarteam_prepreclass }
  inc %squarteam_timercount
}

alias squarteam_prepreclass {
  if $exists(squarteammanche.txt) {
    if (%squarteam_puntired > %squarteam_puntiblue) {
      msg %squarteam_canale 9,2 ©º°¨8,2 Classifica:9,2 ¨°º©
      msg %squarteam_canale 8,2 1° posto: ( $+ 9,2 %squarteam_puntired $+ 8,2 ) 4 SqUAdRA RoSSa !!!
      msg %squarteam_canale 8,2 2° posto: ( $+ 9,2 %squarteam_puntiblue $+ 8,2 ) 11 SqUAdRA BlU !!!
      %squarteam_chihavinto = 4,2 SqUAdRA RoSSa !!!
      %squarteam_primo = %squarteam_puntired
      %squarteam_secondo = %squarteam_puntiblue
    }

    if (%squarteam_puntiblue > %squarteam_puntired) {
      msg %squarteam_canale 9,2 ©º°¨8,2 Classifica:9,2 ¨°º©
      msg %squarteam_canale 8,2 1° posto: ( $+ 9,2 %squarteam_puntiblue $+ 8,2 ) 11 SqUAdRA BlU !!!
      msg %squarteam_canale 8,2 2° posto: ( $+ 9,2 %squarteam_puntired $+ 8,2 ) 4 SqUAdRA RoSSa !!!
      %squarteam_chihavinto 11,2 SqUAdRA BlU !!!
      %squarteam_primo = %squarteam_puntiblue
      %squarteam_secondo = %squarteam_puntired
    }

    if (%squarteam_puntiblue == %squarteam_puntired) {
      msg %squarteam_canale 9,2 ©º°¨8,2 Classifica:9,2 ¨°º©
      msg %squarteam_canale 8,2 ©º°¨¨°º© 9WoWwWw PaRImERiTO eNtRAMbe 8 %squarteam_puntiblue 9 PuNTi ©º°¨¨¨°º©
      %squarteam_primo = %squarteam_puntiblue
      %squarteam_secondo = %squarteam_puntired
    }
    .remove squarteammanche.txt
  }
  .timerclass 1 5 squarteam_preclass
}

alias squarteam_preclass {
  set %timercounter 1
  .timerclass 7 2 squarteam_msgclass
}

alias squarteam_msgclass {
  if (%timercounter == 1) { }
  if (%timercounter == 2) {
    set %squarteam_1line $read -l1 sillclass.txt
    set %squarteam_1nick $gettok(%squarteam_1line,1,46)
    set %squarteam_1pts  $gettok(%squarteam_1line,2,46)
    if (%squarteam_1pts == $null) { set %squarteam_1pts - }
    ;    msg %squarteam_canale 8,2 1° posto: ( $+ 9,2 %squarteam_1pts $+ 8,2 ) %squarteam_1nick
  }
  if (%timercounter == 3) {
    set %squarteam_2line $read -l2 sillclass.txt
    set %squarteam_2nick $gettok(%squarteam_2line,1,46)
    set %squarteam_2pts  $gettok(%squarteam_2line,2,46)
    if (%squarteam_2pts == $null) { set %squarteam_2pts - }
    ;    msg %squarteam_canale 8,2 2° posto: ( $+ 9,2 %squarteam_2pts $+ 8,2 ) %squarteam_2nick
  }
  if (%timercounter == 4) {
    set %squarteam_3line $read -l3 sillclass.txt
    set %squarteam_3nick $gettok(%squarteam_3line,1,46)
    set %squarteam_3pts  $gettok(%squarteam_3line,2,46)
    if (%squarteam_3pts == $null) { set %squarteam_3pts - }
    ;    msg %squarteam_canale 8,2 3° posto: ( $+ 9,2 %squarteam_3pts $+ 8,2 ) %squarteam_3nick
  }
  if (%timercounter == 5) {
    set %squarteam_4line $read -l4 sillclass.txt
    set %squarteam_4nick $gettok(%squarteam_4line,1,46)
    set %squarteam_4pts  $gettok(%squarteam_4line,2,46)
    if (%squarteam_4pts == $null) { set %squarteam_4pts - }
    ;    msg %squarteam_canale 8,2 4° posto: ( $+ 9,2 %squarteam_4pts $+ 8,2 ) %squarteam_4nick
  }
  if (%timercounter == 6) {
    set %squarteam_5line $read -l5 sillclass.txt
    set %squarteam_5nick $gettok(%squarteam_5line,1,46)
    set %squarteam_5pts  $gettok(%squarteam_5line,2,46)
    if (%squarteam_5pts == $null) { set %squarteam_5pts - }
    ;    msg %squarteam_canale 8,2 5° posto: ( $+ 9,2 %squarteam_5pts $+ 8,2 ) %squarteam_5nick
  }
  if (%timercounter == 7) { .timerhub 1 %squarteam_pausetime squarteam_hub }
  inc %timercounter
}

alias squarteam_hub {
  if ( (( %squarteam_primo > %squarteam_secondo ) && ( %squarteam_primo >= %squarteam_target )) || (!($exists(sillclass.txt)) && (%squarteam_target == -1)) ) { squarteam_endofgame }
  else { if (%gamesquarteam_stato == ON) { msg %squarteam_canale 9,2 ©º°¨8,2 Attenzione! Sta per partire la prossima manche9,2 ¨°º© | .timernew 1 5 squarteam_start_manche | set %squarteam_hub ON } }
}


alias squarteam_hub {
  if ( (( %squarteam_1pts > %squarteam_2pts ) && ( %squarteam_1pts >= %squarteam_target )) || (!($exists(squarteamclass.txt)) && (%squarteam_target == -1)) ) { squarteam_endofgame }
  else { if (%gamesquarteam_stato == ON) { msg %squarteam_canale 8,2°·.¸_.->0 Tra4 50 secondi la prossima manche! 8<-.¸._.·° | .timernew 1 5 squarteam_start_manche | set %squarteam_hub ON } }
}

menu channel,menubar {
  -
  Giochi
  .SquarTeam
  ..Let's go:squarteam_start
  ..Dialog ON:dialog -m squarteamGame squarteamGame
  ..Dialog OFF:dialog -x squarteamGame squarteamGame
  ..Pausa/riprendi:squarteam_pause
  ..End of game:squarteam_end_query
  ..Istruzioni:squarteam_instr
  -
}
dialog squarteamGame {
  title "SquarTeam"
  size -1 -1 239 336
  option pixels
  box "squarteam 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 squarteam", 518, 1 106 240 30
}

on 1:dialog:squarteamGame:sclick:501: { if (%squarteam_manchenum == 0) && (%squarteam_hub != ON) { squarteam_hub } }

on 1:dialog:squarteamGame:sclick:502: { squarteam_pause }

on 1:dialog:squarteamGame:sclick:503: { squarteam_instr }

on 1:dialog:squarteamGame:sclick:518: {
  if (%gamesquarteam_stato != OFF) {
    if (%squarteam_manche == ON ) {
      msg %squarteam_canale  %squarteam_grid_line1
      msg %squarteam_canale  %squarteam_grid_line2
      msg %squarteam_canale  %squarteam_grid_line3
      msg %squarteam_canale  %squarteam_grid_line4
      msg %squarteam_canale  %squarteam_grid_line5
    }
    else { echo -a Nessuna manche in corso }
  }
} 

on 1:notice:squarteamgrid*:?:{
  if (%gamesquarteam_stato != OFF) && ($2 == %game_password) {
    if (%squarteam_manche == ON ) {
      msg %squarteam_canale  %squarteam_grid_line1
      msg %squarteam_canale  %squarteam_grid_line2
      msg %squarteam_canale  %squarteam_grid_line3
      msg %squarteam_canale  %squarteam_grid_line4
      msg %squarteam_canale  %squarteam_grid_line5
    }
    else { .msg $nick Nessuna manche in corso }
  }
}

on 1:dialog:squarteamGame:sclick:504: { squarteam_end_query }

on 1:dialog:squarteamGame:sclick:513: {
  if (%gamesquarteam_stato != OFF) {
    if (%squarteam_durata < 50) { echo -a Non puoi scendere sotto i 40 secondi }
    else {
      dec %squarteam_durata 10
      msg %squarteam_canale 11,2 Il tempo a disposizione per ogni manche è ora di8,2 %squarteam_durata 11,2secondi
    }
  }
}

on 1:dialog:squarteamGame:sclick:512: {
  if (%gamesquarteam_stato != OFF) {
    inc %squarteam_durata 10
    msg %squarteam_canale 11,2 Il tempo a disposizione per ogni manche è ora di8,2 %squarteam_durata 11,2secondi
  }
}

on 1:dialog:squarteamGame:sclick:516: {
  if (%gamesquarteam_stato != OFF) {
    if (%squarteam_pausetime < 15) { echo -a Non puoi scendere sotto i 10 secondi }
    else {
      dec %squarteam_pausetime 5
      msg %squarteam_canale 11,2 L'attesa tra due manche è ora di9,2 %squarteam_pausetime 11,2secondi
    }
  }
}

on 1:dialog:squarteamGame:sclick:515: {
  if (%gamesquarteam_stato != OFF) {
    inc %squarteam_pausetime 5
    msg %squarteam_canale 11,2 L'attesa tra due manche è ora di9,2 %squarteam_pausetime 11,2secondi
  }
}

on 1:notice:squarteamm-10*:?: {
  if (%gamesquarteam_stato != OFF) && ($2 == %game_password) && (%squarteam_target < 500) {
    if (%squarteam_durata < 50) { .msg $nick Non puoi scendere sotto i 40 secondi }
    else {
      dec %squarteam_durata 10
      msg %squarteam_canale Il tempo a disposizione per ogni manche è ora di %squarteam_durata secondi
    }
  }
}

on 1:notice:squarteamm+10*:?: {
  if (%gamesquarteam_stato != OFF) && ($2 == %game_password) && (%squarteam_target < 500) {
    inc %squarteam_durata 10
    msg %squarteam_canale Il tempo a disposizione per ogni manche è ora di %squarteam_durata secondi
  }
}

on 1:notice:squarteamp-5*:?:{
  if (%gamesquarteam_stato != OFF) && ($2 == %game_password) {
    if (%squarteam_pausetime < 15) { .msg $nick Non puoi scendere sotto i 10 secondi }
    else {
      dec %squarteam_pausetime 5
      msg %squarteam_canale L'attesa tra due manche è ora di %squarteam_pausetime secondi
    }
  }
}

on 1:notice:squarteamp+5*:?:{
  if (%gamesquarteam_stato != OFF)  && ($2 == %game_password) {
    inc %squarteam_pausetime 5
    msg %squarteam_canale L'attesa tra due manche è ora di %squarteam_pausetime secondi
  }
}

on 1:notice:squarteamtarget*:?:{
  if (%gamesquarteam_stato != OFF)  && ($3 == %game_password) && ($2 > 0) {
    set %squarteam_target $2
    msg %squarteam_canale 11,2 Il punteggio da raggiungere ora è:8,2 %squarteam_target
  }
}

on 1:text:!squarteamhs:%game_channel:{
  set %i 1
  unset %hs
  while (%i <= 10) {
    set %line $read -l %i squarteamrecord.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 squarteamrecord.txt
  set %nick $gettok(%line,1,35)
  set %pts $gettok(%line,2,35)
  msg %game_channel 11,2 ©º°¨8,2 squarteam 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
}