In the platform game which I play ( torpia) there are sometimes people who has questions concerning the game
to help them I'f made the FAQ snippet.
I did not finde 1 i like
You can use a ON:TEXT: 1, but the question need to by exact. Now it don't.
He now checked simply the words of the question and catch the question from text file with the moste words. He can be off some times, but get it for moste of the time
don't ferget to make 2 text files and put them in your txt folder
------------------------>> file name
faq_add.txt The questions here
faq_ant.txt The answers here
however, there will be better manners to make something like this,
But these work fore me. ;)
---------------------------->> control
!faq < question >
!cfaq for help
!sfaq < on / off >
06/01/2013 updat to code
If you can finde a problem in script, pleas comment.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; FAQ fot the chat ;
; to put FAQ on ore off !sfaq < on / off > ;
; for help FAQ and control !cfaq ;
; to use !faq < question > ;
; built by baloe1nl ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on 1600:TEXT:*sfaq*:*: {
if ($1 == !sfaq) {
if ($2 == on) { .enable #Cfaq | .enable #faqs | .msg $chan 5The FAQ Mode Is put on, To ask a question, typ !faq <question>. 4¬Operators Only¬: AUB Typ !cfaq for help maintenance FAQ. | set %st.faqs on | set %last.used.command faqs on | set %last.persons $nick | halt }
if ($2 == off) { .disable #Cfaq | .disable #faqs | .msg $chan 5The FAQ Mode Is put off. | unset %st.faqs | set %last.used.command faqs off | set %last.persons $nick | halt }
else { .notice $nick 5Incorrect command usage: !sfaq <on/off> | halt }
}
else { halt }
}
on 1600:TEXT:*cfaq*:*: {
if ($1 == !cfaq) { .msg $nick 4All comando's commando's to use. | .msg $nick 5 !add_faq 2<question> Add a question to database. | .msg $nick 5 !ant_faq 2<answer> Put the answer to database. | .msg $nick 5 !delete_faq 2<qusetion> Delet the question and answer out database. | .msg $nick 5 !aantal_faq 2read the number of questions and answers }
else { halt }
}
;begin scripting reading text
#faqs on
on *:text:!faq*:#: {
if ( $2 == $null) { .notice $nick 5Correcte way of use: !faq <question> | halt }
/set %faq_txt = !faq $$2-
/var %nr1 = 2
:5
if ( $ [ $+ [ %nr1 ] ] isin %faq_txt ) {
if ( $ [ $+ [ %nr1 ] ] isin $read(txt\faq_add.txt, w, * $+ [ $ [ $+ [ %nr1 ] $+ ] * ] )) /var %nr = $readn
if ( %nr != $null ) {
if ( $ [ $+ [ %nr1 ] $+ ] - isin $read(txt\faq_add.txt, %nr )) {
/notice $nick .
/notice $nick 2 $read(txt\faq_ant.txt, %nr )
/notice $nick .
/notice $nick 5Is your question answered?if not ask it again in a other way.
/unset %nr | /unset %nr1
goto endd
}
}
: 3
if ( %nr > $lines( txt\faq_add.txt )) goto 4
if ( %nr <= $lines( txt\faq_add.txt )) {
if ( $ [ $+ [ %nr1 ] ] isin $read( txt\faq_add.txt, %nr ) ) {
if ( %faq_nr. [ $+ [ %nr ] ] == $null ) {
/set %faq_nr. $+ [ %nr ] 1
/inc %nr 1
goto 3
}
elseif ( %faq_nr. [ $+ [ %nr ] ] != $null ) {
/inc %faq_nr. $+ [ %nr ] 1
/inc %nr 1
goto 3
}
}
else {
/inc %nr 1
goto 3
}
}
:4
/inc %nr1 1 | goto 5
}
else {
/unset %nr1 | /unset %nr
}
;the answer to the question
/var %Anr = 2
:text
if ( %Anr > $lines( txt\faq_add.txt ) ) goto end
if ( %faq_nr. [ $+ [ %Anr ] ] == $null ) {
/inc %Anr 1 | goto text
}
;set %faq_ant is set to 0 ( zero )
if ( %faq_ant == $null ) {
if ( 0 < %faq_nr. [ $+ [ %Anr ] ] ) {
/var %faq_ant = %Anr
/inc %Anr 1 | goto text
}
}
;answer for the moment %faq_ant is set
if ( %faq_ant != $null ) {
if ( %faq_nr. [ $+ [ %faq_ant ] ] >= %faq_nr. [ $+ [ %Anr ] ] ) {
/inc %Anr 1 | goto text
}
if ( %faq_nr. [ $+ [ %faq_ant ] ] < %faq_nr. [ $+ [ %Anr ] ] ) {
/unset %faq_ant
/var %faq_ant = %Anr
/inc %Anr 1 | goto text
}
}
:end
If ( %faq_ant != $null ) {
/notice $nick .
/notice $nick 2 $read(txt\faq_ant.txt, %faq_ant )
/notice $nick .
/notice $nick 5Is je vraag beantwoord? Zo niet stel hem opnieuw in andere bewoordingen. | goto endd
}
if ( %faq_ant == $null ) {
/notice $nick 2Deze vraag is niet opgenomen in de vragen lijst.
/notice $nick 2Vraag aan de kanaal operator of deze beantwoord kan worden en toegevoegd.
/notice $nick 2of kijk voor het antwoord op http://forum.torpia.nl/ | goto endd
}
;deleting of allvariables
:endd
/unset %Anr
/var %Anr = 1
:endd1
if ( %Anr > $lines( txt\faq_add.txt )) /halt
if ( %faq_nr. [ $+ [ %Anr ] ] != $null ) {
/unset %faq_nr. $+ [ %Anr ]
/inc %Anr 1
if ( %Anr > $lines( txt\faq_add.txt )) /halt
if ( %Anr <= $lines( txt\faq_add.txt )) goto endd1
}
if ( %faq_nr. [ $+ [ %Anr ] ] == $null ) {
/inc %Anr 1 | goto endd1
}
}
#faqs end
; if !faq < question > not work? remove the #Cfaq part to a remote of it's selfe
#Cfaq on
on 1600:TEXT:!delete_faq*:#: {
if ( $2 == $null ) {
/notice $nick 2 The correct manner to remove a question is !delete_faq < question > | /halt
}
If ( $$2- isin $read( txt\faq_add.txt ) ) {
/var %faq_txtt = $$2-
/var %faq_nrt = $readn
/notice $nick 2 are YOU certainly that you want remove the question and answer. | notice $nick 2typ !delete_faq < yes ore no > | /var %delete_faqs = on
}
if ( %delete_faqs == on ) {
if ( $$1- == !delete_faq yes ) {
/write -dl [ $+ [ %faq_nrt ] ] txt\faq_add.txt | /write -dl [ $+ [ %faq_nrt ] ] txt\faq_ant.txt | /unset %delete_faqs | /unset %faq_nrt | /dec %add_faq 1 | /dec %ant_faq 1
/notice $nick 2 The question: 5 %faq_txtt is removed from the FAQ database. | /halt
}
if ( $$1- == !delete_faq no ) { /notice $nick 2 Nothing has been removed. | /unset %delete_faqs | /unset %faq_nrt | /halt }
}
if ( $2 != $null ) {
/notice $nick 2The question is not removed from the FAQ. try it again. | /halt
}
}
; Number of lines faq_add en faq_ant.txt
on 1600:TEXT:*:#: {
if ( $1 == !aantal_faq ) {
/notice $nick 2 There are 5 $lines(txt\faq_add.txt) 2 questions stored faq_add.txt
/notice $nick 2 There are 5 $lines(txt\faq_ant.txt) 2 answers stored faq_ant.txt
/notice $nick 2 If the number of answers is not equal to the number of questions look in the files which questions ore answer you mist.
}
}
; joint question and answer
on 1600:TEXT:*:#: {
if ( $1 == !add_faq ) {
if ( %add_faq != $null ) {
if ( $$2- isin $read(txt\faq_add.txt, w, $$2- ) ) {
/notice $nick 2 This question has already been stored! | /halt
}
/write txt\faq_add.txt $$2- | /notice $nick 2 The question has been stored in faq_add.txt.
/inc %add_faq 1
}
}
if ( %add_faq == $null ) {
/set %add_faq 1
/notice $nick 2 The question has been stored in faq_add.txt.
}
if ( $1 == !ant_faq ) {
if ( %ant_faq != $null ) {
if ( $$2- isin $read(txt\faq_ant.txt, w, $$2- ) ) {
/notice $nick 2 This answer has already been stored! | /halt
}
/write txt\faq_ant.txt $$2- | /notice $nick 2 This answer has been stored in faq_ant.txt.
/inc ant_faq 1
}
}
if (%ant_faq == $null) {
/set %ant_faq 1
/notice $nick 2 This answer has been stored in faq_ant.txt.
}
else { /halt }
}
#Cfaq end
not working but thanks