I am trying to label, change shape, and change label-color of nodes in NS2 2.35/nam 1.15. I am able to add the label and change the color of the nodes correctly (although color requires 2 lines). However, I would like to make that node a square AND change the label color (the label color is lime green and difficult to read). Seems simple... via the manual/internet/sources out there, I have generated the following code to accomplish this:
set stime 0.0
#color works... but requires BOTH these lines
$ns at $stime "$BS color darkgreen"
$BS color darkgreen
#shape does NOT work. Shape stays a circle
$ns at $stime "$BS shape square"
$BS shape square
#Label works
$ns at $stime "$BS label \"BASE STATION\""
#label color does NOT. Moves the node to position 0,0
$ns at $stime "$BS label-color black"
$BS label-color black;
#base station position
set bsx [expr $val(x)/2]
set bsy [expr $val(y)/2]
$BS set X_ $bsx
$BS set Y_ $bsy
$BS set Z_ 0.0;
When I run the code, the node color changes and the label is added. However, the shape does not ever change - I have not been able to get it to change either (via changing stime
, commenting out stuff, adding, trying different shapes, etc). In addition, when I leave in the label color, it SHIFTS the entire node position from (35, 35) to (0, 0). How would label color shift node position??? Why does my shape never change? What am I doing wrong with label color? Is this an initialization problem within the event scheduler?
As a final note, every node in my whole simulation before 'Play' in nam is pressed starts as a green circle. The colors and labels change AFTER play is hit.