From: Harvie Date: Tue, 17 Jan 2012 03:34:06 +0000 (+0100) Subject: MegaHAL AI answerscript is now much more sophisticated (while still simple :-) X-Git-Url: http://git.harvie.cz/?p=mirrors%2Flibpurple-core-answerscripts.git;a=commitdiff_plain;h=a315ba6cac5179b7dd51c5efe4eeecf6503ae150 MegaHAL AI answerscript is now much more sophisticated (while still simple :-) --- diff --git a/purple/answerscripts.d/00-megahal.sh b/purple/answerscripts.d/00-megahal.sh index 940bb38..82c61f3 100755 --- a/purple/answerscripts.d/00-megahal.sh +++ b/purple/answerscripts.d/00-megahal.sh @@ -1,5 +1,10 @@ #!/bin/sh #Artificial Pseudo Inteligence using megahal package :-) #More info: http://megahal.alioth.debian.org/ -#alias cat=true #silent mode, comment out to enable loud replies :-) -echo -n '[MegaHAL]:' $({ echo "$ANSW_MSG" && echo -e '\n#quit\n'; } | megahal -p -b -w | tail -n1) | cat + +AI_LOUD=false #enable loud replies (otherwise will be learning only :-) +AI_LOUD_UNAVAILABLE=true; #enable loud replies when not available :-) + +$AI_LOUD_UNAVAILABLE && [ "$ANSW_L_STATUS" != 'available' ] && AI_LOUD=true +AI_ANSW="$({ echo "$ANSW_MSG" && echo -e '\n#quit\n'; } | timeout 23 megahal -p -b -w | tail -n1)" +$AI_LOUD && [ -n "$AI_ANSW" ] && echo -n "[MegaHALuz]: $AI_ANSW"