mIRC Home    About    Download    Register    News    Help

Print Thread
#72582 23/02/04 11:52 PM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
on *:TEXT:*:#:{ if ($1 == !start) && ($nick == Mew) { /start $1- | return }
if (%kaos.bot == yes) { search $strip($1-,c) }
}
alias search { var %x = 1
while (%x <= $lines(answers.txt)) { if ($1- isin $read(answers.txt,%x)) { notice $nick $talker(Too late, Someone else got that answer!) | return }
inc %x
}
search2 $strip($1-,c)
}
alias search2 { var %x = 1
while (%x <= $lines(%question)) { if ($1- isin $read(%question,%x)) { notice $nick $talker(Point Added!) | write answers.txt $1- | set %search.1 $read(correct.txt,s,$nick) | if (%search.1 == $null) { write correct.txt $nick 1 } | if (%search.1 != $null) { write -l $+ $readn correct.txt $nick $calc(%search.1 + 1) } | set %search.2 $read(rank.txt,s,$nick) | if (%search.2 == $null) { write rank.txt $nick 1 } | if (%search.2 != $null) { write -l $+ $readn rank.txt $nick $calc(%search.2 + 1) } | newrank }
inc %x
}
}
The code works. It's just that
Say "Bully" is one of the answers.
If someone types "Bul" it'll be right cause bul [[[IS]]] in bully...
Anyone know how to avoid this problem?
Maybe reading it backwards (From what I have it)
So instead of checking if $1- isin $read(%question,%x) I should if $read(%question,%x) isin $1-
That might work, but still has the problem of:
if someone typed:
BULLYYYYYYYYY it would count it.
~Anyone know any other way? smile


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
#72583 23/02/04 11:58 PM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
OR Perhaps,
if ($1 == $read(%question,%x)) { blah }
*Goes go try it*


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
#72584 24/02/04 01:07 AM
Joined: Dec 2002
Posts: 111
E
Vogon poet
Offline
Vogon poet
E
Joined: Dec 2002
Posts: 111
it may be easier to have the questions in one file and the answers in another, each on the correct line. IE question 1 is the first line of questions.db and the answer for question 1 is on the first line for answers.db etc, use $read to read the question and $readn to read the answer for the question smile

#72585 24/02/04 02:07 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
i suggest you stop wrtting your code using | and start putting it on seperate lines, it makes it fare easier to read and diagnose.

#72586 25/02/04 03:01 AM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
Code was fixed, Thanks guys.


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -

Link Copied to Clipboard