Jump to content
  • 0

How to save timer?


UnknownUser0317

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

Hi guys! I'm using this Script:

//===== Hourly Points Script =========================================
//===== By: ==========================================================
//= GorthexTiger modified by Nibi
//===== Current Version: =============================================
//= 1.0
//===== Compatible With: =============================================
//= Any eAthena Version
//===== Description: =================================================
//= Get Points every successful hours of gameplay, you cannot get
//= the points even if you miss a second or a minute. A player will
//= get a very big bonus if they played 3 hours consecutively
//= or without logging out of the game. If the player is vending
//= the script will then stop.
//===== Additional Comments: =========================================
//= You can modify the script to your liking.
//= The default points is Kafrapoints change it anyway if you like.
//= 1.1 = Check Chatting too
//= 1.2 = 5 Minute Idle Check & @at/@autotrade check.
//= 1.3 = Corrected the current balance line on 12 Hours Consecutive
//====================================================================
-	script	hourlypoints	-1,{
//--Start of the Script
OnPCLoginEvent:
	addtimer .timer,"hourlypoints::OnPointGet";
	end;
    
OnPointGet:
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle()>=.dlimit) {
		sleep2 .delay;
		if(.@mes$=="")
			dispbottom set(.@mes$,"The hourly points event haulted because you were vending, chatting, or idle.");
	}

	set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;
	dispbottom "You received "+.point_amt+" Kafrapoints by staying ingame for 1 hour";
	dispbottom "Current Balance = "+#KAFRAPOINTS+" Kafrapoints";
	set @consecutive_hour, @consecutive_hour + 1;

	//Check for 3 hours consecutive
	if(@consecutive_hour == 3) {
		set @consecutive_hour,0;
		set #KAFRAPOINTS, #KAFRAPOINTS + .cpoint_amt;
		dispbottom "You receive "+.cpoint_amt+" Kafrapoints in playing for 12 consecutive hours";
		dispbottom "Current Balance = "+#KAFRAPOINTS+" Kafrapoints";
	}
	addtimer .timer,"hourlypoints::OnPointGet";
	end;

OnInit:
	set .timer, 1000*60*60; //Timer in milliseconds.
	set .cpoint_amt, 50; //Points gained for consecutive time online.
	set .point_amt, 10; //Normal points gained.
	set .delay, 1000; //Delay for idle re-check check.
	set .dlimit, 60*5; //Stop points if afk greater then in seconds.
}

How can i save the timer?

for example, I logout and login again, the remaining timer before will continue. Thank you so much.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

On 11/19/2016 at 0:01 PM, UnknownUser0317 said:

addtimer .timer,"hourlypoints::OnPointGet";

 

Change the temporary NPC timer to permanent player variable will fix.

answer: change .timer to timer

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

i see, thank you!

 

@Winz got this error:

[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: __setr (2 parameters):
[Debug]: Data: variable name='timer' index=0
[Debug]: Data: number value=3600000
[Debug]: Source (NPC): hourlypoints (invisible/not on a map)
[Error]: script:set: no player attached for player variable 'timer'

 

bump?

Edited by Emistry
Merged + Hidden Duplicated Content.
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

Here you go. This ones is based on minutes, not hours, so, at 180 minutes, the reward is coming.

-	script	hourlypoints	-1,{
//--Start of the Script
OnPCLoginEvent:
	addtimer .timer,"hourlypoints::OnPointGet";
	end;
    
OnPointGet:
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle()>=.dlimit) {
		sleep2 .delay;
		if(.@mes$=="")
			dispbottom set(.@mes$,"The hourly points event haulted because you were vending, chatting, or idle.");
	}

	set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;
	dispbottom "You received "+.point_amt+" Kafrapoints by staying ingame for 1 hour";
	dispbottom "Current Balance = "+#KAFRAPOINTS+" Kafrapoints";
	set consecutive_minutes, consecutive_minutes + 1;

	//Check for 3 hours consecutive
	if(consecutive_minutes == 3*60) {
		set consecutive_minutes,0;
		set #KAFRAPOINTS, #KAFRAPOINTS + .cpoint_amt;
		dispbottom "You receive "+.cpoint_amt+" Kafrapoints in playing for 12 consecutive hours";
		dispbottom "Current Balance = "+#KAFRAPOINTS+" Kafrapoints";
	}
	addtimer .timer,"hourlypoints::OnPointGet";
	end;

OnInit:
	set .timer, 1000*60; //Timer in milliseconds.
	set .cpoint_amt, 50; //Points gained for consecutive time online.
	set .point_amt, 10; //Normal points gained.
	set .delay, 1000; //Delay for idle re-check check.
	set .dlimit, 60*5; //Stop points if afk greater then in seconds.
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

@Omnipotent my request is i want to save timers even i logout, then login again. the timer will continue.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

@UnknownUser0317 yeah, I also did that. It was just better to use minutes.

Link to comment
Share on other sites

  • 0

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

change the addtimer to check every short interval and save in a variable to allow you to count it later.

example:

https://pastebin.com/ry0JJp6U

https://pastebin.com/Gqs8WCRu

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  11/07/16
  • Last Seen:  

On 12/9/2016 at 2:12 PM, Emistry said:

change the addtimer to check every short interval and save in a variable to allow you to count it later.

example:

https://pastebin.com/ry0JJp6U

https://pastebin.com/Gqs8WCRu

Sir @Emistry can you add for checking if the character is on Vending or autotrade the timer will not count.

thanks

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