baloe12nl commented on a Page, Make your bot Talk  -  Dec 24, 2013

J youse this code for my chatterbot.

On *:load: {
  /echo 5 -ag Loaded chatterbot script $+(v,1.0) $+ ! By Baloe12nl.
  if ( !$readini( scripts/kletsen.ini, Hallo, antw1 ) ) {
    /writeini scripts/kletsen.ini Hallo antw1 Hai to you to
  }
  if ( %timerkls == $null ) { /set %timerkls 0 | /echo 5 -ag timerkls is loaded and set to 0. }
  if ( %antkls == $null ) { /set %antkls 1 | /echo 5 -ag antls is loaded and set to 1. }
  if ( %antkls.rand == $null ) { /set %antkls.rand 1 | /echo 5 -ag antkls.rand is loaded and set to 1. }
  /echo 5 -ag to use, type: !talk < on / off / disable >
}

on *:TEXT:*talk*:*: {
  if ($1 == !talk) {
    if ($2 == on) { /enable #talks | /disable #Ctalks | /msg $chan 5De Talk Mode Is on, | set %st.talks on | set %last.used.command talks on | set %last.persons1 $nick | halt }
    if ($2 == off) { /disable #talks | /enable #Ctalks | /msg $chan 5De Talk Mode Is off. | unset %st.talks | set %last.used.command talks off | set %last.persons1 $nick | halt }
    if ($2 == disable) { /disable #talks | /disable #Ctalks | /msg $chan 5De Talk Mode Is off. | /msg $chan 5De teatch Mode Is off. | unset %st.talks | set %last.used.command talks off | set %last.persons1 $nick | halt }
    if ($2 == help) { /notice $nick 5< 10!talk on 5> zet de chatterbot op speake mode | /notice $nick 5< 10!talk off 5> Zet de speake mode of en de learn mode aan. | /notice $nick 5< 10!talk disable 5> Zet de learn en speake mode beide off. | /notice $nick 5< 10!talk help 5> Geeft hulp bij de chatterbot comando's. }
    else { /notice $nick 5Incorrect command usage: !talk <on/off/disable/help> | halt }
  }
  else { /halt }
}

; Here the read part and awnser on the chat
; Hier het gedeelte dat leest en antwoord op de chat

#talks off

on *:text:*:#: {
  /set %antkls.rand $rand(1, [ %nr ] )
  if ( $readini(scripts/kletsen.ini, $1 $+ $2 $+ $3 $+ $4, antw $+ 1 ) == $null ) { /halt }
  :1
  if ( $readini(scripts/kletsen.ini, $1 $+ $2 $+ $3 $+ $4, antw $+ %antkls.rand ) == $null ) { /dec %antkls.rand 1 | goto 1 }
  else { /msg # $readini(scripts/kletsen.ini, $1 $+ $2 $+ $3 $+ $4, antw $+ %antkls.rand ) }
}

#talks end

; Here the write part to ini
; hier gedeelte dat het moet schrijven naar ini

#Ctalks on

on *:text:*:#: {
  if ( %timerkls <= 0) { /set %nick $nick | /set %nick1 $1 $+ $2 $+ $3 $+ $4 | /set %timerkls 360 | /dec -c %timerkls 1 | /halt }
  if ( %timerkls >= 1 ) { 
    if ( $nick == %nick ) /halt
    if ( $nick == chatbot ) /halt ;Hier de naam van je chatbot op <chatbot> ; Here the name of your Bot on < chatbot >
    else {
      /set %antkls 1
      /set %timerkls 0
      if ( $readini( scripts/kletsen.ini, %nick1 $+ , antw $+ %antkls ) != $null ) { 
        :2
        if ( $1- isin $readini( scripts/kletsen.ini, %nick1 $+ , antw $+ %antkls ) ) {
          /set %timerkls 0 
          /unset %nick
          /halt
        }
        if ( %antkls > %nr ) /set %nr %antkls
        if ( $readini( scripts/kletsen.ini, %nick1 $+ , antw $+ %antkls ) != $null ) { 
          /inc %antkls 1
          goto 2
        }
        else { 
          /writeini -n scripts/kletsen.ini %nick1 antw $+ %antkls $1- 
          /set %timerkls 0 
          /unset %nick
          ;          /save scripts/kletsen.ini
          /load -rs scripts/kletsen.ini
          /halt
        }
      }
      else { 
        /writeini -n scripts/kletsen.ini %nick1 antw $+ %antkls $1- 
        /set %timerkls 0 
        /unset %nick
        ;       /save scripts/kletsen.ini
        /load -rs scripts/kletsen.ini
        /halt
      }
    }
  }
}

#Ctalks end
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.