[TF] world-quitting macro
Brought to you by:
kenkeys
|
From: karen at etheridge.ca (K. Etheridge) - 2003-05-29 19:13:55
|
On Thu, May 29, 2003 at 11:42:22PM +1000, Ricky Buchanan wrote:
> I want to redefine the command /quit to give it a different behaviour,
> that if there *is* one or more connected worlds, then to /dc from the
> current world, and only when there are *no* worlds then to disconnect
> from the program.
>
> I'm not sure how to do this one. I could go
> /def quit = /dc
> to redefine it in all cases, but how do I check if it's being called in
> a world or in a no-world situation??
You could use half a neuron and check the return value of fg_world(),
perhaps. :)
/def quit=\
/if (fg_world() !~ "") \
/dc %;\
/else \
/@quit %;\
/endif
But this won't match what you said above -- it will not disconnect a socket
if there is still one left and you just happen to be backgrounded right
now. You could check %? after running /listsockets -s for that.
--
"Govern a country as you would cook a small fish." - Lao Tzu
. . . . .
Karen Etheridge, ka...@et... GCS C+++$ USL+++$ P++ w--- M++$
http://etheridge.ca/ PS++ PE-- b++ DI++++ e++ h(-)
|