This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

trouble with scramble tcl script

Old posts that have not been replied to for several years.
Locked
n
nickname
Voice
Posts: 3
Joined: Sun Nov 28, 2004 2:46 am

trouble with scramble tcl script

Post by nickname »

Can anyone help me pls?
I put the file here

Code: Select all

http://con4n007.freelinuxhost.com/txc.tcl
the scramble works ok,
my problem is, it doesn't recognize the answer...
let's say the answer will be "good"
even though I asnwer "good", it gives no response at all and doesn't increment the score.
can anyone help me pls?


thanks

edit:
there's seperate question called "soal.txt" with {question} {answer} format, line per line
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

there would be a better chance someone can if you paste the problematic code here
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

That script is for the birds. Try the TCL archives, in the 'Games' section. You might wish to try nerfbendr's trivia, it has far more potential :mrgreen:
n
nickname
Voice
Posts: 3
Joined: Sun Nov 28, 2004 2:46 am

Post by nickname »

this's for set the question and answer
set game(questions) ""

if {[file exists $game(file)]} {

set fileid [open $game(file) r]

while {![eof $fileid]} {

gets $fileid game(temp)

if {$game(temp) != ""} {

lappend game(questions) $game(temp)

}

}

close $fileid

proc xrange {xr xr1 xr2} {

return [join [lrange [split $xr] $xr1 $xr2]]

}


proc xindex {xr xr1} {

return [join [lrange [split $xr] $xr1 $xr1]]

}
this's to show whether the user is correct
foreach game(temp) $game(answers) {

if {((!$game(type)) && ($guess == [string tolower $game(answers)])) || (($game(type) == 1) && ([string match [string tolower $game(temp)] $guess]))} {

if {$game(team)} {

foreach game(temp) [array names game_players] {

if {[lsearch -exact [string tolower $game_players($game(temp))] [string tolower $nick]] != -1} {

incr game_teams($game(temp))

putserv "PRIVMSG $chan :$nick \[team $game(temp)\] is correct! ($guess)"

}

}

}
}
my problem here is the bot doesn't want to tell whether the user is correct answering the question...

nerfbendr's trivia is not free
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

It may not be free, but it's still coded far better than what ya got goin there :mrgreen:
n
nickname
Voice
Posts: 3
Joined: Sun Nov 28, 2004 2:46 am

Post by nickname »

YooHoo wrote:It may not be free, but it's still coded far better than what ya got goin there :mrgreen:
I thought this forum is used to help people that having trouble
not flame other people' code :roll:
Locked