mIRC Homepage
Posted By: Xati Delay command - 24/04/14 01:15 AM
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!
Posted By: bl968 Re: Delay command - 24/04/14 03:12 AM
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
}

Posted By: patrickplays Re: Delay command - 24/04/14 10:54 AM
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
Posted By: Nillen Re: Delay command - 24/04/14 10:57 AM
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.
Posted By: Xati Re: Delay command - 24/04/14 04:14 PM
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 }
Posted By: blessing Re: Delay command - 25/04/14 01:15 AM
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>
....

© mIRC Discussion Forums