mIRC Home    About    Download    Register    News    Help

Print Thread
script that answers questions from txt file? #88989 03/07/04 02:57 PM
Joined: Jul 2004
Posts: 3
M
matteh117 Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jul 2004
Posts: 3
hi, is there a script that answers questions from txt file?
like i could list a load of questions in a .txt file and have the answers, and something will answer me on a chat when i ask it.

Re: script that answers questions from txt file? #88990 04/07/04 12:57 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
In your mIRC folder, create a file called q.txt in the following format:
  • question
    [color:green]answer

    question
    answer[/color]
(odd lines = questions; even lines = answers)

Enter this code into the Scripts Editor (Alt+R):

On me:*:join:[color:blue]#chan:{
  • if !$isfile(q.txt) {
    echo -gtc info # * Note: couldn't find $mircdirq.txt (questions file)
    return
    }
    if $hget(q) { hfree q }
    hmake q
    hload q q.txt
}

On *:text:*:#chan:{
  • if $hget(q,$strip($1-)) { msg # $ifmatch }
}[/color]

Change both occurrences of #chan to the name of the channel where the script will take effect.

Connect the bot, and get somebody to type one of your defined questions. The bot will then message the channel with the corresponding answer.

Re: script that answers questions from txt file? #88991 04/07/04 07:18 PM
Joined: Jul 2004
Posts: 3
M
matteh117 Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jul 2004
Posts: 3
it doesnt work. i do put it in remote dont i?

Last edited by matteh117; 04/07/04 07:28 PM.
Re: script that answers questions from txt file? #88992 04/07/04 09:17 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Yes, put the gray code in the remote, and make the bot join the channel. Do you get any errors?

Remember, q.txt must be in the mIRC folder.