Jump to content
  • 0

R>Countdown Waitroom


Question

Posted (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 by Mihael

3 answers to this question

Recommended Posts

  • 0
Posted
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;
}

 

  • MVP 1
  • 0
Posted (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 by crazyarashi
  • MVP 1
  • 0
Posted
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.

❤️

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...