Code: Select all
set newcardc [lindex $cardcounts $target]
incr newcardc 1
lreplace $cardcounts $target $target $newcardc
putlog "Replace Node: Attempt: $newcardc Actual: [lindex $cardcounts $target]"
Code: Select all
set newcardc [lindex $cardcounts $target]
incr newcardc 1
lreplace $cardcounts $target $target $newcardc
putlog "Replace Node: Attempt: $newcardc Actual: [lindex $cardcounts $target]"
Code: Select all
set cardcounts [lreplace $cardcounts $target $target $newcardc]
Code: Select all
global cardcounts
Code: Select all
proc startgame {nick host hand chan text} {
global players gamestate hands coloring coloringend deckstring gamechan
if {$chan == $gamechan && $gamestate == 2 && [llength $players] > 1} {
set gamestate 3
putquick "PRIVMSG $chan : $nick has started the game! Dealing out the cards..."
repopdeck
for { set walker 0 } { $walker < [llength $players] } { incr walker } {
draw 7 $walker
set output "Your Cards:"
foreach card $hands($walker) {
append output " \003"
append output [lindex $coloring [lsearch $deckstring $card]] $card
append output "\003"
}
putquick "NOTICE [lindex $players $walker] : $output"
}
nextplayer
}
}
proc draw {number target} {
global cardcounts hands deck decktotal deckstring
for { set start 0 } { $start < $number } { incr start } {
set flag 0
if { $decktotal == 0 } { repopdeck }
while { $flag == 0 } {
set testcard [rand 50]
if { [lindex $deck $testcard] < 4 } { set flag 1 }
}
set newdeckc [lindex $deck $testcard]
incr newdeckc 1
set deck [lreplace $deck $testcard $testcard $newdeckc]
set newcardc [lindex $cardcounts $target]
putlog "Test Node: Target: $target Cardcountvalue: $newcardc"
incr newcardc 1
set cardcounts [lreplace cardcounts $target $target $newcardc]
putlog "Replace Node: Attempt: $newcardc Actual: [lindex $cardcounts $target]"
lappend hands($target) [lindex $deckstring $testcard]
}
incr decktotal -1
}
Code: Select all
set newdeckc [lindex $deck $testcard]
incr newdeckc 1
Code: Select all
Currently: expected integer but got ""
Currently: while executing
Currently: "incr newcardc 1"
Currently: (procedure "draw" line 15)
Currently: invoked from within
Currently: "draw 7 $walker"
Currently: (procedure "startgame" line 9)
Currently: invoked from within
Currently: "startgame $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"