mIRC Home    About    Download    Register    News    Help

Print Thread
Read and Writer txt files #95517 25/08/04 02:20 PM
Joined: Aug 2004
Posts: 5
LuGyiMin Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Aug 2004
Posts: 5
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.


LGM
Re: Read and Writer txt files #95518 25/08/04 03:34 PM
Joined: Aug 2004
Posts: 42
T
TroyBoy Offline
Ameglian cow
Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
/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

Last edited by TroyBoy; 25/08/04 03:57 PM.
Re: Read and Writer txt files #95519 25/08/04 04:20 PM
Joined: Aug 2004
Posts: 5
LuGyiMin Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Aug 2004
Posts: 5
Could u pls send me ur files? coz, my ISP has been block that Geocities.

Thx TroyBoy

LuGyiMin@ezrs.com

Last edited by LuGyiMin; 25/08/04 04:26 PM.

LGM
Re: Read and Writer txt files #95520 25/08/04 04:43 PM
Joined: Aug 2004
Posts: 42
T
TroyBoy Offline
Ameglian cow
Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
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.

Re: Read and Writer txt files #95521 26/08/04 08:40 AM
Joined: Aug 2004
Posts: 5
LuGyiMin Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Aug 2004
Posts: 5
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.


LGM
Re: Read and Writer txt files #95522 19/10/04 10:54 PM
Joined: Oct 2004
Posts: 1
T
torhaala Offline
Mostly harmless
Offline
Mostly harmless
T
Joined: Oct 2004
Posts: 1
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
}
}

Last edited by torhaala; 19/10/04 11:01 PM.
Re: Read and Writer txt files #95523 04/06/05 12:08 PM
Joined: Aug 2004
Posts: 5
LuGyiMin Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Aug 2004
Posts: 5
thx... i'll try it. but ur files is doubled.
how about $gettok ?
$gettok (Q*A,2,42)

Last edited by LuGyiMin; 04/06/05 12:32 PM.
Re: Read and Writer txt files [Re: TroyBoy] #196568 19/03/08 08:56 AM
Joined: Mar 2008
Posts: 1
O
omenz Offline
Mostly harmless
Offline
Mostly harmless
O
Joined: Mar 2008
Posts: 1
TBtriv
http://parry-web.servegame.com/TBtriv125_full.zip ''the link to it were dead. Do you give new links. thnx

Re: Read and Writer txt files [Re: omenz] #196575 19/03/08 04:55 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm not surprised the link is dead, it's almost 4 years old. :P