Welcome to the Builder Academy

Question happyhour - changing from time remaining (hours/mins/secs) to (ticks)

More
24 Mar 2018 06:50 #7783 by Nero
Is it possible to change the happyhour show screen to show how many ticks are left in the bonus instead of hours/seconds/ticks?

And if so, how?

Thanks!

Please Log in or Create an account to join the conversation.

More
24 Mar 2018 13:11 - 24 Mar 2018 13:14 #7786 by lacrc
Hi Apoc, it's me again lol

The value of HAPPY_TIME represents the number of ticks left in the happy bonus.
So, all you have to do, is print only that value in show_happyhour() in act.other.c. Something like this:
Code:
static void show_happyhour(struct char_data *ch) { char happyexp[80], happygold[80], happyqp[80], happydmg[80]; if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) { sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM)); sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM)); sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM)); sprintf(happydmg, "%s+%d%%%s to Damage\r\n", CCYEL(ch, C_NRM), HAPPY_DMG, CCNRM(ch, C_NRM)); send_to_char(ch, "tbaMUD Happy Hour!\r\n" "------------------\r\n" "%s%s%s%sTime Remaining: %d ticks left.\r\n", (IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "", (IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "", (IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "", (IS_HAPPYDMG || (GET_LEVEL(ch) >= LVL_GOD)) ? happydmg: "", HAPPY_TIME); } else { send_to_char(ch, "Sorry, there is currently no happy hour!\r\n"); } }

If you wish to include both then it could be something like this:
Code:
static void show_happyhour(struct char_data *ch) { char happyexp[80], happygold[80], happyqp[80], happydmg[80]; int secs_left; if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) { if (HAPPY_TIME) secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick; else secs_left = 0; sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM)); sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM)); sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM)); sprintf(happydmg, "%s+%d%%%s to Damage\r\n", CCYEL(ch, C_NRM), HAPPY_DMG, CCNRM(ch, C_NRM)); send_to_char(ch, "tbaMUD Happy Hour!\r\n" "------------------\r\n" "%s%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs (%d ticks)\r\n", (IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "", (IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "", (IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "", (IS_HAPPYDMG || (GET_LEVEL(ch) >= LVL_GOD)) ? happydmg: "", CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM), HAPPY_TIME); } else { send_to_char(ch, "Sorry, there is currently no happy hour!\r\n"); } }
Both examples have a blatant disregard for color or formatting whatsoever, so sorry about that hehe
Also, in both examples you'll still see the message "Happy Hour Time set to 20 ticks (0 hours 25 mins and 0 secs)" when you turn happy hour on. Not sure if you also wanted to change that, so I'll wait.
Last edit: 24 Mar 2018 13:14 by lacrc.

Please Log in or Create an account to join the conversation.

More
24 Mar 2018 22:58 #7793 by Nero
Thanks for the response. This is what I want but somewhere the math isn't right for calculating the ticks
As you can see if I type happyhour this is what shows up with the top code you provided:

Bonus Time!
+0% to Damage
+0% to Experience per kill
+0% to Gold gained per kill
Time Remaining: 5368345 ticks

If I set happyhour default I get this:


Bonus Time!
+50% to Damage
+100% to Experience per kill
+50% to Gold gained per kill
Time Remaining: 5368345 ticks

Please Log in or Create an account to join the conversation.

More
24 Mar 2018 23:07 #7794 by Nero
Disregard last post. The top one you provided is working flawlessly and exactly what I wanted. Thanks for the assist!

Please Log in or Create an account to join the conversation.

Time to create page: 0.178 seconds