… | |
… | |
120 | You got royalties there! Wanna have! |
120 | You got royalties there! Wanna have! |
121 | |
121 | |
122 | You may want to change the C<name> method there to something like C<title>, |
122 | You may want to change the C<name> method there to something like C<title>, |
123 | C<slaying> or any other method that is allowed to be called on a |
123 | C<slaying> or any other method that is allowed to be called on a |
124 | C<cf::object> here. |
124 | C<cf::object> here. |
|
|
125 | |
|
|
126 | =item B<matching for an item name and removing the matched item> |
|
|
127 | |
|
|
128 | @match found earhorn |
|
|
129 | @cond grep $_->slaying =~ /Gramp's walking stick/, $who->inv |
|
|
130 | @eval my @g = grep { $_->slaying =~ /Gramp's walking stick/ } $who->inv; $g[0]->decrease; |
|
|
131 | Thanks for the earhorn! |
|
|
132 | |
|
|
133 | This example is a bit more complex. The C<@eval> statement will search |
|
|
134 | the players inventory for the same term as the C<@cond> and then |
|
|
135 | decreases the number of objects used there. |
|
|
136 | |
|
|
137 | (See also the map: C<scorn/houses/cornerbrook.map> for an example how this is |
|
|
138 | used in the real world :-) |
125 | |
139 | |
126 | =back |
140 | =back |
127 | |
141 | |
128 | =item @eval perl |
142 | =item @eval perl |
129 | |
143 | |
… | |
… | |
198 | When a state argument is given it should be either 0 or 1. 1 will 'push' the connection |
212 | When a state argument is given it should be either 0 or 1. 1 will 'push' the connection |
199 | and 0 will 'release' the connection. This is useful for example when you want to |
213 | and 0 will 'release' the connection. This is useful for example when you want to |
200 | let a npc control a door. |
214 | let a npc control a door. |
201 | |
215 | |
202 | Trigger all objects with the given connected-id by 'releasing' the connection. |
216 | Trigger all objects with the given connected-id by 'releasing' the connection. |
|
|
217 | |
|
|
218 | =item @playersound face-name |
|
|
219 | |
|
|
220 | Plays the given sound face (either an alias or sound file path) so that |
|
|
221 | only the player talking to the npc can hear it. |
|
|
222 | |
|
|
223 | =item @npcsound face-name |
|
|
224 | |
|
|
225 | Plays the given sound face (either an alias or sound file path) as if |
|
|
226 | the npc had made that sound, i.e. it will be located at the npc and all |
|
|
227 | players near enough can hear it. |
203 | |
228 | |
204 | =item @addtopic topic |
229 | =item @addtopic topic |
205 | |
230 | |
206 | Adds the given topic names (separated by C<|>) to the list of topics |
231 | Adds the given topic names (separated by C<|>) to the list of topics |
207 | returned. |
232 | returned. |
… | |
… | |
248 | @match = $msg =~ /$args/i |
273 | @match = $msg =~ /$args/i |
249 | or next topic; |
274 | or next topic; |
250 | |
275 | |
251 | } elsif ($cmd eq "comment") { |
276 | } elsif ($cmd eq "comment") { |
252 | # nop |
277 | # nop |
|
|
278 | |
|
|
279 | } elsif ($cmd eq "playersound") { |
|
|
280 | $self->{ob}->contr->play_sound (cf::sound::find $args); |
|
|
281 | |
|
|
282 | } elsif ($cmd eq "npcsound") { |
|
|
283 | $self->{npc}->play_sound (cf::sound::find $args); |
253 | |
284 | |
254 | } elsif ($cmd eq "cond") { |
285 | } elsif ($cmd eq "cond") { |
255 | cf::safe_eval $args, %vars |
286 | cf::safe_eval $args, %vars |
256 | or next topic; |
287 | or next topic; |
257 | |
288 | |