Re: [ns] How to call a procedure after a constant delay

2007-02-09 Thread Filippos Kolovos
- At first you need to schedule the loop proc to execute at the start (or whenever you like) of the simulation. Then, you need to put the re-scheduling code inside the procedure itself in order to make it recursive. In this way the loop procedure will execute once at the start of the simulation

Re: [ns] How to call a procedure after a constant delay

2007-02-09 Thread Scott Ricketts
To add on to the proposed solution, let me try to offer an explanation of the difference between Somera's original code and Fillippos' suggestion. In Somera's code, the line $ns at $time loop does not call the loop function. Instead, it adds the call to the scheduling queue (or similar data

[ns] How to call a procedure after a constant delay

2007-02-08 Thread Somera Javed
Hi, i am trying to call a procedure after a delay of every 0.01 sec proc loop {} { global abc value set value [$abc get_value] exit 0 } set time 0.2 set inc 0.01 while 1 { $ns at $time loop set time [expr $time + $inc] if {$value == 1} break; } but the

Re: [ns] How to call a procedure after a constant delay

2007-02-08 Thread Scott Ricketts
It looks to me like you are putting the Otcl interpreter in an infinite loop before the simulation starts. That is, loop is getting scheduled every time the while loop iterates, but it does not actually get called until you do $ns run, so $value never gets set. -Scott On 2/8/07, Somera Javed