xTrivia — File Browser

xTriviav1.0 / xTriviav1.0 / xTriviaByRibellina / xtrivia / bot / trivia_kaos.mrc

trivia_kaos.mrc — 5.19 KB — Download this file

;============Kaos=============;

alias kaos { 
  var %kaos.random = $rand(1,$lines(kaoss.txt)) 
  var %kaos.linea = $read(kaoss.txt, %kaos.random)
  var %kaos.domanda = $gettok($read(kaoss.txt,%kaos.random),1,42)
  var %kaos.risp = $gettok($read(kaoss.txt,%kaos.random),2-,42)
  set %kaos.risposte $replace($gettok(%kaos.risp,1-,42),$chr(42),$chr(149)) 
  set %kaos.rimanenti %kaos.risposte
  set %kaos.valore $rand(20,30)
  set %Kaos.numero.risposte $numtok(%kaos.risposte,149)
  set %kaos.mancanti Kaos.numero.risposte
  var %kaos.punti = $calc(%kaos.valore * %Kaos.numero.risposte)
  set %kaosp ON
  .timerkaos_domanda -m 1 100 msg %game_channel 01,07 KAOS  %kaos.domanda
  .timerkaos_domanda-a 1 1 msg %game_channel $xtalk(Risposte Possibili:) 07 $+ $U(%Kaos.numero.risposte) $xtalk(ogni risposta vale:) 07 $+ $U(%kaos.valore) $xtalk(Punti!)
  .timerkaos_private -m 1 1250 echo %game_channel 06 $replace(%kaos.rimanenti,$chr(149),$chr(32) $+ $chr(45) $+ $chr(32)) 
  .timerkaos_aiuto 1 %tempoaiuto khint0
}

alias aiutokaos {
  var %numero.rimanenti = $numtok(%Kaos.rimanenti,149)
  var %indice = 1
  while (%indice <= %numero.rimanenti) {
    var %c, %d = $regsub(%Kaos.rimanenti,/([a-zA-Z0-9])/ig,*,%c) 
    return %c 
    inc %indice
  }
}

alias aiutokaos-a {
  var %numero.rimanenti = $numtok(%Kaos.rimanenti,149)
  var %indice = 1
  while (%indice <= %numero.rimanenti) {
    var %c, %d = $regsub(%Kaos.rimanenti,/([aeioucdghklmprsvwyzAEIOUCDGHKLMPRSVWYZ0-35-8])/ig,*,%c) 
    return %c 
    inc %indice
  }
}

alias aiutokaos-b {
  var %numero.rimanenti = $numtok(%Kaos.rimanenti,149)
  var %indice = 1
  while (%indice <= %numero.rimanenti) {
    var %c, %d = $regsub(%Kaos.rimanenti,/([aeioudhlpswzAEIOUDHLPSWZ125-7])/ig,*,%c) 
    return %c 
    inc %indice
  }
}

alias aiutokaos-c {
  var %numero.rimanenti = $numtok(%Kaos.rimanenti,149)
  var %indice = 1
  while (%indice <= %numero.rimanenti) {
    var %c, %d = $regsub(%Kaos.rimanenti,/([aeouAEU257])/ig,*,%c) 
    return %c 
    inc %indice
  }
}
alias khint0 {
  set %Kaos.h0 $aiutokaos() {
    msg %game_channel $xtalk(Indizio:)  $+ 07[ $replace(%Kaos.h0,$chr(149),$chr(32) 7] [ $chr(32)) 07]
    .timerkaos-aiuto1 1 %tempoaiuto khint1
  }
}

alias khint1 {
  set %kaos.valore $int($calc((%kaos.valore)-5))
  set %Kaos.h1 $aiutokaos-a() {
    msg %game_channel $xtalk(1° Aiuto:)  $+ 07[ $replace(%Kaos.h1,$chr(149),$chr(32) 7] [ $chr(32)) 7]  $+ $xtalk(Si Scende a:) 07 $+ %kaos.valore  $+ $xtalk(Punti!)
    .timerkaos-aiuto2 1 %tempoaiuto khint2
  }
}

