russ wrote:Modding templates while the round is running is a bit tricky, but doable.
Var v_start
var v_end
var v_inter
Const c_on = 0
Const c_off = 1
Const c_start = 0
Const c_end = 200
profiler.enable c_off
profiler.enableTimer c_start -> v_start
profiler.disableTimer c_end -> v_end
Utils.mathExprI v_end - v_start -> v_inter
if v_inter < 200
debug.debugOutputMessage "Timer on" 1
elseif v_inter > 200
debug.debugOutputMessage "Timer off" 1
endIf
Classical Modder wrote:I fixed the problem. I can confirm that the following code works correctly:
- Code: Select all
Var v_time
Const c_time1 = 3600
Const c_time2 = 1800
Const c_time3 = 900
Const c_time4 = 450
admin.timelimit -> v_time
if v_time < c_time4
admin.serverMessage "Test 4"
elseif v_time < c_time3
admin.serverMessage "Test 3"
elseif v_time < c_time2
admin.serverMessage "Test 2"
elseif v_time < c_time1
admin.serverMessage "Test 1"
endIf
This will output the correct message, which will be seen by everyone in the server I think (needs to be tested on an Internet server).
Even better still, an admin that has in-game rights can change the time limit with an alias like !timeXX, where XX is the amount of minutes (this is how they do it on SiMPLE). In a sense, this means that events can happen in-game depending on the time that is set by the admin.
For example, an admin could set the time to under 7.5 minutes and disable all weapons except zooks and knives, for a short zook and knives round. Of course, this still has to be tested. Working on it atm.
russ wrote:I did some more searching. You can start and stop timers, but the output is not consumable by scripts. There doesn't appear to be any way to get elapsed or remaining round time from within the console. It can only be obtained via the server info query port.
> ConsoleProfiler.enable 1
> ConsoleProfiler.report
No profiling data available
> ConsoleProfiler.startGlobalTimer
> ConsoleProfiler.report
No profiling data available
> ConsoleProfiler.stopGlobalTimer
> ConsoleProfiler.report
Frames: 1
Seconds: 10.8271
------------------
Average fps: 0.0923611
Min fps: 0.0923611
Max fps: 0.0923611
------------------
Average ms/frame: 10827.1
Min ms/frame: 10827.1
Max ms/frame: 10827.1
------------------
Process 0: userTime/f = 0.00ms [100000000376832.00, 0.00]
, kernelTime/f = 0.00ms [999999986991104.00, 0.00]
Threads:
0 Global timer 10827.0690 ms/f, 100.0000%
0 Global timer 0.00% (sum)
russ wrote:
- Code: Select all
> ConsoleProfiler.enable 1
> ConsoleProfiler.report
No profiling data available
> ConsoleProfiler.startGlobalTimer
> ConsoleProfiler.report
No profiling data available
> ConsoleProfiler.stopGlobalTimer
> ConsoleProfiler.report
Frames: 1
Seconds: 10.8271
------------------
Average fps: 0.0923611
Min fps: 0.0923611
Max fps: 0.0923611
------------------
Average ms/frame: 10827.1
Min ms/frame: 10827.1
Max ms/frame: 10827.1
------------------
Process 0: userTime/f = 0.00ms [100000000376832.00, 0.00]
, kernelTime/f = 0.00ms [999999986991104.00, 0.00]
Threads:
0 Global timer 10827.0690 ms/f, 100.0000%
0 Global timer 0.00% (sum)
Note that this appears to be tied into the renderer, so on dedicated the frames value isn't valid nor are any of the values derived from it.
Var v_start
var v_end
var v_inter
Const c_on = 0
Const c_off = 1
Const c_start = 0
Const c_end = 200
profiler.enable c_off
profiler.enableTimer c_start -> v_start
profiler.disableTimer c_end -> v_end
Utils.mathExprI v_end - v_start -> v_inter
if v_inter < 200
debug.debugOutputMessage "Timer on" 1
elseif v_inter > 200
debug.debugOutputMessage "Timer off" 1
endIf
Var v_start
var v_end
var v_inter
ConsoleProfiler.enable 1
ConsoleProfiler.report
ConsoleProfiler.startGlobalTimer -> v_start
ConsoleProfiler.stopGlobalTimer -> v_end
Utils.mathExprI v_end - v_start -> v_inter
if v_inter < 200
debug.debugOutputMessage "Timer on" 1
elseif v_inter > 200
debug.debugOutputMessage "Timer off" 1
endIf
Return to 1942 Modding Discussion
Users browsing this forum: No registered users and 86 guests