mIRC Home    About    Download    Register    News    Help

Print Thread
#245515 24/04/14 01:15 AM
X
Xati
Xati
X
Hey i was making an automated bot for a question game, i was wondering if anyone could help me with a delay command so the answers aren't said instantly? So far it's just looking like this
on *:TEXT:*What is 72+4:#: { msg $chan 76 }

There are over 900 questions so it would need to be able to have a delay on each would something like

on *:TEXT:*What is 72+4:#: {.timer 1 1 msg $chan 76 }

work? I tried it but i would have to change the id value on every single one which wouldn't be too good, if anyone can help thank you a lot!

#245522 24/04/14 03:12 AM
B
bl968
bl968
B
Why not use $calc


on 1:TEXT:*!math*:#:{
/describe $chan gets out his abacus at $nick $+ 's Request
/var %solution $calc($2-)
/msg $chan the solution to $2- is %solution
}


#245523 24/04/14 10:54 AM
P
patrickplays
patrickplays
P
timer 1 1
would be 1 second i guess

@bl968 i think he isnt using calc because questions can be made of words too :p

#245524 24/04/14 10:57 AM
Joined: Dec 2013
Posts: 771
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
Then it would just be
Code:
on *:text:What is*:#: { msg # $calc($3-) }

Even if other mathematical questions use words instead of numbers, there's no point in making a command for 74 + 2 for instance.

#245532 24/04/14 04:14 PM
X
Xati
Xati
X
I think i solved it but not sure, would i be able to use { .timermsg 1 $rand(1,3) msg $chan } for a message being sent with a random number of seconds between 1 - 3? I've tried it and worked for one question/answer but not sure if it works for several, Sorry to ask such obvious questions!
This is what it looks like

Code:
on *:TEXT:*Quotes - "It is during our darkest moments that we must focus to see the light.":#: { .timermsg 1 $rand(1,3) msg $chan Aristotle Onassis }

Last edited by Xati; 24/04/14 04:14 PM.
#245547 25/04/14 01:15 AM
B
blessing
blessing
B
It would work for several.
The problem is you have over 900 questions and that means you have to write over 900 lines on TEXT event aswell.

Solution is put the questions and answer into file.txt with recognized pattern for script to read and parse.
After that, you can load the file into hashtable and I guess script would be less than 20 lines.

e.g.,
Code:
<question 1>:<answer 1>
<question 2>:<answer 2>
.....

or

<question 1>
<answer 1>
<question 2>
<answer 2>
....



Link Copied to Clipboard