View previous topic :: View next topic |
Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Tue Jun 10, 2003 11:56 am Post subject: |
|
|
I haven't got any "no such element in array" errors in the tsunami.tcl and/or even not in the njf.tcl (version 0.3) wich should be working fine. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
stdragon Owner

Joined: 23 Sep 2001 Posts: 959
|
Posted: Tue Jun 10, 2003 12:00 pm Post subject: |
|
|
It looks like you initialize the array at the beginning of the script. So if somebody does a .+chan after it's loaded, that entry won't exist. Maybe instead you should use if {![info exists bla(chan)]} {set bla(chan) 0} at the top of each proc where you access the array? Or better, put it in a proc called init_chan $chan, which does that line. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Wed Jun 11, 2003 12:52 am Post subject: |
|
|
Yes, in this one I have forgot to add this, but in the njf.tcl it exists:
Quote: |
# fix after an .chanset on a channel
if {![info exists val([strlwr $chan])]} { set val([strlwr $chan]) 0 }
|
For the tsunami.tcl this should be somehting like this:
Code: |
if {![info exists bla([strlwr $chan])]} { set bla([strlwr $chan]) 0 }
|
Anyway, as I have wrote in it is a beta thing so yah, it's buggy. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Wed Jun 11, 2003 3:04 am Post subject: |
|
|
Also, replace from:
Code: |
if {[string length [join [split $text] ""]] > "$linelength"} {
|
to:
Code: |
if {[llength [split $text ""]] > "$linelength"} {
|
and there goes another fixed "bug"
Ps: the "if {![info exists bla([strlwr $chan])]} { set bla([strlwr $chan]) 0 } " should be added before the "set linelength [lindex [split $::ltl ":"] 3]" somewhere.. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Wed Jun 11, 2003 5:33 am Post subject: |
|
|
Replace from:
Code: |
if {[string match [strlwr [strlwr $chan]] $arr_part]} {
|
to:
Code: |
if {[string match [strlwr $chan] $arr_part]} {
|
there is no need to make it lower case twice, duno how I've missed that.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jun 11, 2003 11:29 am Post subject: |
|
|
ok I added the "if {![info exists bla([strlwr $chan])]} { set bla([strlwr $chan]) 0 }" right before the "set linelength...", so now its:
Code: | if {![info exists bla([strlwr $chan])]} { set bla([strlwr $chan]) 0 }
set linelength [lindex [split $::ltl ":"] 3] |
and I replaced those 2 codes u told me to
--but should I keep this code ?:
Code: | # array fix #
foreach chan [channels] {
set bla([strlwr $chan]) 0
} |
or should I remove it ? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Wed Jun 11, 2003 11:45 am Post subject: |
|
|
Yes, it should be there. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jun 11, 2003 12:08 pm Post subject: |
|
|
ok thanx
No usch errors are appearing anymore  _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
Back to top |
|
 |
|