macros.doc

advertisement
Paradise Macros
-----Last updated 11/11/93
A macro is placed in the .xtrekrc and defined as follows:
macro.k.d: value
or
mac.k.d: value
Where 'd' is the destination and 'k' is the key.
'd' is optional (see below).
Macros can only be sent out while in macro mode (exception: see
SingleMacro).
To enter macro mode, press 'X'. Then press the key ('k' above). If the
destination is given, the macro is parsed and sent immediately. If not,
see
below.
Destinations:
------------Normal destinations are 0-9a-z for a player, FRKO for a team, T for
your own team, A for all, or G for god.
The destination can also be a % code.
%I
%U
%T
%C
Send to self.
%P
Send to player nearest mouse
%Z
Send to team of player nearest mouse
%G
Send to friendly player nearest your ship
%H
Send to enemy player nearest your ship
If the destination field is not provided, executing the macro will
go into a state where it asks for the destination, at which point you
should select one of the normal destinations (press F,K,R,O,1-9,etc).
When you use a macro, it sends out the value as a message to the
destination.
There are also several escape sequences that you can use.
Escapes:
-------% Escapes:
%a armies carried by sender
%d sender damage percentage
%s sender shield percentage
%f sender fuel percentage
%w sender wtemp percentage
%e sender etemp percentage
%T team letter of sender
%c player number of sender
%E Boolean: true if etemped
%W Boolean: true if wtemped
%S sender ship type
%i(I) full sender name (capitalized)
%t team letter of target planet
%p number of target player
%g number of friendly target player
%h number of enemy target player
%n armies on target planet
%l(L) 3-letter abbreviation of target planet (capitalized)
%u(U) full target player name (capitalized)
%z(Z) 3-letter team id of target planet (capitalized)
%P number of player nearest your ship
%G number of nearest friendly player
%H number of nearest enemy player
%b(B)
3-letter abbreviation of nearest planet (capitalized)
%v average ping round trip time
%V standard deviation of ping time
%y packet loss
%m(M) last message (capitalized)
%% a literal %
%? start a test
%{ conditional
%* abort the macro and print nothing (useful in conditionals)
%2 1 if server is a paradise server, 0 otherwise.
%
<space>, does nothing. Allows macros to start with blank space.
$ Escapes:
start with a $
field 1:
(n)earest
(thing nearest your ship)
(t)arget (thing nearest the mouse)
(s)elf (doesn't have fields 2 and 3)
(_) ego (has no other fields)
field 2:
(a)ny
(t)eammate
(f)riendly
(h)ostile
field 3:
(a)ny
(u)ser (player)
(p)lanet (includes asteroids)
(s)tar
(n)ebula
(b)lack hole
(^) non-planet
(*) any stellar object
field 4: (optional)
(U)ppercase
(C)apitalize
(L)owercase
NYI
field 5:
full (n)ame (Hammor, Thought)
(i)dentifier (e.g. R5, Ka, Can, Sco)
(#) number (0-9a-z for players, %d for planets)
(t)eam name (Romulan)
(s)hort team id (ROM)
(l)etter of team (R)
(a)rmies
(@) sector
(A)rable, 0=not arable, 1=arable but not AGRI, 2=AGRI
(M)etal, 0, 1, 2(repair), or 3(sy)
(D)ilithium, 0, 1 or 2(fuel)
Example:
$nhuUn
would print the nearest hostile user's name in uppercase.
Tests:
-----%?lhs [=<>] rhs
lhs and rhs can be specials (the percentages are good for this, as
are the booleans)
A test will be replaced with either a 1 (true) or 0 (false).
a
test is followed by a conditional.
Note that no '!=' exists.
Usually,
It is not necessary (see Conditionals).
Conditionals:
------------Conditionals (%{) use the previous position to determine what to
print.
All conditionals are of the format:
<boolean>%{[text][%!][test]%}
The %! is a separator. If <boolean> is true, then the text
immediately to
the right of the first %{ is printed, otherwise the text after the %! is
printed. If only true text needs to be printed, the %! can be ignored.
Either
side can be empty. For example:
1%{true%!false%}
would print 'true'.
%E%{ETEMP!%}
would print 'ETEMP!' if you're etemped.
test:
Here's an example using a
%?%f<15%{NO GAS!%!%f%% fuel%}
which will print 'NO GAS' if your fuel is less than 15%, otherwise it
will
'<your fuel percentage>% fuel'. Tests and conditionals can be nested.
SingleMacro:
-----------SingleMacro allows normal netrek keys to be replaced with a macro.
These
keys will then override the normal netrek command. The syntax for the
.xtrekrc entry is:
SingleMacro:
<list of keys>
For example:
SingleMacro:
xyzABC
The list of keys should all be macros defined elsewhere in your
.xtrekrc.
Once the SingleMacro line is added, then to send that macro you no longer
have to be in macro mode. Just press the macro key (in this case, one of
x,y,z,A,B, or C). The macro will be parsed and sent immediately (or, if
the
destination is missing you will be asked for the destination).
SingleMacro keys can also be remapped. If you remap 'd' to be 'A' in
your
keymap, then when you press 'd', the 'A' macro will be sent.
Note that any key you assign to a macro is 'hidden' and cannot be used
without using the alt key keymap backdoor (press alt-key and the original
interpretation is used instead of the keymap or singlemacro
interpretation).
Examples:
--------Here are some examples from my (Thought's) .xtrekrc:
mac.a.T:
%?%n<0%{TOUCH %2%{$tasUi->%}%L!%!%2%{$tasLi->%}%l@%n%}
mac.b.T:
bomb %2%{$tasLi->%}%l%?%n>4%{ @ %n%} %2%{%?$tapD>1%{
FUEL%}%?$tapA=2%{ AGRI%}%?$tapM>1%{ REPAIR%}%?$tapM>2%{ SHIPYARD%}%}
mac.c:
Carrying %?%a>0%{%a arm%?%a=1%{y.%!ies.%}%!no armies.%}
#mac.d.T:
%E%{%!%W%{%!I'm fine.%}%}%E%{ETEMPED!!!
%}%W%{WTEMPED!!! %}Carrying %?%a>0%{%a armies!%!NO armies.%}
mac.d.T:
ogg %p
mac.e.T:
Need ESCORT to %l%?%a>0%{, carrying %a arm%?%a=1%{y%!ies!%}%}
mac.f.T:
%2%{$tasi->%}%l @ %n
mac.g.T:
going to %l%?%a>0%{, carrying %a arm%?%a=1%{y%!ies!%}%}
#mac.h.T:
%E%{ETEMPED!!! %}%W%{WTEMPED!!! %}Carrying %?%a>0%{%a
armies!%!NO armies.%}
#mac.i.A: test macro to all
#mac.j:
Help! Carrying %a!!
mac.m:
%m
mac.n:
no
mac.o:
ok
# pig call (5 spaces). %<space> prints nothing, so % + 6 spaces.
mac.p.A:
%
mac.q.%i: queue
mac.r.%H: resistance is futile
mac.s.T:
We need a sc bomber.
mac.t.T:
no t-mode :(
mac.t:
thanks
#mac.u.%i: test u macro to self
mac.v:
%T%c PING stats: Average: %v ms, Stdv: %V ms, Loss: %y%%
mac.x.T:
%L!
mac.y:
yes
#mac.A.T:
Help! Carrying %a!!
#mac.B.T: BOMB!!!! Using an AS!
#mac.C.%i: CAPTAIN
mac.D.T:
%p++ near %l
#mac.E.T: Ignore that last distress
mac.R:
resistance is not futile??
#mac.G.T: Ogg %p!
#mac.G:
Go to %l
mac.I.%u: %u: det when you escort!
mac.K.A:
KissMy%S
#mac.N.%i: NEWGALAXY
mac.O.%u: (%i) ogging
#mac.R.A:
I'm a %?%S=SB%{star base!%!twink!%}
#mac.S.%i: START
#mac.T.%i: %Z
mac.T.T:
T-MODE!
#mac.X.T: EMERGENCY @ %L!!
# new distresses
singleMacro:
EF
mac.F.T:
%?%S=SB%{Your starbase (%i) is carrying %?%a=0%{NO%!%a%}
%?%a=1%{army%!armies%}%!%T%c@%B: I have %?%a=0%{NO%!%a%}
%?%a=1%{army%!armies%} on board%}
mac.E.T:
HELP! %T%c@%B: %?%a=0%{%!%a %?%a=1%{army,%!armies,%}%}
%?%d>10%{%d%% dam, %}%?%s<90%{%?%s<15%{NO%!%s%%%} shlds, %}%?%f<15%{NO
fuel %!%?%f<90%{%?%S=SB%{%!%f%% fuel %}%}%E%{ETMP!!
%}%W%{WTMP!!%!%?%w>90%{%w%% wtmp%}%}
-----------------------------------------------------------------------------Send additions and corrections to paradise-workers@reed.edu.
Credits:
-------This document was written by Robert Forsman (Hammor) and Bill Dyess
(Thought).
The original % codes spec and singlemacro idea was stolen from BRM.
The % codes code was written by Bill Dyess.
The Paradise macro engine was designed and written by Bill Dyess.
The Paradise SingleMacro code was written by Bill Dyess
The $ codes were invented and written by Robert Forsman.
Download