Enigma Bot — File Browser

EnigmaBotv1.4 / EnigmaBotv1.4 / Enigma versione1_4 / trivia_kaos.mrc

trivia_kaos.mrc — 5.29 KB — Download this file

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(10,20) $+ 000
  set %Kaos.numero.risposte $numtok(%kaos.risposte,149)
  set %kaos.mancanti Kaos.numero.risposte
  var %kaos.punti = $calc(%kaos.valore * %Kaos.numero.risposte)
  .timer_kaos_domanda -m 1 100 msg %game_channel  $+ %c1 —[ %trivia.qn $+  $+ %c1 ]—0,4IL DOMANDONE:0,3 %kaos.domanda - $trivtalk9(Valore domanda:) 4 %kaos.punti  $trivtalk11(punti)
  .timer_kaos_domanda-a 1 1 msg %game_channel $trivtalk(Risposte possibili: N°) $+ %Kaos.numero.risposte $+ , $trivtalk9(Valore Per Risposta)4 %kaos.valore  $trivtalk11(punti)
  .timer_kaos_private -m 1 1250 echo -a 4 $replace(%kaos.rimanenti,$chr(149),$chr(32) $+ $chr(45) $+ $chr(32)) 
  .timer_kaos_aiuto -m 1 1500 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 11risposte $chr(91) $replace(%Kaos.h0,$chr(149),$chr(32) $+ $chr(93) $+ $chr(91) $+ $chr(32)) $chr(93)
    .timer_kaos-aiuto 1 %tempoaiuto khint1
  }
}

alias khint1 {
  set %kaos.valore $int($calc((%kaos.valore)/2))
  set %Kaos.h1 $aiutokaos-a() {
    msg %game_channel 9 1° aiuto $chr(91) $replace(%Kaos.h1,$chr(149),$chr(32) $+ $chr(93) $+ $chr(91) $+ $chr(32)) $chr(93) 14 & 7 %kaos.valore punti 
    .timer_kaos-aiuto 1 %tempoaiuto khint2
  }
}

alias khint2 {
  set %kaos.valore $int($calc((%kaos.valore)/2))
  set %Kaos.h2 $aiutokaos-b() {
    msg %game_channel 11 2° aiuto $chr(91) $replace(%Kaos.h2,$chr(149),$chr(32) $+ $chr(93) $+ $chr(91) $+ $chr(32)) $chr(93) 14 & 7 %kaos.valore punti
    .timer_kaos-aiuto 1 %tempoaiuto khint3
  }
}

alias khint3 {
  set %kaos.valore $int($calc((%kaos.valore)/2))
  set %Kaos.h3 $aiutokaos-c() {
    msg %game_channel 9 3° aiuto $chr(91) $replace(%Kaos.h3,$chr(149),$chr(32) $+ $chr(93) $+ $chr(91) $+ $chr(32)) $chr(93) 14 & 7 %kaos.valore punti
    .timer_kaos-aiuto 1 $calc(%tempoaiuto + 1) nessuna_risposta
  }
}

on *:TEXT:*:%game_channel: { 
  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 11 $nick  $trivtalk(hai dato una risposta esatta)  %estrai.parola  $trivtalk(per un valore di) 4 %kaos.valore
    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)) {
    .timer_kaos-end 1 1 msg %game_channel $trivtalk9(Le risposte mancanti erano:) 7 $replace(%kaos.rimanenti,$chr(149),$chr(32) $+ $chr(45) $+ $chr(32)) 
    .timer_kaos-end2 -m 1 1500 msg %game_channel $trivtalk9(Punti assegnati:) %Kaos.punti.assegnati
  }
  else {
    .timer_kaos-end -m 1 1 msg %game_channel $trivtalk9(nessuna risposta trovata, che Skiappe)
    .timer_kaos-end 1 1 msg %game_channel $trivtalk9(Le risposte mancanti erano:) 7 $replace(%kaos.rimanenti,$chr(149),$chr(32) $+ $chr(45) $+ $chr(32)) 
  }
  unset %Kaos*
  inc %trivia.qn
  .timer_kaos-trivia 1 %tempodomanda trivia.next
}

alias Kaos.trovate.tutte {
  if (%Kaos.risposte.trovate == %Kaos.numero.risposte) {
    .timer_kaos-aiuto off
    .timer_kaos-trovate 1 1 msg %game_channel $trivtalk9(complimenti trovate tutte le risposte per un valore di) %Kaos.punti.assegnati
    .timer_kaos-trivia 1 %tempodomanda trivia.next
    inc %trivia.qn
    unset %Kaos*
    .timer_kaos-end* off
  }
}