Hi all I have a wireless scenario and I need to get the position of a mobile node through the TCL script and not in C++ as I've seen in many mailing list answers. I'm still wondering why nobody implemented a method in tcl to GET the co-ordinates (is it so unuseful?) in the official versions of ns-2, so I decided to write it on my own with the help of the messages I found here in the mailing list, with no success.
First try: editing mobilenode.cc adding code like this: [...] } else if (strcmp(argv[1], "getx") == 0) { Tcl& tcl = Tcl::instance(); tcl.resultf("%f", X_); return TCL_OK; } [...] And so on for y and z. It doesn't work... After I recompiled the code, I tried to get the x value like this: set x [$node1 getx] But I get an error... It seems that the command "getx" doesn't exist... Where's the mistake? Second try: editing ns-mobilenode.tcl adding: [...] Node/MobileNode instproc getX {} { $self instvar X_ return $X_ } [...] And so on for y and z. Here comes the funny thing: it seems that ns-2 simply ignores this file.. even editing the existing functions contained here I get always the same results (for example removing all the content of a function, I should have a function that does nothing, and I get a function that does the original instructions instead...) Is there a kind user that faced this problem before and could help me? Thanks in advance Fabio D'Aprano