May be you should upload the complete tcl file ?
Could be some other text in the file is wrong ?
This is "template.tcl"
Code:
# Create a simulator object
set ns [new Simulator]
# Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
# Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
exec nam out.nam &
exit 0
}
############################################
#
# Insert your own code for topology creation
# and agent definitions, etc. here
#
############################################
# Call the finish procedure after 5 seconds simulation time
$ns at 5.0 "finish"
# Run the simulation
$ns run
Tcl files can also be attached as name.tcl.txt or name.tcl.bz2.txt :
Attachments, that's the paper clip tool in the 'Advanced Editor'.