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.

extra characters after close-quote

Old posts that have not been replied to for several years.
Locked
D
Danzai

extra characters after close-quote

Post by Danzai »

Hi all,

i need help about tcl scripting. i've been loaded some tcl game into my eggie but when i trying type !start, bot response on via DCC tell "Tcl error [tmcquiz_ask]: extra characters after close-quote"

the code for tmcquiz_ask is:
## ask a question, start game
proc tmcquiz_ask {nick host handle channel arg} {
global qlist quizstate botnick
global tipno tiplist
global userqnumber usergame userqlist
global timeasked qnumber qlistorder theq
global qnum_thisgame
global userlist timerankreset
global quizconf
variable anum 0
variable txt

## only accept chatter on quizchannel
if {![mx_str_ieq $channel $quizconf(quizchannel)]} {
return
}

# switch -exact $quizstate {
# "paused" {
# mxirc_notc $nick "1,0 Game is paused. "
# return 1
# }
# "stopped" {
# mxirc_notc $nick "1,0 Game is stopped. "
# return 1
# }
# }

## record that $nick spoke (prevents desert detection from stopping,
## when an user joins and starts the game with !ask)
if {![mx_str_ieq $nick $botnick]} {
mx_getcreate_userentry $nick $host
}

## any questions available?
if {[llength $qlist] == 0 && [mx_userquests_available] == 0} {
mxirc_say $channel "15,4 Sorry.. 15,2 my database is empty. "
} elseif {$quizstate == "asked"} {
## game runs, tell user the question via msg
set txt "Current"
if {[info exists theq(Level)]} {
set txt "$txt level $theq(Level)"
}
if {$usergame == 1} {
set txt "$txt user"
}
set txt "$txt question no. $qnum_thisgame is \""
if {[info exists theq(Category)]} {
set txt "${txt}\($theq(Category)\) "
}
set txt "$txt$theq(Question)\" open for [mx_duration $timeasked]"
if {$theq(Score) > 1} {
set txt "$txt, worth $theq(Score) points."
} else {
set txt "$txt."
}
mxirc_notc $nick $txt
} elseif {$quizstate == "waittoask" && ![mx_str_ieq $nick $botnick]} {
## no, user has to be patient
mxirc_notc $nick "Please stand by, the next question comes in less than $quizconf(askdelay) seconds."
} else {
##
## ok, now lets see, which question to ask (normal or user)
##

## clear old question
foreach k [array names theq] {
unset theq($k)
}

if {[mx_userquests_available]} {
## select a user question
array set theq [lindex $userqlist $userqnumber]
set usergame 1
incr userqnumber
mx_log "--- asking a user question: $theq(Question)"
} else {
variable ok 0
while {!$ok} {
## select a normal question
if {$qnumber >= [llength $qlistorder]} {
set qnumber 0
set qlistorder [mx_mixedlist [llength $qlist]]
}
array set theq [lindex $qlist [lindex $qlistorder $qnumber]]
set usergame 0

# skip question if author is about to win
if {[info exists theq(Author)] && [info exists userlist($theq(Author))]} {
array set auser $userlist($theq(Author))
if {$auser(score) >= [expr $quizconf(winscore) - 5]} {
mx_log "--- skipping question number $qnumber ([lindex $qlistorder $qnumber]), author is about to win"
## clear old question
foreach k [array names theq] {
unset theq($k)
}
} else {
mx_log "--- asking question number $qnumber ([lindex $qlistorder $qnumber]): $theq(Question)"
set ok 1
}
} else {
mx_log "--- asking question number $qnumber ([lindex $qlistorder $qnumber]): $theq(Question)"
set ok 1
}
incr qnumber
}
}
incr qnum_thisgame
if {$qnum_thisgame == 1} {
set timerankreset [unixtime]
mx_log "---- it's the no. $qnum_thisgame in this game, rank timer started."
} else {
mx_log "---- it's the no. $qnum_thisgame in this game."
}

##
## ok, set some minimal required fields like score, regexp and the tiplist.
##

## set regexp to match
if {![info exists theq(Regexp)]} {
## mask all regexp special chars except "."
set aexp [mx_tweak_umlauts $theq(Answer)]
regsub -all "(\\+|\\?|\\*|\\^|\\$|\\(|\\)|\\\[|\\\]|\\||\\\\)" $aexp "\\\\\\1" aexp
# get #...# area tags for tipgeneration as regexp
regsub -all ".*\#(\[^\#\]*\)\#.*" $aexp "\\1" aexp
set theq(Regexp) $aexp
} else {
set theq(Regexp) [mx_tweak_umlauts $theq(Regexp)]
}

# protect embedded numbers
if {[regexp "\[0-9\]+" $theq(Regexp)]} {
set newexp ""
set oldexp $theq(Regexp)
set theq(Oldexp) $oldexp

while {[regexp -indices "(\[0-9\]+)" $oldexp pair]} {
set subexp [string range $oldexp [lindex $pair 0] [lindex $pair 1]]
set newexp "${newexp}[string range $oldexp -1 [expr [lindex $pair 0] - 1]]"
if {[regexp -- $theq(Regexp) $subexp]} {
set newexp "${newexp}(^|\[^0-9\])${subexp}(\$|\[^0-9\])"
} else {
set newexp "${newexp}${subexp}"
}
set oldexp "[string range $oldexp [expr [lindex $pair 1] + 1] [string length $oldexp]]"
}
set newexp "${newexp}${oldexp}"
set theq(Regexp) $newexp
mx_log "---- replaced regexp '$theq(Oldexp)' with '$newexp' to protect numbers."
}


hope you all can solved my problem in here :)
i dont know what happened.
and i'm using eggdrop 1.6.13
Thank you.

Regards,
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

Code: Select all

the code for tmcquiz_ask is: 
## ask a question, start game 
proc tmcquiz_ask {nick host handle channel arg} { 
global qlist quizstate botnick 
global tipno tiplist 
global userqnumber usergame userqlist 
global timeasked qnumber qlistorder theq 
global qnum_thisgame 
global userlist timerankreset 
global quizconf 
variable anum 0 
variable txt 
[b]I THINK HERE IS MISSING -> } <- ...[/b]
## only accept chatter on quizchannel 
if {![mx_str_ieq $channel $quizconf(quizchannel)]} { 
return 
} 
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

]Kami[ wrote:I THINK HERE IS MISSING -> } <-
I still think you don't think.

Danzai: you didn't paste the entire proc. There's two }'s missing at the end and probably some lines of code too.
Have you ever read "The Manual"?
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

naaah... and could you please use code-tags and format your code? i _hate_ looking at such code...

btw: if you format your code its easy to find missing brackets.

@]Kami[: with your bracket it would become a quite useless proc, dont you think so? ;)
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
D
Danzai

Post by Danzai »

Thanks for your help ]Kami[, user, arcane. problem solved now :). that invoke with [channels]. hehe weird.

Regards,
danzai
Locked