Enigma Bot — File Browser

EnigmaBotv1.4 / EnigmaBotv1.4 / Enigma versione1_4 / numeromania.mrc

numeromania.mrc — 7.93 KB — Download this file

;=====numeromania=====
on *:TEXT:*:#: {
  if ($1 == -NumeroMania) {
    if (($2 == on) && (!%NMGame)) { set %NMChan %game_channel | NumeroMania on }
    if (($2 == off) && (%NMGame)) { NumeroMania off $nick }
  }
  if ($1 == -Punti) {
    if (!$2) { NMPunto %game_channel $nick }
    else { NMPunto %game_channel $2 }
  }
  if ($1 == -NMClassifica) { NMClassifica %game_channel }
  if ($1 == -IScrivi) { set %NMIscritti $addtok(%NMIscritti,$nick,32) | set %NMJolly $addtok(%NMIscritti,$nick,32) | msg %NMChan $NMLogo $nick iscritto al gioco. }
  if (($nick == %NMNick) && (!$2) && (%NMGame) && (%NMManche_FineTempo)) {
    if (($1 == jol) && (%NMNick isin %NMJolly)) {
      unset %NMManche_FineTempo 
      msg %NMChan $NMLogo $nick usa il JOLLY e resta in gioco!
      NMNewManche 
      set %NMJolly $remtok(%NMJolly,%NMNick,1,32) 
      .timerNMFineTempo $+ %NMNick off
    }
    if ((%NMType == 1) && ($1 isnum) && ($1 == $calc(%NMNumero))) { NMRispCorretta $nick $rand(4,5) $1 }
    if ((%NMType == 2) && ($1 isnum) && ($1 == $calc(%NMNumero))) { NMRispCorretta $nick $rand(4,5) $1 }
    if ((%NMType == 3) && ($1 isnum) && ($1 == $calc(%NMNumero))) { NMRispCorretta $nick $rand(4,5) $1 }
    if ((%NMType == 4) && ($1 isnum) && ($1 == $calc(%NMNumero))) { NMRispCorretta $nick $rand(4,5) $1 }
  }
}

alias NMRispCorretta {
  unset %NMManche_FineTempo
  NMAddPunti $1 $2
  .timerNMFineTempo $+ %NMNick off
  msg %NMChan $NMLogo Complimenti $nick $+ ! Hai dato la risposta corretta $chr(40) $+  $+ $3 $+  $+ $chr(41) in $calc(($ticks - %NMTicks) / 1000) secondi.
  NMNewManche
}

alias NMGetPunti { 
  var %f 1
  while (%f <= $lines($NMPunti)) {
    if ($gettok($read($NMPunti,%f),1,61) == $1) { return $gettok($read($NMPunti,%f),2,61) | halt }
    inc %f
  }
}
alias NMNewManche { msg %NMChan $NMLogo Tra 10 secondi la prossima manche. | .timerNMManche 1 10 { NMManche } }
alias NMPunto {
  if ($NMGetPunti($2)) { msg $1 $NMLogo $2 $+ $chr(44) il tuo punteggio è di  $+ $NMGetPunti($2) $+  punti. }
  else { msg $1 $NMLogo Nessun punteggio corrispondente al nick $2 . }
}
alias NMLogo { return 9,1 ©º°¨8,1 NuMeRo MaNia9,1 ¨°º©0 }
alias NMPunti { return Punti_NumeroMania.txt }
alias NMTicks { return Ticks_NumeroMania.ini }
alias NMClass { return Classifica_NumeroMania.txt }
alias NMAddPunti {
  var %NMPuntiB_ $+ $1 $NMGetPunti($1)
  var %x 1
  while (%x <= $lines($NMPunti)) {
    if ($gettok($read($NMPunti,%x),1,61) == $1) { write -dl $+ %x $NMPunti }
    inc %x
  }
  write $NMPunti $1 $+ $chr(61) $+ $calc($2 + %NMPuntiB_ $+ $1)
}

alias NumeroMania {
  if ($1 == on) {
    set %NMGame on
    notice %NMChan $NMLogo Gioco ATTIVATO. Partecipa anche tu!!!
    msg %NMChan $NMLogo Il gioco sta per partire.
    msg %NMChan $NMLogo Iscriviti al gioco entro 40 secondi scrivendo: -Iscrivi
    .timerNMManche 1 40 { NMTimerOff }
  }
  if ($1 == off) {
    msg %NMChan $NMLogo Gioco stoppato da $2 $+ .
    unset %NM*
    .timerNM* off
    .remove $NMTicks
    .remove $NMClass
  }
}

alias NMTimerOff {
  msg %NMChan $NMLogo Fine delle iscrizioni!!
  if ($numtok(%NMIscritti,32) >= 2) {
    var %NMCol 4 | var %NMCol2 7
    msg %NMChan $NMLogo %NMCol $+ Ci sono $+  $+ %NMCol2 $numtok(%NMIscritti,32) $+  %NMCol $+ persone iscritte al gioco:  $+ %NMCol2 $+ %NMIscritti
    .timerNMManche 1 1 { NMManche }
  }
  else { msg %NMChan $NMLogo Nessun utente iscritto al gioco. Il gioco verrà stoppato. | NumeroMania off $me )
  }
}

