Hi
    I've setup a simulation in which I want to color the node in nam
according to some events. Everything is working perfectly, except for
the node colors. Following Marc Greis tutorial, I wrote a function in
my modified mac/mac-802_11.cc like this:
can't read "node_": no such variable

void Mac802_11::setColor(int channel) {
        char out[100];
        sprintf(out, "%s setColor %d", name(), variable);
        Tcl& tcl = Tcl::instance();
        tcl.eval(out);
}

and in my tcl file:
Mac/802_11 instproc setColor {variable} {
        $self instvar node_
        $node_ color red
}

The problem is that the tcl function gets called, but I get this error:
ns: _o1854 setColor 8: can't read "node_": no such variable
    while executing
"$node_ color red"
    (procedure "_o1854" line 3)
    (Mac/802_11 setColor line 3)
    invoked from within
"_o1854 setColor 8"

Am I missing something? Does my function need to be placed somewhere
else or could I leave it here? Any hint?

Thanks
--
Luca Bedogni
PhD Candidate in Computer Science
University of Bologna
http://lbedogni.web.cs.unibo.it

Reply via email to