Jump to content
  • 0

Keep Daily Attendance Timer after DC


Bisuke

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   10
  • Joined:  04/02/12
  • Last Seen:  

Hi! I'm using Sader's Attendance Mod,

I just want to ask, if how can I modify this code so that when a player got disconnected, he/she can still continue the timer after login?

Is there a way to do it?

 

Currently, my script work this way

1. Player will login, and wait for 1hr.

2. They need to talk to the Attendance Checker to verify their attendance

3. After verification, they can now claim their daily reward.

 

-	script	DailyLogin	-1,{

OnPCLoginEvent:

	if(Baselevel < 75) {
	dispbottom "You must be level 75 before you qualify for Daily Attendance.";
	end;
	}

	if(get_attendance_requirement()){
		dispbottom "You already got the attendance today.";
		end;
	}


if(#DailyReward > gettimetick(2)) {
	dispbottom .n$+": You can't currently recieve the Daily Reward, you still have to wait "+callfunc("Time2Str",#DailyReward);
	dispbottom .n$+": After this, visit the Attendance NPC in Prontera.";
	end;
}
set #DailyReward,0;
dispbottom .n$+": Stay active for "+( (.rew_login%3600 == 0)?.rew_login/3600+" Hour(s)":.rew_login/60+" Minute(s)")+" to receive the Daily Reward.";
dispbottom .n$+": Then talk to the Attendance NPC in Prontera.";
attachnpctimer;
initnpctimer;
end;

OnTimer60000: // Every Minute
stopnpctimer;
set @daily,@daily + 60;
if(@daily == .rew_login) {
	set @daily,0;
	if(.rew_type == 2)
		set @DailyReward,DT_DAYOFMONTH;
	else 
		set @DailyReward,Daily + 1;
	dispbottom .n$+": You can now recieve your Daily Reward. Please visit the Attendance NPC in Prontera.",.bc_self;
	end;
}
attachnpctimer;
initnpctimer;
end;

OnInit:
set .n$,"[Attendance]";
set .rew_time,72000; // Timer until next Reward in seconds
// How long does someone have to stay online to recieve the reward in seconds
// Default: 3600 = 1 Hour
// Minimum: 60 = 1 Minute, because the Timer checks every Minute
set .rew_login,3600;
// Reward Type:
// 1 = Continues Reward
// 2 = Depending on day
set .rew_type,1;
end;

}

vip_lounge,71,124,6	script	Attendance Checker	888,{

	if(Baselevel < 75) {
	dispbottom "You must be at least level 75 to get your daily attendance bonus.";
	end;
	}

	if(get_attendance_requirement()){
		mes "You already got the attendance today.";
		end;
	}
	

mes .n$;
mes "Welcome, "+strcharinfo(0)+"!";
if(!@DailyReward) {
	mes "I'm sorry, but you can't recieve your Daily Reward yet. You still have to wait for "+callfunc("Time2Str",(getvariableofnpc(.rew_login,"DailyLogin")-@daily)+gettimetick(2));
	next;
	mes "Talk to me when the timer is finished.";
	close;
}
mes "Your attendance has been verified. Click at the arrow button below your Alt+V.";
set_attendance_requirement();
set #DailyReward,gettimetick(2) + .rew_time;
if(getvariableofnpc(.rew_type,"DailyLogin") == 1)
	set Daily,@DailyReward;
set @DailyReward,0;
next;
mes "Press Alt+V and click Attendance Check";
next;
mes "Then click the prize of the day. Your item will be sent via RODex.";
next;
mes "Check your RODex mail to get your item.";
close;

}

prontera,147,175,6	duplicate(Attendance Checker)	Attendance Checker#prt	888

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

change all

@daily
@DailyReward

to

#daily
#DailyReward

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

On 10/22/2019 at 11:24 PM, Bisuke said:

Hi! I'm using Sader's Attendance Mod,

I just want to ask, if how can I modify this code so that when a player got disconnected, he/she can still continue the timer after login?

Is there a way to do it?

 

Currently, my script work this way

1. Player will login, and wait for 1hr.

2. They need to talk to the Attendance Checker to verify their attendance

3. After verification, they can now claim their daily reward.

 


-	script	DailyLogin	-1,{

OnPCLoginEvent:

	if(Baselevel < 75) {
	dispbottom "You must be level 75 before you qualify for Daily Attendance.";
	end;
	}

	if(get_attendance_requirement()){
		dispbottom "You already got the attendance today.";
		end;
	}


if(#DailyReward > gettimetick(2)) {
	dispbottom .n$+": You can't currently recieve the Daily Reward, you still have to wait "+callfunc("Time2Str",#DailyReward);
	dispbottom .n$+": After this, visit the Attendance NPC in Prontera.";
	end;
}
set #DailyReward,0;
dispbottom .n$+": Stay active for "+( (.rew_login%3600 == 0)?.rew_login/3600+" Hour(s)":.rew_login/60+" Minute(s)")+" to receive the Daily Reward.";
dispbottom .n$+": Then talk to the Attendance NPC in Prontera.";
attachnpctimer;
initnpctimer;
end;

OnTimer60000: // Every Minute
stopnpctimer;
set @daily,@daily + 60;
if(@daily == .rew_login) {
	set @daily,0;
	if(.rew_type == 2)
		set @DailyReward,DT_DAYOFMONTH;
	else 
		set @DailyReward,Daily + 1;
	dispbottom .n$+": You can now recieve your Daily Reward. Please visit the Attendance NPC in Prontera.",.bc_self;
	end;
}
attachnpctimer;
initnpctimer;
end;

OnInit:
set .n$,"[Attendance]";
set .rew_time,72000; // Timer until next Reward in seconds
// How long does someone have to stay online to recieve the reward in seconds
// Default: 3600 = 1 Hour
// Minimum: 60 = 1 Minute, because the Timer checks every Minute
set .rew_login,3600;
// Reward Type:
// 1 = Continues Reward
// 2 = Depending on day
set .rew_type,1;
end;

}

vip_lounge,71,124,6	script	Attendance Checker	888,{

	if(Baselevel < 75) {
	dispbottom "You must be at least level 75 to get your daily attendance bonus.";
	end;
	}

	if(get_attendance_requirement()){
		mes "You already got the attendance today.";
		end;
	}
	

mes .n$;
mes "Welcome, "+strcharinfo(0)+"!";
if(!@DailyReward) {
	mes "I'm sorry, but you can't recieve your Daily Reward yet. You still have to wait for "+callfunc("Time2Str",(getvariableofnpc(.rew_login,"DailyLogin")-@daily)+gettimetick(2));
	next;
	mes "Talk to me when the timer is finished.";
	close;
}
mes "Your attendance has been verified. Click at the arrow button below your Alt+V.";
set_attendance_requirement();
set #DailyReward,gettimetick(2) + .rew_time;
if(getvariableofnpc(.rew_type,"DailyLogin") == 1)
	set Daily,@DailyReward;
set @DailyReward,0;
next;
mes "Press Alt+V and click Attendance Check";
next;
mes "Then click the prize of the day. Your item will be sent via RODex.";
next;
mes "Check your RODex mail to get your item.";
close;

}

prontera,147,175,6	duplicate(Attendance Checker)	Attendance Checker#prt	888

 

i try this script and i'm getting an error like

 

parse_simpleexpr: unmatched 

 

 

EDIT: FIX

 

if(get_attendance_requirement()){
Edited by Takuyakii
FIX
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

On 10/22/2019 at 11:24 PM, Bisuke said:

Hi! I'm using Sader's Attendance Mod,

I just want to ask, if how can I modify this code so that when a player got disconnected, he/she can still continue the timer after login?

Is there a way to do it?

 

Currently, my script work this way

1. Player will login, and wait for 1hr.

2. They need to talk to the Attendance Checker to verify their attendance

3. After verification, they can now claim their daily reward.

 


-	script	DailyLogin	-1,{

OnPCLoginEvent:

	if(Baselevel < 75) {
	dispbottom "You must be level 75 before you qualify for Daily Attendance.";
	end;
	}

	if(get_attendance_requirement()){
		dispbottom "You already got the attendance today.";
		end;
	}


if(#DailyReward > gettimetick(2)) {
	dispbottom .n$+": You can't currently recieve the Daily Reward, you still have to wait "+callfunc("Time2Str",#DailyReward);
	dispbottom .n$+": After this, visit the Attendance NPC in Prontera.";
	end;
}
set #DailyReward,0;
dispbottom .n$+": Stay active for "+( (.rew_login%3600 == 0)?.rew_login/3600+" Hour(s)":.rew_login/60+" Minute(s)")+" to receive the Daily Reward.";
dispbottom .n$+": Then talk to the Attendance NPC in Prontera.";
attachnpctimer;
initnpctimer;
end;

OnTimer60000: // Every Minute
stopnpctimer;
set @daily,@daily + 60;
if(@daily == .rew_login) {
	set @daily,0;
	if(.rew_type == 2)
		set @DailyReward,DT_DAYOFMONTH;
	else 
		set @DailyReward,Daily + 1;
	dispbottom .n$+": You can now recieve your Daily Reward. Please visit the Attendance NPC in Prontera.",.bc_self;
	end;
}
attachnpctimer;
initnpctimer;
end;

OnInit:
set .n$,"[Attendance]";
set .rew_time,72000; // Timer until next Reward in seconds
// How long does someone have to stay online to recieve the reward in seconds
// Default: 3600 = 1 Hour
// Minimum: 60 = 1 Minute, because the Timer checks every Minute
set .rew_login,3600;
// Reward Type:
// 1 = Continues Reward
// 2 = Depending on day
set .rew_type,1;
end;

}

vip_lounge,71,124,6	script	Attendance Checker	888,{

	if(Baselevel < 75) {
	dispbottom "You must be at least level 75 to get your daily attendance bonus.";
	end;
	}

	if(get_attendance_requirement()){
		mes "You already got the attendance today.";
		end;
	}
	

mes .n$;
mes "Welcome, "+strcharinfo(0)+"!";
if(!@DailyReward) {
	mes "I'm sorry, but you can't recieve your Daily Reward yet. You still have to wait for "+callfunc("Time2Str",(getvariableofnpc(.rew_login,"DailyLogin")-@daily)+gettimetick(2));
	next;
	mes "Talk to me when the timer is finished.";
	close;
}
mes "Your attendance has been verified. Click at the arrow button below your Alt+V.";
set_attendance_requirement();
set #DailyReward,gettimetick(2) + .rew_time;
if(getvariableofnpc(.rew_type,"DailyLogin") == 1)
	set Daily,@DailyReward;
set @DailyReward,0;
next;
mes "Press Alt+V and click Attendance Check";
next;
mes "Then click the prize of the day. Your item will be sent via RODex.";
next;
mes "Check your RODex mail to get your item.";
close;

}

prontera,147,175,6	duplicate(Attendance Checker)	Attendance Checker#prt	888

 

how to recieve reward on this script ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   10
  • Joined:  04/02/12
  • Last Seen:  

6 hours ago, Takuyakii said:

how to recieve reward on this script ?

Basically, upon login, there will be a 1 hr timer on your character. Then if you played 1 hr, you will talk to the Attendance Checker to verify your attendance, by giving you this 

set_attendance_requirement();

it's @sader1992's Attendance MOD that gives you ability to customize how you can claim. Then after verification, you can now get attendance from attendance window.

 

My query is how can I save timer when the player logs out.

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...