annotate example-tfrc.txt @ 1670:3a089138b01c

Updates and improvements to the example tfrc.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 01 Mar 2024 12:51:33 +0200
parents caf0149b5bc6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1666
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
2 ;; Personal settings
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
4 ;; Turn logging off, while we set things up
117
d3643da73ca2 Logging on/off
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
5 /log off
62
e59c66c05dd6 Added example tfrc in repository
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
1666
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
7 ;; Add some worlds
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
8 /test addworld("bat", "lp.*", "bat.org", 23, "myname", "password")
802
6a6148691919 Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 749
diff changeset
9
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
10
1666
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
11 ;; Set player character name before loading scripts.
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
12 ;; You need to set this to your character name, for example "Ggr"
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
13 /eval /set set_plrname=Mycharname
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
14
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
15 ;; Savefiles should be stored under to this directory.
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
16 ;; The example here uses $HOME/.ggrtf/ which works for *NIX style systems.
802
6a6148691919 Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 749
diff changeset
17 /eval /set set_datapath=%{HOME}/.ggrtf/
6a6148691919 Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 749
diff changeset
18
6a6148691919 Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 749
diff changeset
19 ;; We want savefiles to use filename prefix "bat-"
630
3e30be528df3 Updated example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
20 /eval /set set_saveprefix=bat-
62
e59c66c05dd6 Added example tfrc in repository
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
22
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
23 ;; Define a helper macro to load modules from under user home directory
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
24 ;; $HOME/ggrtf/ -- adjust this as necessary
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
25 /def -i gloadmod = /eval /load %{HOME}/tf/%{*}
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
26
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
27
1228
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
29 ;; Character set / locale
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
30 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
31 ;; You MAY need to set your character set encoding/locale to have
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
32 ;; non-ASCII characters work properly in BatMUD. This is outside of
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
33 ;; the scope of GgrTF, but it is discussed in more depth in the
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
34 ;; user manual.
1228
9b877b23d32f Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 1219
diff changeset
35
1666
caf0149b5bc6 Minor updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1348
diff changeset
36 ;; This setting needs to match an installed locale for *NIX style systems.
1348
990445077bc6 Update to match newer style locale charset names.
Matti Hamalainen <ccr@tnsp.org>
parents: 1228
diff changeset
37 ;/setenv LANG=en_US.iso88591
1028
ad10256f6ff5 Add some examples of BatMUD-compatible defacto locale setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
38
ad10256f6ff5 Add some examples of BatMUD-compatible defacto locale setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
39 ;; You may also try following settings if ISO-8859-1 does not work:
1348
990445077bc6 Update to match newer style locale charset names.
Matti Hamalainen <ccr@tnsp.org>
parents: 1228
diff changeset
40 ; /setenv LANG=en_US.iso885915
1028
ad10256f6ff5 Add some examples of BatMUD-compatible defacto locale setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
41 ; /setenv LANG=en_US.latin1
ad10256f6ff5 Add some examples of BatMUD-compatible defacto locale setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
42
ad10256f6ff5 Add some examples of BatMUD-compatible defacto locale setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
43
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
45 ;; Load GgrTF
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
46 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62
e59c66c05dd6 Added example tfrc in repository
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
48 ;; The preloader module MUST be loaded first
630
3e30be528df3 Updated example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
49 /gloadmod ggrtf-pre.tf
749
59ed1f7d616e Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 630
diff changeset
50
59ed1f7d616e Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 630
diff changeset
51 ;; And the main module after that ...
630
3e30be528df3 Updated example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
52 /gloadmod ggrtf.tf
749
59ed1f7d616e Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 630
diff changeset
53
1102
49923d46f8c8 Update example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1028
diff changeset
54 ;; Some useful modules: mangler, placer, spellname translator
49923d46f8c8 Update example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1028
diff changeset
55 /gloadmod gm-pssmangle.tf
1127
2e3f5cd1f6b9 Fix example tfrc's module loading order.
Matti Hamalainen <ccr@tnsp.org>
parents: 1102
diff changeset
56 /gloadmod gm-magical.tf
2e3f5cd1f6b9 Fix example tfrc's module loading order.
Matti Hamalainen <ccr@tnsp.org>
parents: 1102
diff changeset
57 /gloadmod gm-tgtcast.tf
1102
49923d46f8c8 Update example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1028
diff changeset
58 /gloadmod gm-pplacer.tf
49923d46f8c8 Update example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1028
diff changeset
59 /gloadmod gm-spellnames.tf
49923d46f8c8 Update example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1028
diff changeset
60 /gloadmod gm-tf5.tf
49923d46f8c8 Update example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1028
diff changeset
61
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
62 ;; Load additional modules now
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
63 /gloadmod gm-rais.tf
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
64 /gloadmod gm-tarma.tf
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
65 /gloadmod gm-nun.tf
749
59ed1f7d616e Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 630
diff changeset
66
59ed1f7d616e Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 630
diff changeset
67
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
68 ;; Load previously saved settings after all modules are initialized
327
521d0c3233bd v0.5.10.0: Major cleanup of namespace, many functions and variables renamed
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
69 /gload
62
e59c66c05dd6 Added example tfrc in repository
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
e59c66c05dd6 Added example tfrc in repository
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
72 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
73 ;; Load keyboard support files
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
74 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
630
3e30be528df3 Updated example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
75 ;; Bind some keys
3e30be528df3 Updated example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
76 /gloadmod kbd-xterm.tf
3e30be528df3 Updated example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
77 /gloadmod kbd-tf5def.tf
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
78
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
79 ;; Some personal keybinds here ...
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
80 ;/def -i -b'^[Om' = @smode
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
81 ;/def -i -b'^[Ok' = @cmode
62
e59c66c05dd6 Added example tfrc in repository
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
83
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
84 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
85 ;; (Re-)start logging
893
523b56594842 Update tfrc example to match new module names, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
86 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
87 ;; Function that returns log filename without directory path
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
88 ;; Example returns: "YYYY-MM-DD-worldname-charname.log"
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
89 /def -i prget_log_filename =\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
90 /return strcat(ftime("%Y-%m-%d"), "-", fg_world, "-", tolower(set_plrname), ".log")
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
91
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
92
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
93 ;; Start logging to a file
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
94 /def -i prlogfile_start =\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
95 /set logfile_enabled=1%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
96 /set logfile_prevtime=$[time()]%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
97 /set set_logfile=$[strcat(set_logdir, prget_log_filename())]%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
98 /eval /log %{set_logfile}
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
99
1001
9de765ecdb63 Add several examples of enabling logging.
Matti Hamalainen <ccr@tnsp.org>
parents: 893
diff changeset
100
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
101 ;; On world connection establish, begin logging
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
102 /def -i -F -p9999 -hCONNECT ghook_log_start =\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
103 /log OFF%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
104 /prlogfile_start
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
105
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
106 ;; On world disconnect, stop logging
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
107 /def -i -F -p9999 -hDISCONNECT ghook_log_stop =\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
108 /set logfile_enabled=0%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
109 /log OFF
1001
9de765ecdb63 Add several examples of enabling logging.
Matti Hamalainen <ccr@tnsp.org>
parents: 893
diff changeset
110
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
111 ;; On date change, restart logging
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
112 /def -i glogfile_check_date =\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
113 /if (logfile_enabled & ftime("%Y-%m-%d", logfile_prevtime) !~ ftime("%Y-%m-%d"))\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
114 /msq Day changed, switching logfile ...%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
115 /log OFF%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
116 /prlogfile_start%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
117 /endif%;\
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
118 /set logfile_prevtime=$[time()]
1001
9de765ecdb63 Add several examples of enabling logging.
Matti Hamalainen <ccr@tnsp.org>
parents: 893
diff changeset
119
1670
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
120 /eval /if (!logfile_timer) /repeat -1 i /glogfile_check_date%;/endif
3a089138b01c Updates and improvements to the example tfrc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1666
diff changeset
121 /set logfile_timer=1