alias NMManche {
  unset %NMNumero
  set %NMNick $gettok(%NMIscritti,$rand(1,$numtok(%NMIscritti,32)),32)
  msg %NMChan $NMLogo Tocca a %NMNick $+ . $iif($istok(%NMJolly,%NMNick,32), Per usare il jolly scrivi:  $+ $rand(4,5) $+ jol) 
  set %NMType $rand(1,4)
  var %NMTime $rand(30,45)
  if (%NMType == 1) {
    ;CALCOLO
    var %NMTime $calc(%NMTime + 5)
    var %NMOperazioni + -
    :renumera
    set %NMNumero $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100)
    if ($left($calc(%NMNumero),1) == $chr(45)) { goto renumera }
    msg %NMChan $NMLogo Hai %NMTime secondi per calcolare il risultato della seguente operazione:  $+ %NMNumero $+ 
  }
  if (%NMType == 2) {
    ;CALCOLO
    var %NMTime $calc(%NMTime + 5)
    var %NMOperazioni + -
    :renumera
    set %NMNumero $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100)
    if ($left($calc(%NMNumero),1) == $chr(45)) { goto renumera }
    msg %NMChan $NMLogo Hai %NMTime secondi per calcolare il risultato della seguente operazione:  $+ %NMNumero $+ 
  }
  if (%NMType == 3) {
    ;CALCOLO
    var %NMTime $calc(%NMTime + 5)
    var %NMOperazioni + -
    :renumera
    set %NMNumero $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100) $gettok(%NMOperazioni,$rand(1,2),32) $rand(0,100)
    if ($left($calc(%NMNumero),1) == $chr(45)) { goto renumera }
    msg %NMChan $NMLogo Hai %NMTime secondi per calcolare il risultato della seguente operazione:  $+ %NMNumero $+ 
  }
  if (%NMType == 4) {
    ;CALCOLO
    var %NMTime $calc(%NMTime + 5)
    var %NMOperazioni *
    :renumera
    set %NMNumero $rand(0,20) $gettok(%NMOperazioni,1,32) $rand(0,20) $gettok(%NMOperazioni,1,32) $rand(0,20)
    if ($left($calc(%NMNumero),1) == $chr(45)) { goto renumera }
    msg %NMChan $NMLogo Hai %NMTime secondi per calcolare il risultato della seguente operazione:  $+ $replace(%NMNumero, *, x) $+ 
  }
  set %NMTicks $ticks
  set %NMManche_FineTempo Si
  .timerNMFineTempo $+ %NMNick 1 %NMTime { NMFineTempo %NMType %NMNick }
}

alias NMFineTempo {
  if (%NMManche_FineTempo) {
    unset %NMManche_FineTempo
    set %NMIscritti $remtok(%NMIscritti,$2,1,32) | set %NMJolly $remtok(%NMJolly,$2,1,32)
    msg %NMChan $NMLogo TEMPO SCADUTO!! $2 sei fuori gioco!!
    if ($1 == 1) { notice %NMNick $NMLogo Il risultato era: $+  $+ $calc(%NMNumero) }
    if ($1 == 2) { notice %NMNick $NMLogo Il risultato era: $+  $+ $calc(%NMNumero) }
    if ($1 == 3) { notice %NMNick $NMLogo Il risultato era: $+  $+ $calc(%NMNumero) }
    if ($numtok(%NMIscritti,32) > 1) { NMNewManche }
    else { 
      msg %NMChan $NMLogo PARTITA CONCLUSA!!
      var %NMCol 4
      msg %NMChan $NMLogo %NMCol $+ Il vincitore di questa partita è: $+  $+ %NMIscritti $+  %NMCol $+ con un totale di $+  $NMGetPunti(%NMIscritti) $+  %NMCo punti.
      unset %NM*
      .timerNM* off
      .remove $NMTicks
      .remove $NMClass
    }
  }
}

alias NMClassifica {
  write -c $NMClass 
  write $NMClass none=0 | write $NMClass none=0 | write $NMClass none=0 | write $NMClass none=0 | write $NMClass none=0
  var %t 1
  while (%t <= $lines($NMPunti)) {
    if ($gettok($read($NMPunti,%t),2,61) > $gettok($read($NMClass,2),2,61)) { write -l2 $NMClass $read($NMPunti,%t) }
    inc %t
  }
  msg $1 $NMLogo Ecco la classifica generale della Numero M4n14:
  var %o 1
  while (%o <= 5) {
    .timerNMClass $+ %o 1 $calc(%o + %o) msg $1 %o $+ ) $gettok($read($NMClass,%o),1,61) con $gettok($read($NMClass,%o),2,61) punti
    inc %o
  }
}
on *:NICK: {
  if ($nick isin %NMIscritti) { set %NMIscritti $reptok(%NMIscritti,$nick,$newnick,1,32) } 
  if ($nick isin %NMJolly) { set %NMJolly $reptok(%NMJolly,$nick,$newnick,1,32) }
}

;if ((%NMType == 5) && ($1 isnum) && ($1 == $calc(%NMNumero))) { NMRispCorretta $nick $rand(4,5) $1 }
;if (%NMType == 5) {
;CALCOLO
var %NMTime $calc(%NMTime + 5)
var %NMOperazioni + - *
:renumera
set %NMNumero $rand(0,25) $gettok(%NMOperazioni,$rand(1,3),32) $rand(0,25) $gettok(%NMOperazioni,$rand(1,3),32) $rand(0,25)
if ($left($calc(%NMNumero),1) == $chr(45)) { goto renumera }
msg %NMChan $NMLogo Hai %NMTime secondi per calcolare il risultato della seguente operazione:  $+ $replace(%NMNumero, *, x) $+ 
}