Mihael Posted December 2, 2019 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 130 Reputation: 73 Joined: 09/03/14 Last Seen: June 3, 2023 Share Posted December 2, 2019 (edited) Hi boomers, I am creating an offer npc that appears 1 time each month, and would like to put a code inside the waitroom that shows the amount of days left until the start of that offer. Like this: Day 1: Next Offer Appears in: 30D at 21:00 Automatic in Day 2: Next Offer Appears in: 29D at 21:00 Automatic in Day 3: Next Offer Appears in: 28D at 21:00 In last Day: OFFER DAY !!! How could I do this? Edited December 2, 2019 by Mihael Quote Link to comment Share on other sites More sharing options...
0 Mabuhay Posted December 2, 2019 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 446 Reputation: 232 Joined: 03/20/12 Last Seen: October 22, 2020 Share Posted December 2, 2019 2 hours ago, Mihael said: Hi boomers, I am creating an offer npc that appears 1 time each month, and would like to put a code inside the waitroom that shows the amount of days left until the start of that offer. Like this: Day 1: Next Offer Appears in: 30D at 21:00 Automatic in Day 2: Next Offer Appears in: 29D at 21:00 Automatic in Day 3: Next Offer Appears in: 28D at 21:00 In last Day: OFFER DAY !!! How could I do this? Something like this: prontera,154,184,0 script Test CountDown 123,{ end; OnInit: // when npc is initiated.. OnHour00: // resets every 00:00 delwaitingroom; .@end_day = 20; // 20th day of the month is the end time. .@time = gettime(DT_DAYOFMONTH); if ( .@end_day > .@time ) { waitingroom "Next offer appears in "+(.@end_day-.@time)+"D at 21:00",0; // Before offer day } else if ( .@end_day == .@time ) { waitingroom "OFFER DAY!",0; // During offer day } else { waitingroom "OFFER EXPIRED!",0; // After offer day } end; } 1 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted December 2, 2019 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: 12 hours ago Share Posted December 2, 2019 (edited) prontera,255,55,5 script NPC 123,{ if(!.active) end; mes "Event is active."; close; OnInit: OnHour00: .active = 0; function check_month_end; .@day = 10; .@months_end = check_month_end(); if(.@day > .@months_end) .@day = .@months_end; .@current_day = gettime(DT_DAYOFMONTH); if(.@current_day < .@day) waitingroom "Next offer appears in " + (.@day - .@current_day) + "D at 21:00",0; else if(.@current_day > .@day) waitingroom "Next offer appears in " + ((.@months_end - .@current_day) + .@day) + "D at 21:00",0; else { waitingroom "OFFER DAY!",0; .active = 1; } end; function check_month_end { .@month = gettime(DT_MONTH); switch(.@month){ case APRIL: case JUNE: case SEPTEMBER: case NOVEMBER: .@days = 30; break; case FEBRUARY: .@year = gettime(DT_YEAR); if(.@year % 4 == 0 && .@year % 100 != 0 || .@year % 400 == 0) .@days = 29; else .@days = 28; break; default: .@days = 31; break; } return .@days; } } Edited December 2, 2019 by crazyarashi 1 Quote Link to comment Share on other sites More sharing options...
0 Mihael Posted December 2, 2019 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 130 Reputation: 73 Joined: 09/03/14 Last Seen: June 3, 2023 Author Share Posted December 2, 2019 3 hours ago, Mabuhay said: Something like this: prontera,154,184,0 script Test CountDown 123,{ end; OnInit: // when npc is initiated.. OnHour00: // resets every 00:00 delwaitingroom; .@end_day = 20; // 20th day of the month is the end time. .@time = gettime(DT_DAYOFMONTH); if ( .@end_day > .@time ) { waitingroom "Next offer appears in "+(.@end_day-.@time)+"D at 21:00",0; // Before offer day } else if ( .@end_day == .@time ) { waitingroom "OFFER DAY!",0; // During offer day } else { waitingroom "OFFER EXPIRED!",0; // After offer day } end; } 1 hour ago, crazyarashi said: prontera,255,55,5 script NPC 123,{ if(!.active) end; mes "Event is active."; close; OnInit: OnHour00: .active = 0; function check_month_end; .@day = 10; .@months_end = check_month_end(); if(.@day > .@months_end) .@day = .@months_end; .@current_day = gettime(DT_DAYOFMONTH); if(.@current_day < .@day) waitingroom "Next offer appears in " + (.@day - .@current_day) + "D at 21:00",0; else if(.@current_day > .@day) waitingroom "Next offer appears in " + ((.@months_end - .@current_day) + .@day) + "D at 21:00",0; else { waitingroom "OFFER DAY!",0; .active = 1; } end; function check_month_end { .@month = gettime(DT_MONTH); switch(.@month){ case APRIL: case JUNE: case SEPTEMBER: case NOVEMBER: .@days = 30; break; case FEBRUARY: .@year = gettime(DT_YEAR); if(.@year % 4 == 0 && .@year % 100 != 0 || .@year % 400 == 0) .@days = 29; else .@days = 28; break; default: .@days = 31; break; } return .@days; } } BOOOOOOOOM, Solved! That was it, thanks to the 2 comrades. Quote Link to comment Share on other sites More sharing options...
Question
Mihael
Hi boomers,
I am creating an offer npc that appears 1 time each month, and would like to put a code inside the waitroom that shows the amount of days left until the start of that offer.
Like this:
Day 1:
Next Offer Appears in: 30D at 21:00
Automatic in Day 2:
Next Offer Appears in: 29D at 21:00
Automatic in Day 3:
Next Offer Appears in: 28D at 21:00
In last Day:
OFFER DAY !!!
How could I do this?
Edited by MihaelLink to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.