mIRC Homepage
Posted By: LuGyiMin Read and Writer txt files - 25/08/04 02:20 PM
Hello all, i'm newbie

i'm writing auto answering quiz scripts.

I made Q & A txt files.

i used $read in my script to read Q in txt files.

then i wanna type the answer.

How can i know the answer line number?

something likes that (currency.txt) including couples of lines.
**************************************************
Afghanistan
afghani
**************************************************

in my script
*********
on *:TEXT:*:#quiz:{
if ($regex($1-,/(geography && currency)/i)) {
if ($regex($10-,/($read(currency.txt, w, *, 1))/i)) {
msg $play - $+ %line currency.txt
}
}
}

in there i don't know how to define veriable %line no.
Posted By: TroyBoy Re: Read and Writer txt files - 25/08/04 03:34 PM
/help $read

Directly under the $read help, theres $readn

$readn
Returns the line number that was matched in a previous call to $read(). If no match was found, $readn is set to zero.

so your %line = $readn


If you want a really good highly configurable trivia script, you can use mine:

http://www.geocities.com/troyparry/tbtriv/

That has ver 1.23 on it, but you can use the same instructions and d/l ver 1.25 from:

http://www.geocities.com/troyparry/tbtriv/download/TBtriv125_full.zip

Its 2.73mb because it includes 150,000 questions.
Feel free to modify it and add your $readn :P
Posted By: LuGyiMin Re: Read and Writer txt files - 25/08/04 04:20 PM
Could u pls send me ur files? coz, my ISP has been block that Geocities.

Thx TroyBoy

LuGyiMin@ezrs.com
Posted By: TroyBoy Re: Read and Writer txt files - 25/08/04 04:43 PM
Try this direct link:

http://parry-web.servegame.com/TBtriv125_full.zip
The old v1.23 instructions from the geocities website are in the zip.

If you would like to see the script in action, you can connect to my irc network:
parry-irc.servegame.com:6667
and join channel: #TBtrivia

If you still have probs, then let me know.
Posted By: LuGyiMin Re: Read and Writer txt files - 26/08/04 08:40 AM
Hi TroyBoy,

I've got ur .zip file. It's so good for me. I've to read it all till i feel complete understanding. I never been written like that script. It's pretty long and nice one.

thx alot.
Posted By: torhaala Re: Read and Writer txt files - 19/10/04 10:54 PM
Hey,

I tried to do a similar thing, and wrote this.. works excellent for me.
the Q.txt contains one question on each line and A.txt the corresponding answer on the same line number..
..Automaticly finds total number of lines, etc.

on *:text:*:#:{
var %i = 1
while (%i <= $lines(Q.txt)) {
if ($read(Q.txt,%i) == $1-30) {
/msg $chan $read(A.txt,%i)
halt
}
inc %i
}
}
Posted By: LuGyiMin Re: Read and Writer txt files - 04/06/05 12:08 PM
thx... i'll try it. but ur files is doubled.
how about $gettok ?
$gettok (Q*A,2,42)
Posted By: omenz Re: Read and Writer txt files - 19/03/08 08:56 AM
TBtriv
http://parry-web.servegame.com/TBtriv125_full.zip ''the link to it were dead. Do you give new links. thnx
Posted By: SladeKraven Re: Read and Writer txt files - 19/03/08 04:55 PM
I'm not surprised the link is dead, it's almost 4 years old. :P
© mIRC Discussion Forums