5 * Created by Alyssa Milburn on Mon Dec 19 2005.
6 * Copyright (c) 2005 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
26 * monikers are auto-created when referenced by name, so the hasMoniker() asserts should be removed
30 HIST CAGE (integer) moniker (string) event (integer)
33 void caosVM::v_HIST_CAGE() {
34 VM_PARAM_INTEGER(event
)
35 VM_PARAM_STRING(moniker
)
37 caos_assert(world
.history
.hasMoniker(moniker
));
38 monikerData
&m
= world
.history
.getMoniker(moniker
);
39 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
40 result
.setInt(m
.events
[event
].stage
);
44 HIST COUN (integer) moniker (string)
47 void caosVM::v_HIST_COUN() {
48 VM_PARAM_STRING(moniker
)
50 if (world
.history
.hasMoniker(moniker
)) {
51 monikerData
&m
= world
.history
.getMoniker(moniker
);
52 result
.setInt(m
.events
.size());
59 HIST CROS (integer) moniker (string)
62 void caosVM::v_HIST_CROS() {
63 VM_PARAM_STRING(moniker
)
65 caos_assert(world
.history
.hasMoniker(moniker
));
66 result
.setInt(world
.history
.getMoniker(moniker
).no_crossover_points
);
70 HIST EVNT (command) moniker (string) type (integer) relatedmoniker1 (string) relatedmoniker2 (string)
73 Fire a life event of the specified type with the specified moniker.
75 void caosVM::c_HIST_EVNT() {
76 VM_PARAM_STRING(relatedmoniker2
)
77 VM_PARAM_STRING(relatedmoniker1
)
78 VM_PARAM_INTEGER(type
)
79 VM_PARAM_STRING(moniker
)
81 caos_assert(world
.history
.hasMoniker(moniker
));
82 monikerData
&m
= world
.history
.getMoniker(moniker
);
83 m
.addEvent(type
, relatedmoniker1
, relatedmoniker2
);
87 HIST FIND (integer) moniker (string) event (integer) from (integer)
90 void caosVM::v_HIST_FIND() {
91 VM_PARAM_INTEGER(from
)
92 VM_PARAM_INTEGER(event
)
93 VM_PARAM_STRING(moniker
)
95 caos_assert(world
.history
.hasMoniker(moniker
));
96 monikerData
&m
= world
.history
.getMoniker(moniker
);
98 for (int i
= from
+ 1; i
>= 0 && (unsigned int)i
< m
.events
.size(); i
++) {
99 if (m
.events
[i
].eventno
== (unsigned int)event
) {
109 HIST FINR (integer) moniker (string) event (integer) from (integer)
112 void caosVM::v_HIST_FINR() {
113 VM_PARAM_INTEGER(from
)
114 VM_PARAM_INTEGER(event
)
115 VM_PARAM_STRING(moniker
)
117 caos_assert(world
.history
.hasMoniker(moniker
));
118 monikerData
&m
= world
.history
.getMoniker(moniker
);
120 if (from
== -1) from
= m
.events
.size();
122 for (int i
= from
- 1; i
>= 0 && (unsigned int)i
< m
.events
.size(); i
--) {
123 if (m
.events
[i
].eventno
== (unsigned int)event
) {
133 HIST FOTO (string) moniker (string) event (integer)
136 void caosVM::v_HIST_FOTO() {
137 VM_PARAM_INTEGER(event
)
138 VM_PARAM_STRING(moniker
)
140 caos_assert(world
.history
.hasMoniker(moniker
));
141 monikerData
&m
= world
.history
.getMoniker(moniker
);
142 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
144 result
.setString(m
.events
[event
].photo
);
148 HIST FOTO (command) moniker (string) event (integer) photo (string)
151 void caosVM::c_HIST_FOTO() {
152 VM_PARAM_STRING(photo
)
153 VM_PARAM_INTEGER(event
)
154 VM_PARAM_STRING(moniker
)
156 caos_assert(world
.history
.hasMoniker(moniker
));
157 monikerData
&m
= world
.history
.getMoniker(moniker
);
158 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
160 // TODO: handle magic (ie, atticing old photo)
161 m
.events
[event
].photo
= photo
;
165 HIST GEND (integer) moniker (string)
168 void caosVM::v_HIST_GEND() {
169 VM_PARAM_STRING(moniker
)
171 caos_assert(world
.history
.hasMoniker(moniker
));
172 monikerData
&m
= world
.history
.getMoniker(moniker
);
174 result
.setInt(m
.gender
);
178 HIST GNUS (integer) moniker (string)
181 void caosVM::v_HIST_GNUS() {
182 VM_PARAM_STRING(moniker
)
184 caos_assert(world
.history
.hasMoniker(moniker
));
185 monikerData
&m
= world
.history
.getMoniker(moniker
);
187 result
.setInt(m
.genus
);
191 HIST MON1 (string) moniker (string) event (integer)
194 void caosVM::v_HIST_MON1() {
195 VM_PARAM_INTEGER(event
)
196 VM_PARAM_STRING(moniker
)
198 caos_assert(world
.history
.hasMoniker(moniker
));
199 monikerData
&m
= world
.history
.getMoniker(moniker
);
200 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
202 result
.setString(m
.events
[event
].monikers
[0]);
206 HIST MON2 (string) moniker (string) event (integer)
209 void caosVM::v_HIST_MON2() {
210 VM_PARAM_INTEGER(event
)
211 VM_PARAM_STRING(moniker
)
213 caos_assert(world
.history
.hasMoniker(moniker
));
214 monikerData
&m
= world
.history
.getMoniker(moniker
);
215 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
217 result
.setString(m
.events
[event
].monikers
[1]);
221 HIST MUTE (integer) moniker (string)
224 void caosVM::v_HIST_MUTE() {
225 VM_PARAM_STRING(moniker
)
227 caos_assert(world
.history
.hasMoniker(moniker
));
228 monikerData
&m
= world
.history
.getMoniker(moniker
);
230 result
.setInt(m
.no_point_mutations
);
234 HIST NAME (string) moniker (string)
237 Return the name of the creature with the given moniker.
239 void caosVM::v_HIST_NAME() {
240 VM_PARAM_STRING(moniker
)
242 caos_assert(world
.history
.hasMoniker(moniker
));
243 monikerData
&m
= world
.history
.getMoniker(moniker
);
245 result
.setString(m
.name
);
249 HIST NAME (command) moniker (string) name (string)
252 void caosVM::c_HIST_NAME() {
253 VM_PARAM_STRING(name
)
254 VM_PARAM_STRING(moniker
)
256 caos_assert(world
.history
.hasMoniker(moniker
));
257 monikerData
&m
= world
.history
.getMoniker(moniker
);
263 HIST NETU (string) moniker (string) event (integer)
266 void caosVM::v_HIST_NETU() {
267 VM_PARAM_INTEGER(event
)
268 VM_PARAM_STRING(moniker
)
270 caos_assert(world
.history
.hasMoniker(moniker
));
271 monikerData
&m
= world
.history
.getMoniker(moniker
);
272 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
274 result
.setString(m
.events
[event
].networkid
);
278 HIST NEXT (string) moniker (string)
281 void caosVM::v_HIST_NEXT() {
282 VM_PARAM_STRING(moniker
)
284 result
.setString(""); // TODO
288 HIST PREV (string) moniker (string)
291 void caosVM::v_HIST_PREV() {
292 VM_PARAM_STRING(moniker
)
294 result
.setString(""); // TODO
298 HIST RTIM (integer) moniker (string) event (integer)
301 void caosVM::v_HIST_RTIM() {
302 VM_PARAM_INTEGER(event
)
303 VM_PARAM_STRING(moniker
)
305 caos_assert(world
.history
.hasMoniker(moniker
));
306 monikerData
&m
= world
.history
.getMoniker(moniker
);
307 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
309 result
.setInt(m
.events
[event
].timestamp
);
313 HIST TAGE (integer) moniker (string) event (integer)
316 void caosVM::v_HIST_TAGE() {
317 VM_PARAM_INTEGER(event
)
318 VM_PARAM_STRING(moniker
)
320 caos_assert(world
.history
.hasMoniker(moniker
));
321 monikerData
&m
= world
.history
.getMoniker(moniker
);
322 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
324 result
.setInt(m
.events
[event
].tage
);
328 HIST TYPE (integer) moniker (string) event (integer)
331 void caosVM::v_HIST_TYPE() {
332 VM_PARAM_INTEGER(event
)
333 VM_PARAM_STRING(moniker
)
335 caos_assert(world
.history
.hasMoniker(moniker
));
336 monikerData
&m
= world
.history
.getMoniker(moniker
);
337 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
339 result
.setInt(m
.events
[event
].eventno
);
343 HIST UTXT (command) moniker (string) event (integer) value (string)
346 void caosVM::c_HIST_UTXT() {
347 VM_PARAM_STRING(value
)
348 VM_PARAM_INTEGER(event
)
349 VM_PARAM_STRING(moniker
)
351 caos_assert(world
.history
.hasMoniker(moniker
));
352 monikerData
&m
= world
.history
.getMoniker(moniker
);
353 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
355 m
.events
[event
].usertext
= value
;
359 HIST UTXT (string) moniker (string) event (integer)
362 void caosVM::v_HIST_UTXT() {
363 VM_PARAM_INTEGER(event
)
364 VM_PARAM_STRING(moniker
)
366 caos_assert(world
.history
.hasMoniker(moniker
));
367 monikerData
&m
= world
.history
.getMoniker(moniker
);
368 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
370 result
.setString(m
.events
[event
].usertext
);
374 HIST VARI (integer) moniker (string)
377 void caosVM::v_HIST_VARI() {
378 VM_PARAM_STRING(moniker
)
380 caos_assert(world
.history
.hasMoniker(moniker
));
381 monikerData
&m
= world
.history
.getMoniker(moniker
);
383 result
.setInt(m
.variant
);
387 HIST WIPE (command) moniker (string)
390 void caosVM::c_HIST_WIPE() {
391 VM_PARAM_STRING(moniker
)
393 caos_assert(world
.history
.hasMoniker(moniker
));
394 monikerData
&m
= world
.history
.getMoniker(moniker
);
400 HIST WNAM (string) moniker (string) event (integer)
403 void caosVM::v_HIST_WNAM() {
404 VM_PARAM_INTEGER(event
)
405 VM_PARAM_STRING(moniker
)
407 caos_assert(world
.history
.hasMoniker(moniker
));
408 monikerData
&m
= world
.history
.getMoniker(moniker
);
409 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
411 result
.setString(m
.events
[event
].worldname
); // TODO
415 HIST WTIK (integer) moniker (string) event (integer)
418 void caosVM::v_HIST_WTIK() {
419 VM_PARAM_INTEGER(event
)
420 VM_PARAM_STRING(moniker
)
422 caos_assert(world
.history
.hasMoniker(moniker
));
423 monikerData
&m
= world
.history
.getMoniker(moniker
);
424 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
426 result
.setInt(m
.events
[event
].worldtick
);
430 HIST WUID (string) moniker (string) event (integer)
433 void caosVM::v_HIST_WUID() {
434 VM_PARAM_INTEGER(event
)
435 VM_PARAM_STRING(moniker
)
437 caos_assert(world
.history
.hasMoniker(moniker
));
438 monikerData
&m
= world
.history
.getMoniker(moniker
);
439 caos_assert(event
>= 0 && (unsigned int)event
< m
.events
.size());
441 result
.setString(m
.events
[event
].worldmoniker
);
445 HIST WVET (integer) moniker (string)
448 void caosVM::v_HIST_WVET() {
449 VM_PARAM_STRING(moniker
)
451 caos_assert(world
.history
.hasMoniker(moniker
));
452 monikerData
&m
= world
.history
.getMoniker(moniker
);
461 OOWW (integer) moniker (string)
464 Return the current status of the given moniker.
465 0 is unknown (never existed?), 1 is in slot, 2 is NEW: CREA creature, 3 is BORN creature, 4 is exported, 5 is dead, 6 is gone (no body), 7 is unreferenced.
467 void caosVM::v_OOWW() {
468 VM_PARAM_STRING(moniker
)
472 if (world
.history
.hasMoniker(moniker
)) {
473 monikerData
&m
= world
.history
.getMoniker(moniker
);
475 result
.setInt((int)m
.getStatus());
480 EVNT (command) object (agent)
482 %pragma variants c1 c2
484 void caosVM::c_EVNT() {
485 VM_PARAM_VALIDAGENT(object
)
491 RMEV (command) object (agent)
493 %pragma variants c1 c2
495 void caosVM::c_RMEV() {
496 VM_PARAM_VALIDAGENT(object
)
504 %pragma variants c1 c2
506 void caosVM::c_DDE_NEGG() {
513 %pragma variants c1 c2
515 void caosVM::c_DDE_DIED() {
522 %pragma variants c1 c2
524 void caosVM::c_DDE_LIVE() {