I decided to implement a Tick Timer and a Tick Counter for players to utilize within the do_date command located in act.wizard.c of the stock TBA source code. On my mud, this function was changed to, "do_time," and I am honestly so far removed from TBA stock code (about 12 years of additions at this point) that I am unsure if this will directly translate to the TBA source code. I strongly believe it will, and I hope someone else may see the need for a tick timer/counter to help their mortal player base keep track of when the next tick is coming so they can be prepared to down mobs, or whatever else. Keep in mind, on my mud the time between ticks is 75 seconds, and this may or may not need to be changed to suit your individual mud's tick time. In such a case, simply alter the instances of 75 to match those of your own mud's tick rate. Also, if this is for mortals, you may need to change the level in which the do_date feature becomes available to a PC. I'm not sure if TBA has it set to be an Admin level feature or not.
Hopefully this works for you if you need it. Let me know how it goes. Please, if you use it, give credit where it's due. Thanks!
Original Code
Code:
ACMD(do_date)
{
char timestr[25];
time_t mytime;
int d, h, m;
if (subcmd == SCMD_DATE)
mytime = time(0);
else
mytime = boot_time;
strftime(timestr, sizeof(timestr), "%c", localtime(&mytime));
if (subcmd == SCMD_DATE)
send_to_char(ch, "Current machine time: %s\r\n", timestr);
else {
mytime = time(0) - boot_time;
d = mytime / 86400;
h = (mytime / 3600) % 24;
m = (mytime / 60) % 60;
send_to_char(ch, "Up since %s: %d day%s, %d:%02d\r\n", timestr, d, d == 1 ? "" : "s", h, m);
}
}
Updated Code
Code:
ACMD(do_date)
{
char timestr[25];
time_t mytime;
int d, h, l, m, n;
if (subcmd == SCMD_DATE)
mytime = time(0);
else
mytime = boot_time;
strftime(timestr, sizeof(timestr), "%c", localtime(&mytime));
if (subcmd == SCMD_DATE)
send_to_char(ch, "Current machine time: %s\r\n", timestr);
else {
mytime = time(0) - boot_time;
d = mytime / 86400;
h = (mytime / 3600) % 24;
m = (mytime / 60) % 60;
l = (mytime / 75) % 75;
n = (((mytime / -1) % 75) + 75);
send_to_char(ch, "Up since %s: %d day%s, %d:%02d\r\n", timestr, d, d == 1 ? "" : "s", h, m);
send_to_char(ch, "Tick Counter: %d/75\r\n", l);
send_to_char(ch, "Tick Timer: %d seconds to next tick\r\n", n);
}
}