Your file : ns is defined as ns_ , not ns. I.e. edit all ns to ns_
......... Search the error lines
$ cat -n orig__burkege-aodvolsr-1.tcl | grep "\ns\ "
.
130 set node0 [$ns node]
131 set node1 [$ns node]
134 $ns duplex-link $node0 $node1 10Mb 10ms DropTail
147 $ns at $start_time "$cbr0 start"
148 $ns at $end_time "$cbr0 stop"
200 $ns attach-agent $node0 $tcp_agent0
.
206 $ns at 0.0 "$node0 set adhocRouting AODV"
207 $ns at 0.0 "$node1 set adhocRouting AODV"
211 $ns at 5.0 "switch_to_olsr $node0 $node1"
216 puts "Switching from AODV to OLSR at [format %.2f $ns now]"
225 $ns at 100.0 "$ns halt"
228 $ns run
-----------------------------------------------
To run an OLSR simulation, an ns patched for olsr is required ..... my example executable
$ ns235-olsr-64 burkege-aodvolsr-1.tcl
num_nodes is set 2
INITIALIZE THE LIST xListHead
INITIALIZE THE LIST xListHead
formal parameter "node_(0)" is an array element
(creating proc "switch_to_olsr")
invoked from within
"proc switch_to_olsr {node_(0) node_(1)} {
global ns_
puts "Switching from AODV to OLSR at [format %.2f $ns_ now]"
# Change the routing pr..."
(file "burkege-aodvolsr-1.tcl" line 214)
---------------
OK until line 214 with the "never seen before" switch from AODV to OLSR
.... Please explain where you got this idea for "switch from AODV to OLSR"
proc switch_to_olsr {node_(0) node_(1)} {
global ns_
puts "Switching from AODV to OLSR at [format %.2f $ns_ now]"
# Change the routing protocol of the nodes to OLSR
"$node0 set adhocRouting OLSR"
"$node1 set adhocRouting OLSR"
}
Edited burkege-aodvolsr-1.tcl
https://drive.google.com/file/d/1QavJ__Q-7G7okvJjo1ZgW1pDpTuAFBKk/view?usp=drive_link