Carpet

Carpet

2M Downloads

suggestion : /tps , /mspt command to get value returned

aria1th opened this issue ยท 4 comments

commented

currently scarpet seems to not have any functions to get tps or mspt information, and there is no function to get it by values. even tick rate cannot give us current rate. the only way is to check gametick flow and dividing by mspt.
Adding /tps and /mspt command would make external access fluent and reliable, for some command line access or RCON things.

commented

There's the last_tick_times() function which gives the time taken (in ms) of the 100 most recent ticks. You can do last_tick_times():0 to get the time taken for the most recent tick, or x = 0; for(last_tick_times(), x += _) to get the sum of the time taken for each of the last 100 ticks (which you can then divide by 100 to get an average).

See https://github.com/gnembon/fabric-carpet/blob/master/docs/scarpet/language/LoopsAndHigherOrderFunctions.md

commented
mspt()->(
    for(last_tick_times(),tot_mspt+=_);
    tot_mspt/100
);

tps()->return(1000/mspt());
commented

well, /tick rate prints the current tick rate - why not returning a value as well. Other custom features could be handled with a simple app as suggested here, especially that now apps return their numerical result as a result of a command.

commented

well, just checked. /tick rate already returns the value as the command success count.