Jump to content
  • 0

R>Countdown Waitroom


Mihael

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  130
  • Reputation:   70
  • Joined:  09/03/14
  • Last Seen:  

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
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  130
  • Reputation:   70
  • Joined:  09/03/14
  • Last Seen:  

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.

❤️

Link to comment
Share on other sites

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.

×
×
  • Create New...