alias khint2 {
  set %kaos.valore $int($calc((%kaos.valore)-5))
  set %Kaos.h2 $aiutokaos-b() {
    msg %game_channel $xtalk(2° Aiuto:)  $+ 07[ $replace(%Kaos.h2,$chr(149),$chr(32) 7] [ $chr(32)) 7]  $+ $xtalk(Si Scende a:) 07 $+ %kaos.valore  $+ $xtalk(Punti!)
    .timerkaos-aiuto3 1 %tempoaiuto khint3
  }
}

alias khint3 {
  set %kaos.valore $int($calc((%kaos.valore)-5))
  set %Kaos.h3 $aiutokaos-c() {
    msg %game_channel $xtalk(3° Aiuto:)  $+ 07[ $replace(%Kaos.h3,$chr(149),$chr(32) 7] [ $chr(32)) 7]  $+ $xtalk(Si Scende a:) 07 $+ %kaos.valore  $+ $xtalk(Punti!)
    .timerkaos-aiuto4 1 $calc(%tempoaiuto + 1) nessuna_risposta
  }
}

on *:TEXT:*:%game_channel: { 
  if (%kaosp == ON) {
    if ($istok(%Kaos.rimanenti,$1-,149)) {
      var %cerca.parola = $findtok(%Kaos.rimanenti,$1-,149)
      var %estrai.parola = $gettok(%Kaos.rimanenti,%cerca.parola,149) 
      set %Kaos.rimanenti $deltok(%Kaos.rimanenti,%cerca.parola,149)
      msg %game_channel 07 $+ $nick $xtalk(Hai Dato Una Risposta Esatta:) 07 $+ %estrai.parola 
      var %temp = $calc($triv_read(scoresday, $nick) + %kaos.valore)
      triv_write scoresday $nick %temp
      var %temp = $calc($triv_read(Scoresweek, $nick) + %kaos.valore)
      triv_write scoresweek $nick %temp
      var %temp = $calc($triv_read(Scoresmonth, $nick) + %kaos.valore)
      triv_write scoresmonth $nick %temp
      var %temp = $calc($triv_read(Scoresall, $nick) + %kaos.valore)
      triv_write scoresall $nick %temp
      inc %Kaos.punti.assegnati %Kaos.valore 
      inc %Kaos.risposte.trovate
      dec %kaos.mancanti
      Kaos.trovate.tutte
    }
  } 
}
alias nessuna_risposta { 
  if ((%Kaos.risposte.trovate > 0) && (%Kaos.risposte.trovate < %Kaos.numero.risposte)) {
    .timerkaos-end1 1 1 msg %game_channel $xtalk(Risposte Non Date:)  $+ $replace(%kaos.rimanenti,$chr(149),$chr(32) $+ $chr(45) $+ $chr(32)) | set %Jackpunti $calc(%Jackpunti + 20)
    timerkaos-a* off
    set %kaosp off
  }
  else {
    .timerkaos-end2 -m 1 1 msg %game_channel $xtalk(Nessuna Risposta Trovata! Che Schiappe!) | triv_rem settings consecutive | triv_rem settings utonto | set %Jackpunti $calc(%Jackpunti + 35)
  }
  unset %Kaos*
  set %kaosp off
  avviatriviainfo
}

alias Kaos.trovate.tutte {
  if (%kaosp == ON) && (%Kaos.risposte.trovate == %Kaos.numero.risposte) {
    .timerkaos-aiut* off
    .timerkaos-trovate 1 1 msg %game_channel $xtalk(Bravi! Avete Trovato Tutte Le Risposte! Valore Punti Assegnati:) 7« $+ %Kaos.punti.assegnati $+ 7»
    unset %Kaos*
    .timerkaos-end* off
    set %kaosp off
    avviatriviainfo
  }
}