5 * Created by Alyssa Milburn on Sat Jun 05 2004.
6 * Copyright (c) 2004 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.
24 #include <time.h> // gmtime and strftime
30 return speed factor of last ten ticks.
32 < 1.0 = engine is ticking faster than BUZZ rating. > 1.0 = engine is ticking slower.
34 You might want to use this to reduce the amount of agents created or the amount of processing done if the speed factor is above 1.0.
36 void caosVM::v_PACE() {
37 result
.setFloat(world
.pace
);
41 BUZZ (command) interval (integer)
44 void caosVM::c_BUZZ() {
45 VM_PARAM_INTEGER(interval
)
47 world
.ticktime
= interval
;
54 void caosVM::v_BUZZ() {
55 result
.setInt(world
.ticktime
);
62 Returns the day in the season of the current game world, starting at 0.
64 void caosVM::v_DATE() {
65 result
.setInt(world
.dayofseason
);
69 HIST DATE (integer) tick (integer)
72 Returns the day in the season of the current game world at the specified world tick, starting at 0. See DATE.
74 void caosVM::v_HIST_DATE() {
75 VM_PARAM_INTEGER(tick
)
77 result
.setInt(0); // TODO
83 %pragma variants c2 cv c3
85 Returns the current game world season. 0 is spring, 1 is summer, 2 is autumn and 3 is winter.
87 void caosVM::v_SEAN() {
88 result
.setInt(world
.season
);
92 HIST SEAN (integer) tick (integer)
95 Returns the current game world season at the specified world tick. 0 is spring, 1 is summer, 2 is autumn and 3 is winter. See SEAN.
97 void caosVM::v_HIST_SEAN() {
98 VM_PARAM_INTEGER(tick
)
100 result
.setInt(0); // TODO
107 Returns the time of day in the current game world. 0 is dawn, 1 is morning, 2 is afternoon, 3 is evening and 4 is night.
109 void caosVM::v_TIME() {
110 result
.setInt(world
.timeofday
);
114 HIST TIME (integer) tick (integer)
117 Returns the time of day in the current game world at the specified world tick. 0 is dawn, 1 is morning, 2 is afternoon, 3 is evening and 4 is night. See TIME.
119 void caosVM::v_HIST_TIME() {
120 VM_PARAM_INTEGER(tick
)
122 result
.setInt(0); // TODO
128 %pragma variants c2 cv c3
130 Returns the number of game years elapsed in the current world.
132 void caosVM::v_YEAR() {
133 result
.setInt(world
.year
);
137 HIST YEAR (integer) tick (integer)
140 Returns the number of game years elapsed at the specified world tick. See YEAR.
142 void caosVM::v_HIST_YEAR() {
143 VM_PARAM_INTEGER(tick
)
145 result
.setInt(0); // TODO
152 void caosVM::v_MSEC() {
153 result
.setInt(engine
.backend
->ticks());
157 WPAU (command) paused (integer)
160 If paused is 0, enable world ticks, otherwise (1) disable them.
162 void caosVM::c_WPAU() {
163 VM_PARAM_INTEGER(paused
)
172 Returns 1 if world ticks are paused, or 0 otherwise.
174 void caosVM::v_WPAU() {
175 result
.setInt(0); // TODO
179 PAUS (command) paused (integer)
182 If paused is 0, unpause target agent, otherwise (1) pause it.
184 void caosVM::c_PAUS() {
185 VM_PARAM_INTEGER(paused
)
189 targ
->paused
= paused
;
196 Returns 1 if target agent is paused, or 0 otherwise.
198 void caosVM::v_PAUS() {
208 RTIF (string) timestamp (integer) format (string)
211 Returns the result of strftime with the current timestamp and format.
213 void caosVM::v_RTIF() {
214 VM_PARAM_STRING(format
)
215 VM_PARAM_INTEGER(timestamp
)
217 char buffer
[1000]; // no idea what maximum length should be.. we can't really do this dynamically
218 time_t tstamp
= timestamp
;
219 strftime(buffer
, 1000, format
.c_str(), gmtime(&tstamp
)); // TODO: does gmtime return null?
221 result
.setString(buffer
);
228 void caosVM::v_RTIM() {
229 result
.setInt(time(0));
236 void caosVM::v_WTIK() {
237 result
.setInt(world
.worldtickcount
);
244 void caosVM::v_RACE() {
245 result
.setInt(world
.race
);
252 void caosVM::v_ETIK() {
253 result
.setInt(world
.tickcount
);
261 void caosVM::c_ASEA() {
270 void caosVM::v_TMOD() {
271 result
.setInt(world
.timeofday
); // TODO
279 void caosVM::v_SEAV() {
280 // TODO: hardcoding bad?
281 result
.setInt((world
.dayofseason
* 4) + world
.timeofday
);
288 void caosVM::v_DAYT() {
289 result
.setInt(0); // TODO
296 void caosVM::v_MONT() {
297 result
.setInt(0); // TODO