[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Tcl problem
> If I remove the brackets on all n(1), and define the node name as n1,
> it is OK and the proc works well. Since I need to randomly select
> some nodes in the proc, I have to make the node name changable, such
> like: n($i). Can any one tell me what's wrong and how to do it?
You need to specify the name of the whole array, not just one element when
you use "global"
The following should work:
set n(1) [$ns node]
set agent1 [Agent/...]
proc myproc {} {
global ns n agent1
$ns attach-agent $n(1) $agent1
:
:
}
--
Tim Buchheim