Page 1 of 1

widget disabling does not work (xpost from zk forum)

Posted: 08 Sep 2012, 20:49
by knorke
Anyone got an idea why my widget posted in
http://zero-k.info/Forum/Thread/3257
does not disable itself?

Code: Select all

        if (not Spring.IsReplay()) then
                Spring.Echo ("replaycontrol: Not a replay, removing myself.")
                widgetHandler:RemoveWidget()
                Spring.Echo ("replaycontrol: LOL did not work")
        end
in infolog:
[f=0000000] replaycontrol: Not a replay, removing myself.
[f=0000000] replaycontrol: LOL did not work

Also is chili used ok like this or doing it wrong?

Re: widget disabling does not work (xpost from zk forum)

Posted: 08 Sep 2012, 21:48
by zwzsg
widgetHandler:RemoveWidget() <- This is not instant. Your widget will not be called next time, but the function still finishes.

Re: widget disabling does not work (xpost from zk forum)

Posted: 08 Sep 2012, 22:29
by knorke
[22:08:01] <zwzsg[IRC]> I would add a "return" in your if (not Spring.IsReplay()) then
that worked.