Hello, I am trying to connect a node called $reader1 to 30 other nodes. I tryed to write a for statemant but it is not working.
This works: but with two nodes is very simple $ns connect $reader1 $tag_1 $ns connect $reader1 $tag_2 This is not working: for {set i 1} {$i < $val(nn)} { incr i } { $ns connect $reader1 $tag_$i } Error: can't read "tag_": no such variable while executing "$ns connect $reader1 $tag_$i" ("for" body line 2) invoked from within "for {set i 1} {$i < $val(nn)} { incr i } { $ns connect $reader1 $tag_$i }" (file "rfid4.tcl" line 118) The tag_ var is created at: for {set i 1} {$i < $val(nn)} { incr i } { set tag_$i [new Agent/RfidTag] } What should I do ? -- ---------------------------------------------------------------------------------------------------------------- Rafael Perazzo B Mota r <pera...@ime.usp.br>afaelpera...@gmail.com Web-page: https://sites.google.com/site/rafaelperazzo/ Doutorando em Ciência da Computação Universidade de São Paulo (USP) Campus da Capital Instituto de Matemática e estatística (IME) ------------------------------------------------------------------------------------------------------------------ -- ---------------------------------------------------------------------------------------------------------------- Rafael Perazzo B Mota r <pera...@ime.usp.br>afaelpera...@gmail.com Web-page: https://sites.google.com/site/rafaelperazzo/ Doutorando em Ciência da Computação Universidade de São Paulo (USP) Campus da Capital Instituto de Matemática e estatística (IME) ------------------------------------------------------------------------------------------------------------------