;-------------------------------------------------------------- ;Square 2.0 ;by PanToufLe ;Per caricare lo script: /load -rs square.pan ;Per il corretto funzionamento dello script assicurarsi ;che il dizionario sia contenuto nella sottocartella Dictionary. ;-------------------------------------------------------------- ;veste grafica by rh3a on 1:TEXT:!target:%chan_square:{ if (%gamesquare_stato != OFF) { .msg %chan_square 4 Punteggio da raggiungere:  %square_target } } on 1:NICK:{ if (%gamesquare_stato != OFF) && ( $nick != $newnick ) { square_search $nick if (%trovato == 1) { %square_chnickline = $read -l %pos squareclass.txt %square_chnickline = $puttok(%square_chnickline,$newnick,1,46) write -l %pos squareclass.txt %square_chnickline } square_manchesearch $nick if (%trovato == 1) { %square_chnickline = $read -l %pos squaremanche.txt %square_chnickline = $puttok(%square_chnickline,$newnick,1,46) write -l %pos squaremanche.txt %square_chnickline } } } ;on 1:JOIN:%chan_square:{ if (%gamesquare_stato != OFF) { .msg $nick 0,2Square in corso su 4 %chan_square  . 0!aiuto per le istruzioni  } } on 1:TEXT:!copy:%chan_square:{ if (%gamesquare_stato != OFF) { if (%copy_stato != OFF) { copia_query_square $nick } } } on 1:TEXT:!copy:?:{ if (%gamesquare_stato != OFF) { if (%copy_stato != OFF) { copia_query_square $nick } } } on 1:TEXT:!punti:%chan_square:{ if (%gamesquare_stato != OFF) { square_search $nick if (%trovato == 1) { .msg $nick Il tuo punteggio θ %square_ptsquery } } } on 1:TEXT:!valori:%chan_square:{ if (%gamesquare_stato != OFF) { msg %chan_square 0,2 Valori: 11 a=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:%chan_square: square_help $nick on 1:TEXT:*:?:{ if (%gamesquare_stato == ON) && (%square_manche == OFF) && ($1 != $null) && ($nick != $me) { .msg $nick 0,4 TEMPO SCADUTO  4 Non posso accettare la tua richiesta  } if (%gamesquare_stato == ON) && (%square_manche == ON) && ($1 != $null) && ($nick != $me) { set %square_string $1 set %square_starlet $left(%square_string,1) set %square_trovato $read($scriptdirdictionary\ $+ italiano. [ $+ [ %square_starlet ] ],w,%square_string,1) if ( %square_trovato == %square_string ) && ($len(%square_string) >= %square_limite) { square_manchesearch $nick if (%trovato == 0) { set %square_fileline $nick set %square_fileline $instok(%square_fileline,%square_string,2,46) set %square_fileline $addtok(%square_fileline,-,46) write squaremanche.txt %square_fileline } if (%trovato == 1) { set %square_fileline $read -l %pos squaremanche.txt set %square_wrdtok $gettok(%square_fileline,2,46) set %square_wrdtok $addtok(%square_wrdtok,%square_string,32) set %square_fileline $puttok(%square_fileline,%square_wrdtok,2,46) write -l %pos squaremanche.txt %square_fileline } } } } alias square_start { if ( %gamesquare_stato == ON ) || ( %gamesquare_stato == PAUSE ) { if ( $?!="Sei sicuro/a di voler avviare il gioco? Potrebbe essere giΰ attivo oppure in pausa? " == $true ) { set %gamesquare_stato OFF } } if (%gamesquare_stato == OFF) || (%gamesquare_stato == $null) { unset %square* set %chan_square $?="Su che canale avviare il gioco?" if ( %chan_square !ischan ) { echo -a Canale non valido | halt } set %square_target $?="Inserisci il numero di punti da totalizzare per vincere:" if (%square_target !isnum) { echo -a 4Non hai inserito un valore valido. Fai ripartire il quiz | halt } set %gamesquare_stato ON set %square_manche OFF set %copy_stato OFF set %square_durata 90 set %square_pausetime 10 set %square_manchenum 0 if ($exists(squarerecord.txt) == $false) square_generahs set %Square_record $read -l 11 SquareRecord.txt set %Square_reckeeper $gettok(%Square_record,1,35) set %Square_record $gettok(%Square_record,2,35) if $exists(squareclass.txt) { .remove squareclass.txt } if $exists(squaremanche.txt) { .remove squaremanche.txt } msg %chan_square           0,2 Square Attivato!!! msg %chan_square           0,6 Punteggio da raggiungere  %square_target  echo -a 4Fai partire la prima manche quando vuoi dal pannello col tasto START GAME dialog -m squaregame squaregame } } on 1:Notice:-square-start-*:?:{ if ($3 == %Game_Password) { if (%gamesquare_stato == OFF) || (%gamesquare_stato == $null) { unset %square* set %square_target $2 if ( %chan_square !ischan ) { halt } if (%square_target !isnum) { .msg $nick 4Non hai inserito un valore valido. Fai ripartire il quiz | halt } set %gamesquare_stato ON set %square_manche OFF set %copy_stato OFF set %square_durata 90 set %square_pausetime 10 set %square_manchenum 0 if ($exists(squarerecord.txt) == $false) square_generahs set %Square_record $read -l 11 SquareRecord.txt set %Square_reckeeper $gettok(%Square_record,1,35) set %Square_record $gettok(%Square_record,2,35) if $exists(squareclass.txt) { .remove squareclass.txt } if $exists(squaremanche.txt) { .remove squaremanche.txt } msg %chan_square           0,2 Square Attivato da $nick !!! msg %chan_square           0,6 Punteggio da raggiungere  %square_target  .timerhub 1 20 square_hub } } } alias copia_query_square { .timer1 [ $+ [ $1 ] ] 1 1 msg $1 0,2 Square Manche n° 4 %square_manchenum  .timer2 [ $+ [ $1 ] ] 1 2 msg $1  %square_grid_line1 .timer3 [ $+ [ $1 ] ] 1 2 msg $1  %square_grid_line2 .timer4 [ $+ [ $1 ] ] 1 3 msg $1  %square_grid_line3 .timer5 [ $+ [ $1 ] ] 1 3 msg $1  %square_grid_line4 .timer6 [ $+ [ $1 ] ] 1 4 msg $1  %square_grid_line5 .timer7 [ $+ [ $1 ] ] 1 4 msg $1 0,2 Lunghezza minima parole: 4 %square_limite 0 lettere. 9[x2] 8[x3] 4[x4]  } alias square_generahs { %x = 1 while ( %x <= 11 ) { write squarerecord.txt none#0 inc %x } } on 1:Notice:-square-stop-*:?:{ if ($2 == %Game_Password) && (%gamesquare_stato == ON) { if $exists(squareclass.txt) { .remove squareclass.txt } if $exists(squaremanche.txt) { .remove squaremanche.txt } .timer* off msg %chan_square           0,2 Square Stoppato da $nick ! msg %chan_square           0,2 Il Vincitore θ 4 %square_1nick 0 con 4 %square_1pts 0 punti!!!  set %gamesquare_stato OFF unset %square* } } alias square_stop { if ($2 == %Game_Password) && (%gamesquare_stato == ON) { if $exists(squareclass.txt) { .remove squareclass.txt } if $exists(squaremanche.txt) { .remove squaremanche.txt } .timer* off msg %chan_square           0,2 Square Stoppato da $nick ! msg %chan_square           0,2 Il Vincitore θ 4 %square_1nick 0 con 4 %square_1pts 0 punti!!!  set %gamesquare_stato OFF unset %square* } } alias square_endofgame { if ($lines(squareclass.txt) > 3) && (%Square_target > 499) { set %x 1 while (%x <= $lines(squareclass.txt)) { set %Square_line $read -l %x squareclass.txt set %Square_nick $gettok(%Square_line,1,46) set %Square_pts $gettok(%Square_line,2,46) set %Square_media $calc(%Square_pts / %Square_manchenum) set %y 1 if (%Square_nick == `computer`) goto scstophere Square_gcs %Square_nick if (%trovato == 0) { while (%y <= 10) { set %Square_procline $read -l %y Squarerecord.txt set %Square_ptsentry $gettok(%Square_procline,2,35) if (%Square_media > %Square_ptsentry) { set %z %y set %Square_inline %Square_nick $+ $chr(35) $+ %Square_media msg %chan_square 11,2 %Square_nick 0 arriva alla posizione n° 4 %y 0 con la media di 4 %Square_media 0 punti. while (%z <= 10) { set %Square_temp $read -l %z Squarerecord.txt write -l %z Squarerecord.txt %Square_inline set %Square_inline %Square_temp inc %z } goto scstophere } inc %y } } if (%trovato == 1) { if (%Square_media <= %Square_ptsquery) goto scstophere write -dl %pos Squarerecord.txt while (%y <= %pos) { set %Square_procline $read -l %y Squarerecord.txt set %Square_ptsentry $gettok(%Square_procline,2,35) if (%Square_media > %Square_ptsentry) { set %Square_inline %Square_nick $+ $chr(35) $+ %Square_media msg %chan_square 11,2 %Square_nick 0 arriva alla posizione n° 4 %y 0 con la media di 4 %Square_media 0 punti. write -il %y Squarerecord.txt %Square_inline goto scstophere } inc %y } } :scstophere inc %x } } if $exists(squareclass.txt) { .remove squareclass.txt } if $exists(squaremanche.txt) { .remove squaremanche.txt } msg %chan_square           0,2 Square Terminato! msg %chan_square           0,2 Il Vincitore θ 4 %square_1nick 0 con 4 %square_1pts 0 punti!!!  set %gamesquare_stato OFF unset %square* } alias square_end_query { if (%gamesquare_stato == ON) || (%gamesquare_stato == PAUSE) { if ( $?!="Vuoi terminare il gioco? Esso verrΰ fermato alla fine della prossima manche o di quella in corso " == $true ) { square_stop } ; ; set %square_target -1 } ; } } alias square_pause { if (%gamesquare_stato == ON) || (%gamesquare_stato == PAUSE) { if (%square_manche == ON) { .msg $nick 4Attendi il termine della manche il corso } if (%square_manche == OFF) { if (%gamesquare_stato == PAUSE) { set %gamesquare_stato ON | msg %chan_square           7 Square -- Il gioco riprende! -- | .timernew 1 30 square_hub | halt } if (%gamesquare_stato == ON) { set %gamesquare_stato PAUSE | msg %chan_square           7 Square -- Gioco in pausa -- | halt } } } } on 1:notice:squarepausa*:?: { if ($2 == %Game_Password) { if (%gamesquare_stato == ON) || (%gamesquare_stato == PAUSE) { if (%square_manche == ON) { .msg $nick 4Attendi il termine della manche il corso } if (%square_manche == OFF) { if (%gamesquare_stato == PAUSE) { set %gamesquare_stato ON | msg %chan_square           7 Square -- Il gioco riprende! -- | .timernew 1 30 square_hub | halt } if (%gamesquare_stato == ON) { set %gamesquare_stato PAUSE | msg %chan_square           7 Square -- Gioco in pausa -- | halt } } } } } alias square_help { if ( %gamesquare_stato != OFF) && (%square_antiflood != ON) { set %square_antiflood ON .timer1 1 1 .msg $1 0.2 Square - Modalitΰ di gioco  .timer2 1 2 .msg $1 9 “““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““ .timer3 1 3 .msg $1  Ad ogni manche viene fornito uno schema 5x5 di lettere. Devi formare piω parole possibile con le .timer4 1 4 .msg $1  lettere dello schema partendo da una lettera qualunque, spostandosi su caselle adiacenti [ anche .timer5 1 5 .msg $1  in diagonale ] e non passando 2 volte sulla stessa casella nell'ambito della stessa parola. Scrivi .timer6 1 6 .msg $1  queste parole ad una ad una in query a)  $me . Alla fine della manche vengono calcolati i punteggi .timer7 1 7 .msg $1  in base ai valori delle lettere. Le lettere colorate valgono come bonus: .timer8 1 8 .msg $1  9[x2] 8[x3] 4[x4]  sul valore della lettera. .timer9 1 9 .msg $1 9 ““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““ .timer10 1 10 set %square_antiflood OFF } } alias square_instr { if ( %gamesquare_stato != OFF ) && (%square_antiflood != ON) { set %square_antiflood ON .timer1 1 1 .msg $1 0.2 Square - Modalitΰ di gioco  .timer2 1 2 .msg $1 9 “““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““ .timer3 1 3 .msg $1  Ad ogni manche viene fornito uno schema 5x5 di lettere. Devi formare piω parole possibile con le .timer4 1 4 .msg $1  lettere dello schema partendo da una lettera qualunque, spostandosi su caselle adiacenti [ anche .timer5 1 5 .msg $1  in diagonale ] e non passando 2 volte sulla stessa casella nell'ambito della stessa parola. Scrivi .timer6 1 6 .msg $1  queste parole ad una ad una in query a)  $me . Alla fine della manche vengono calcolati i punteggi .timer7 1 7 .msg $1  in base ai valori delle lettere. Le lettere colorate valgono come bonus: .timer8 1 8 .msg $1  9[x2] 8[x3] 4[x4]  sul valore della lettera. .timer9 1 9 .msg $1 9 ““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““““ .timer10 1 10 set %square_antiflood OFF } } on 1:notice:squarehelp*:?:{ if ($2 == %Game_Password) && (%gamesquare_stato == ON) square_instr } alias Square_gcs { set %i 1 set %trovato 0 while ( ( %i <= 10 ) && ( %trovato == 0 ) ) { %riga = $read -l %i Squarerecord.txt %nome = $gettok(%riga,1,35) %Square_ptsquery = $gettok(%riga,2,35) if ( %nome == $1 ) { set %trovato 1 set %pos %i } inc %i 1 } } alias square_search { %lineefile = $lines(squareclass.txt) set %i 1 set %trovato 0 while ( ( %i <= %lineefile ) && ( %trovato == 0 ) ) { %riga = $read -l %i squareclass.txt %nome = $gettok(%riga,1,46) %square_ptsquery = $gettok(%riga,2,46) if ( %nome == $1 ) { set %trovato 1 set %pos %i } inc %i 1 } } alias square_manchesearch { %lineefile = $lines(squaremanche.txt) set %i 1 set %trovato 0 while ( ( %i <= %lineefile ) && ( %trovato == 0 ) ) { %riga = $read -l %i squaremanche.txt %nome = $gettok(%riga,1,46) if ( %nome == $1 ) { set %trovato 1 set %pos %i } inc %i 1 } } alias square_ordina { set %square_nltxt $lines(squareclass.txt) set %p 1 while (%p < %square_nltxt) { set %x 1 while (%x < %square_nltxt) { set %y $calc(%x + 1 ) set %square_upper $read -l %x squareclass.txt set %square_lower $read -l %y squareclass.txt set %square_uppt $gettok(%square_upper,2,46) set %square_lowpt $gettok(%square_lower,2,46) if (%square_uppt < %square_lowpt) { write -l %x squareclass.txt %square_lower write -l %y squareclass.txt %square_upper } inc %x } inc %p } square_ordina_rovescio } alias square_ordina_rovescio { set %square_nltxt $lines(squaremanche.txt) set %p 1 while (%p < %square_nltxt) { set %x 1 while (%x < %square_nltxt) { set %y $calc(%x + 1 ) set %square_upper $read -l %x squaremanche.txt set %square_lower $read -l %y squaremanche.txt set %square_uppt $gettok(%square_upper,3,46) set %square_lowpt $gettok(%square_lower,3,46) if (%square_uppt > %square_lowpt) { write -l %x squaremanche.txt %square_lower write -l %y squaremanche.txt %square_upper } inc %x } inc %p } } alias square_start_manche { if (%gamesquare_stato == ON) { inc %square_manchenum set %square_hub OFF set %square_limite $rand(3,5) set %z 1 unset %square_grid_line* unset %square_mult_* while (%z <= 25) { customrandom set %square_grid_ [ $+ [ %z ] ] %square_rndlet if (%square_rndflag == 1) || (%square_rndflag == 31) set %square_mult_ [ $+ [ %z ] ] 2 if (%square_rndflag == 2) || (%square_rndflag == 32) set %square_mult_ [ $+ [ %z ] ] 3 if (%square_rndflag == 3) set %square_mult_ [ $+ [ %z ] ] 4 inc %z } set %z 1 while (%z <= 5) { set %y 1 while (%y <= 5) { set %w $calc(%z -1) set %square_gridpos $calc(%w * 5 + %y) if (%square_mult_ [ $+ [ %square_gridpos ] ] == $null) set %square_grid_line [ $+ [ %z ] ] %square_grid_line [ $+ [ %z ] ] $+ 0,2 %square_grid_ [ $+ [ %square_gridpos ] ] if (%square_mult_ [ $+ [ %square_gridpos ] ] == 2) set %square_grid_line [ $+ [ %z ] ] %square_grid_line [ $+ [ %z ] ] $+ 9,2 %square_grid_ [ $+ [ %square_gridpos ] ] if (%square_mult_ [ $+ [ %square_gridpos ] ] == 3) set %square_grid_line [ $+ [ %z ] ] %square_grid_line [ $+ [ %z ] ] $+ 8,2 %square_grid_ [ $+ [ %square_gridpos ] ] if (%square_mult_ [ $+ [ %square_gridpos ] ] == 4) set %square_grid_line [ $+ [ %z ] ] %square_grid_line [ $+ [ %z ] ] $+ 4,2 %square_grid_ [ $+ [ %square_gridpos ] ] inc %y } inc %z } set %copy_stato ON .timer21 1 1 msg %chan_square 0,2 Square Manche n° 4 %square_manchenum  .timer22 1 2 msg %chan_square  %square_grid_line1 .timer23 1 2 msg %chan_square  %square_grid_line2 .timer24 1 2 msg %chan_square  %square_grid_line3 .timer25 1 2 msg %chan_square  %square_grid_line4 .timer26 1 2 msg %chan_square  %square_grid_line5 .timer27 1 3 msg %chan_square 0,2 Lunghezza minima parole: 4 %square_limite 0 lettere. 9[x2] 8[x3] 4[x4]  .timer28 1 4 msg %chan_square 0,2 Scrivi le parole in query a 4 $me 0,2 - Digita 4!copy0,2 anche in query per copiarti la griglia in query  .timer29 1 5 msg %chan_square 0,2 E...... VIA! 4 %square_durata 0 secondi da ORA!  .timer30 1 3 set %square_manche ON .timer31 1 %square_durata { square_alert } } } alias customrandom { set %square_rnd $rand(1,31) if (%square_rnd == 1) set %square_rndlet A if (%square_rnd == 2) set %square_rndlet A if (%square_rnd == 3) set %square_rndlet A if (%square_rnd == 4) set %square_rndlet E if (%square_rnd == 5) set %square_rndlet E if (%square_rnd == 6) set %square_rndlet E if (%square_rnd == 7) set %square_rndlet I if (%square_rnd == 8) set %square_rndlet I if (%square_rnd == 9) set %square_rndlet I if (%square_rnd == 10) set %square_rndlet O if (%square_rnd == 11) set %square_rndlet O if (%square_rnd == 12) set %square_rndlet O if (%square_rnd == 13) set %square_rndlet U if (%square_rnd == 14) set %square_rndlet U if (%square_rnd == 15) set %square_rndlet B if (%square_rnd == 16) set %square_rndlet C if (%square_rnd == 17) set %square_rndlet D if (%square_rnd == 18) set %square_rndlet F if (%square_rnd == 19) set %square_rndlet G if (%square_rnd == 20) set %square_rndlet H if (%square_rnd == 21) set %square_rndlet L if (%square_rnd == 22) set %square_rndlet M if (%square_rnd == 23) set %square_rndlet N if (%square_rnd == 24) set %square_rndlet P if (%square_rnd == 25) set %square_rndlet Q if (%square_rnd == 26) set %square_rndlet R if (%square_rnd == 27) set %square_rndlet S if (%square_rnd == 28) set %square_rndlet T if (%square_rnd == 29) set %square_rndlet V if (%square_rnd == 30) set %square_rndlet Z if (%square_rnd == 31) { extrand } set %square_rndflag $rand(1,70) } alias extrand { set %square_rndext $rand(1,5) if (%square_rndext == 1) set %square_rndlet J if (%square_rndext == 2) set %square_rndlet K if (%square_rndext == 3) set %square_rndlet X if (%square_rndext == 4) set %square_rndlet Y if (%square_rndext == 5) set %square_rndlet W } alias square_alert { msg %chan_square 6 Forzaaaa che sta per scadere il tempo!!! 8 10 6 secondi! .timerend 1 10 square_endofmanche } alias square_endofmanche { set %square_manche OFF msg %chan_square 4 TEMPO SCADUTO! Vediamo cosa avete tirato fuori Oo square_elabora close -m set %square_timercount 1 set %square_fatto 0 set %square_ntim $calc($lines(squaremanche.txt) + 2) .timermsg %square_ntim 2 square_resmsg } alias square_elabora { set %z 1 set %square_maxlen 0 while ( %z <= $lines(squaremanche.txt) ) { set %square_finale 0 unset %square_depwordstok set %square_elline $read -l %z squaremanche.txt set %square_wordstoken $gettok(%square_elline,2,46) set %square_wordstokenlen $numtok(%square_wordstoken,32) set %w 1 while (%w <= %square_wordstokenlen) { set %square_processedword $gettok(%square_wordstoken,%w,32) square_verifica %square_processedword if (%found == 1) { set %square_letpos 1 set %square_wordpoints 0 unset %square_wordart set %square_pwl $len(%square_processedword) if (%square_pwl > %square_maxlen) set %square_maxlen %square_pwl while (%square_letpos <= %square_pwl) { set %square_gpp $gettok(%square_burned,%square_letpos,46) set %square_proclet $lower(%square_grid_ [ $+ [ %square_gpp ] ]) set %square_procletval $square_ptsxlet(%square_proclet) if (%square_mult_ [ $+ [ %square_gpp ] ] == 2) set %square_procletval $calc(%square_procletval * 2) if (%square_mult_ [ $+ [ %square_gpp ] ] == 3) set %square_procletval $calc(%square_procletval * 3) if (%square_mult_ [ $+ [ %square_gpp ] ] == 4) set %square_procletval $calc(%square_procletval * 4) inc %square_wordpoints %square_procletval if (%square_mult_ [ $+ [ %square_gpp ] ] == $null) { if ( $mid(%square_wordart,$pos(%square_wordart,,$pos(%square_wordart,,0)),3) ==  ) set %square_wordart %square_wordart $+ %square_proclet else set %square_wordart %square_wordart $+  $+ %square_proclet } if (%square_mult_ [ $+ [ %square_gpp ] ] == 2) set %square_wordart %square_wordart $+ 9 $+ %square_proclet if (%square_mult_ [ $+ [ %square_gpp ] ] == 3) set %square_wordart %square_wordart $+ 8 $+ %square_proclet if (%square_mult_ [ $+ [ %square_gpp ] ] == 4) set %square_wordart %square_wordart $+ 4 $+ %square_proclet inc %square_letpos } inc %square_finale %square_wordpoints if (%square_depwordstok == $null) set %square_depwordstok %square_wordart else { set %square_depwordstok $addtok(%square_depwordstok,%square_wordart,32) } } inc %w } if ($len(%square_depwordstok) > 0) { set %square_elline $puttok(%square_elline,%square_depwordstok,2,46) set %square_elline $puttok(%square_elline,%square_finale,3,46) write -l %z squaremanche.txt %square_elline } if ($len(%square_depwordstok) == 0) { write -dl %z squaremanche.txt | dec %z } inc %z } square_attr_bonus } alias square_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 square_verifica { set %i 1 set %found 0 unset %square_burned set %square_word $1 set %square_starlet $left(%square_word,1) while (%i <= 25) && (%found == 0) { if (%square_grid_ [ $+ [ %i ] ] == %square_starlet ) { set %square_burned %i set %square_depth 2 set %square_node_2 %i set %square_counter_2 1 :sd set %square_reflet $mid(%square_word,%square_depth,1) set %square_intorno_ [ $+ [ %square_depth ] ] $square_intorno(%square_node_ [ $+ [ %square_depth ] ]) :nsd if (%square_counter_ [ $+ [ %square_depth ] ] <= $numtok(%square_intorno_ [ $+ [ %square_depth ] ],46) ) { set %square_subint_ [ $+ [ %square_depth ] ] $gettok(%square_intorno_ [ $+ [ %square_depth ] ],%square_counter_ [ $+ [ %square_depth ] ],46) if (%square_grid_ [ $+ [ %square_subint_ [ $+ [ %square_depth ] ] ] ] == %square_reflet) && (%square_depth == $len(%square_word)) && ($istok(%square_burned,%square_subint_ [ $+ [ %square_depth ] ],46) == $false) { set %found 1 set %square_burned $addtok(%square_burned,%square_subint_ [ $+ [ %square_depth ] ],46) goto nc } if (%square_grid_ [ $+ [ %square_subint_ [ $+ [ %square_depth ] ] ] ] == %square_reflet) && (%square_depth != $len(%square_word)) && ($istok(%square_burned,%square_subint_ [ $+ [ %square_depth ] ],46) == $false) { set %square_burned $addtok(%square_burned,%square_subint_ [ $+ [ %square_depth ] ],46) inc %square_depth set %square_node_ [ $+ [ %square_depth ] ] %square_subint_ [ $+ [ $calc(%square_depth -1) ] ] set %square_counter_ [ $+ [ %square_depth ] ] 1 goto sd } if (%square_grid_ [ $+ [ %square_subint_ [ $+ [ %square_depth ] ] ] ] != %square_reflet) || ($istok(%square_burned,%square_subint_ [ $+ [ %square_depth ] ],46) == $true) { inc %square_counter_ [ $+ [ %square_depth ] ] goto nsd } } if (%square_counter_ [ $+ [ %square_depth ] ] > $numtok(%square_intorno_ [ $+ [ %square_depth ],46) ) { set %square_burned $remtok(%square_burned,%square_node_ [ $+ [ %square_depth ] ],1,46) dec %square_depth if (%square_depth == 1) goto nc inc %square_counter_ [ $+ [ %square_depth ] ] goto sd } } :nc inc %i } } alias square_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 square_attr_bonus { unset %square_maxnicks set %z 1 while (%z <= $lines(squaremanche.txt)) { set %square_elline $read -l %z squaremanche.txt set %square_wordstoken $gettok(%square_elline,2,46) set %square_wordstokenlen $numtok(%square_wordstoken,32) set %square_wordnick $gettok(%square_elline,1,46) set %w 1 while (%w <= %square_wordstokenlen) { set %square_processedword $gettok(%square_wordstoken,%w,32) set %square_processedword $remove(%square_processedword,,11,8,9,4,2,$chr(44)) if ($len(%square_processedword) == %square_maxlen) && ($istok(%square_maxnicks,%square_wordnick,32) == $false) { set %square_ptsnick $gettok(%square_elline,3,46) if (%square_maxnicks == $null) set %square_maxnicks %square_wordnick if (%square_maxnicks != $null) set %square_maxnicks $addtok(%square_maxnicks,%square_wordnick,32) inc %square_ptsnick 10 set %square_elline $puttok(%square_elline,%square_ptsnick,3,46) write -l %z squaremanche.txt %square_elline } inc %w } inc %z } square_agg_class } alias square_agg_class { set %z 1 while (%z <= $lines(squaremanche.txt)) { set %square_clline $read -l %z squaremanche.txt set %square_clnick $gettok(%square_clline,1,46) set %square_manchepts $gettok(%square_clline,3,46) square_search %square_clnick if (%trovato == 0) { set %square_input %square_clnick set %square_input $addtok(%square_clnick,%square_manchepts,46) write squareclass.txt %square_input } if (%trovato == 1) { set %square_input $read -l %pos squareclass.txt set %square_oldpts $gettok(%square_input,2,46) inc %square_oldpts %square_manchepts set %square_input $puttok(%square_input,%square_oldpts,2,46) write -l %pos squareclass.txt %square_input } inc %z } square_ordina } alias square_resmsg { if ($lines(squaremanche.txt) == $null ) || ($lines(squaremanche.txt) == 0) && (%square_fatto == 0) { msg %chan_square 1,8 Mwahahah ... Che scarsi! Nada de nada!  | set %square_fatto 1 } if (%square_timercount <= $lines(squaremanche.txt)) { set %linez $read -l %square_timercount squaremanche.txt set %nick $gettok(%linez,1,46) set %words $gettok(%linez,2,46) set %wscore $gettok(%linez,3,46) if (%words != $null) msg %chan_square 0,6 %nick  %words 0,2 guadagna 4 %wscore 0,2 punti  } if (%square_timercount == $calc($lines(squaremanche.txt) + 1)) { if ($lines(squaremanche.txt) > 0) msg %chan_square 8,2 BONUS 10 punti: 0Parola piω lunga a 7 %square_maxnicks  } if (%square_timercount == $calc($lines(squaremanche.txt) + 2)) { .timerpreclass 1 5 square_prepreclass } inc %square_timercount } alias Square_prepreclass { if $exists(Squaremanche.txt) { set %Square_pnrline $read -l $lines(Squaremanche.txt) Squaremanche.txt set %Square_pnrecord $gettok(%Square_pnrline,3,46) set %Square_pnrkeeper $gettok(%Square_pnrline,1,46) if (%Square_pnrecord > %Square_record) { msg %chan_square 0,2 Nuovo Record 4[ $+ %Square_pnrecord $+ ] 0 di punti in una manche. Togliendolo a  %Square_reckeeper (4[ $+ %Square_record $+ ])  set %Square_record %Square_pnrecord set %Square_reckeeper %Square_pnrkeeper set %Square_pnrline %Square_reckeeper $+ $chr(35) $+ %Square_record write -l 11 SquareRecord.txt %Square_pnrline } .remove Squaremanche.txt } .timerclass 1 5 Square_preclass } alias square_preclass { set %timercounter 1 .timerclass 7 2 square_msgclass } alias square_msgclass { if (%timercounter == 1) { msg %chan_square 0,6 Classifica dopo la Manche nr. %square_manchenum  } if (%timercounter == 2) { set %square_1line $read -l1 squareclass.txt set %square_1nick $gettok(%square_1line,1,46) set %square_1pts $gettok(%square_1line,2,46) if (%square_1pts == $null) { set %square_1pts - } msg %chan_square 0,2 N° 1 0,6 %square_1nick 0,2 %square_1pts  } if (%timercounter == 3) { set %square_2line $read -l2 squareclass.txt set %square_2nick $gettok(%square_2line,1,46) set %square_2pts $gettok(%square_2line,2,46) if (%square_2pts == $null) { set %square_2pts - } msg %chan_square 0,2 N° 2 0,6 %square_2nick 0,2 %square_2pts  } if (%timercounter == 4) { set %square_3line $read -l3 squareclass.txt set %square_3nick $gettok(%square_3line,1,46) set %square_3pts $gettok(%square_3line,2,46) if (%square_3pts == $null) { set %square_3pts - } msg %chan_square 0,2 N° 3 0,6 %square_3nick 0,2 %square_3pts  } if (%timercounter == 5) { set %square_4line $read -l4 squareclass.txt set %square_4nick $gettok(%square_4line,1,46) set %square_4pts $gettok(%square_4line,2,46) if (%square_4pts == $null) { set %square_4pts - } msg %chan_square 0,2 N° 4 0,6 %square_4nick 0,2 %square_4pts  } if (%timercounter == 6) { set %square_5line $read -l5 squareclass.txt set %square_5nick $gettok(%square_5line,1,46) set %square_5pts $gettok(%square_5line,2,46) if (%square_5pts == $null) { set %square_5pts - } msg %chan_square 0,2 N° 5 0,6 %square_5nick 0,2 %square_5pts  } if (%timercounter == 7) { .timerhub 1 %square_pausetime square_hub } inc %timercounter } alias square_hub { if ( (( %square_1pts > %square_2pts ) && ( %square_1pts >= %square_target )) || (!($exists(squareclass.txt)) && (%square_target == -1)) ) { square_endofgame } else { if (%gamesquare_stato == ON) { msg %chan_square           6 Attenti! Tra 5 secondi inizia la prossima manche! | .timernew 1 5 square_start_manche | set %square_hub ON } } } menu channel { - Giochi .Square ..Avvia:square_start ..Dialog ON:dialog -m squareGame squareGame ..Dialog OFF:dialog -x squareGame squareGame ..Pausa/riprendi:square_pause ..Stoppa:square_end_query ..Istruzioni:square_instr ..Setta Canale:square.canale - } alias square.canale { set %chan_square $?="Setta il canale per Square" } dialog SquareGame { title "Square Game" size -1 -1 239 336 option pixels box "Square 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 Square", 518, 1 106 240 30 } on 1:dialog:squareGame:sclick:501: { if (%square_manchenum == 0) && (%square_hub != ON) { square_hub } } on 1:dialog:squareGame:sclick:502: { square_pause } on 1:dialog:squareGame:sclick:503: { square_instr } on 1:dialog:squareGame:sclick:518: { if (%gamesquare_stato != OFF) { if (%square_manche == ON ) { msg %chan_square %square_grid_line1 msg %chan_square %square_grid_line2 msg %chan_square %square_grid_line3 msg %chan_square %square_grid_line4 msg %chan_square %square_grid_line5 } else { echo -a 4Nessuna manche in corso } } } on 1:notice:squaregrid*:?:{ if (%gamesquare_stato != OFF) && ($2 == %Game_Password) { if (%square_manche == ON ) { msg %chan_square %square_grid_line1 msg %chan_square %square_grid_line2 msg %chan_square %square_grid_line3 msg %chan_square %square_grid_line4 msg %chan_square %square_grid_line5 } else { .msg $nick 4Nessuna manche in corso } } } on 1:dialog:squareGame:sclick:504: { square_end_query } on 1:dialog:squareGame:sclick:513: { if (%gamesquare_stato != OFF) { if (%square_durata < 50) { echo -a 4Non puoi scendere sotto i  40  secondi else { dec %square_durata 10 msg %chan_square 4Il tempo a disposizione per ogni manche θ ora di  %square_durata  secondi } } } } on 1:dialog:squareGame:sclick:512: { if (%gamesquare_stato != OFF) { inc %square_durata 10 msg %chan_square 4Il tempo a disposizione per ogni manche θ ora di  %square_durata  secondi } } on 1:dialog:squareGame:sclick:516: { if (%gamesquare_stato != OFF) { if (%square_pausetime < 15) { echo -a 4Non puoi scendere sotto i  10  secondi } else { dec %square_pausetime 5 msg %chan_square 4L'attesa tra due manche θ ora di  %square_pausetime  secondi } } } on 1:dialog:squareGame:sclick:515: { if (%gamesquare_stato != OFF) { inc %square_pausetime 5 msg %chan_square 4L'attesa tra due manche θ ora di  %square_pausetime  secondi } } on 1:notice:squarem-10*:?: { if (%gamesquare_stato != OFF) && ($2 == %Game_Password) && (%square_target < 500) { if (%square_durata < 50) { .msg $nick 4Non puoi scendere sotto i  40  secondi } else { dec %square_durata 10 msg %chan_square 4Il tempo a disposizione per ogni manche θ ora di  %square_durata  secondi } } } on 1:notice:squarem+10*:?: { if (%gamesquare_stato != OFF) && ($2 == %Game_Password) && (%square_target < 500) { inc %square_durata 10 msg %chan_square Il tempo a disposizione per ogni manche θ ora di  %square_durata  secondi } } on 1:notice:squarep-5*:?:{ if (%gamesquare_stato != OFF) && ($2 == %Game_Password) { if (%square_pausetime < 15) { .msg $nick 4Non puoi scendere sotto i  10  secondi } else { dec %square_pausetime 5 msg %chan_square 4L'attesa tra due manche θ ora di  %square_pausetime  secondi } } } on 1:notice:squarep+5*:?:{ if (%gamesquare_stato != OFF) && ($2 == %Game_Password) { inc %square_pausetime 5 msg %chan_square 4L'attesa tra due manche θ ora di  %square_pausetime  secondi } } on 1:notice:squaretarget*:?:{ if (%gamesquare_stato != OFF) && ($3 == %Game_Password) && ($2 > 0) { set %square_target $2 msg %chan_square 4Il punteggio da raggiungere ora θ:  %square_target  } } on 1:text:!Squarehs:%chan_square:{ set %i 1 unset %hs while (%i <= 10) { set %line $read -l %i Squarerecord.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 Squarerecord.txt set %nick $gettok(%line,1,35) set %pts $gettok(%line,2,35) msg %chan_square 0,2 Square High Scores  msg %chan_square 0,2 Record punti in una manche: 4 %nick 8,2 $+ (4,2 %pts 8,2) msg %chan_square 0,2 Top Ten media punti: 4 %hs  }