The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timer/memory
Author Message
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #1
Timer/memory
Can someone please remind me how to put a timer on a player that will tick down whether the player is online or offline?

Having a brain fart

[Image: 2nis46r.jpg]
09-10-2012 03:07 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #2
RE: Timer/memory
place it on ground, lock down and link it.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
09-10-2012 03:17 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #3
RE: Timer/memory
Well yes I know that one, thought there was a better way...

never mind...

[Image: 2nis46r.jpg]
(This post was last modified: 09-10-2012 06:56 AM by Mordaunt.)
09-10-2012 03:23 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #4
RE: Timer/memory
The timer should run normally when he is online and ticks normally.
When you want to tick when is offline, you should check if the script changes or effect anything in the world, or only changes tags or parameters of the character.

If the answer is the second:


ON=@LOGOUT

REF1 = <FINDID.i_memory_name_you_want.UID>
REF1.MORE2 = <SERV.TIME>
REF1.TAG.TEMP = <REF1.TIMER>
REF1.TIMER = -1

ON=@LOGIN

IF (<FINDID.i_memory_name_you_want.UID>)
REF1 = <FINDID.i_memory_name_you_want.UID>
IF !(<REF1.TAG0.TEMP>) // If there is no TAG
SERV.LOG Error: <NAME> without TAG.TEMP!
REF1.MORE2 = <SERV.TIME>
REF1.TAG.TEMP = <REF1.TIMER>
ENDIF

LOCAL.TIME_ELAPSED = <EVAL ((<SERV.TIME> - <REF1.MORE2>)/10)>

IF (<LOCAL.TIME_ELAPSED> < 0) // SERV.TIME can reset to 0 for long periods of time
LOCAL.TIME_ELAPSED = 0
ENDIF

IF (<LOCAL.TIME_ELAPSED> < <REF1.TAG.TEMP>) // Less time than a Timer
REF1.TIMER = <EVAL <REF1.TAG.TEMP> - <LOCAL.TIME_ELAPSED>>
ELSE
// Calculate how many loops the timer does, calculating a division and his rest
// Set how many time the timer has left (divisionĀ“s rest)
// Apply the effect of the timer on the player
ENDIF
REF1.TAG.TEMP=
ENDIF
(This post was last modified: 09-10-2012 08:25 AM by Gil Amarth.)
09-10-2012 08:22 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #5
RE: Timer/memory
Did it a far simpler way with serv.time

[Image: 2nis46r.jpg]
09-10-2012 09:02 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #6
RE: Timer/memory
Can you post your solution?
09-10-2012 09:13 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #7
RE: Timer/memory
It was simply a way of preventing the use of a button on a gump for 24hrs after it had been used.

So when the gump is called the arguement for that particular button being visable and useable is

Code:
if (<eval (<serv.time>-<tag0.reztoken>)/10> > 86400 )

If the difference between serv.time & the tag which is what serv.time was the last time the button was used is bigger than 24hr (in seconds) the button is available, and on use it rewrites the tag with the current serv.time

[Image: 2nis46r.jpg]
09-10-2012 11:03 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #8
RE: Timer/memory
Ah, ok.

My timer was from my raising skill system, my players can gain skill online or offline, so I had to calculate how many times the timer fired when they were offline.
(This post was last modified: 09-13-2012 06:53 AM by Gil Amarth.)
09-13-2012 06:33 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #9
RE: Timer/memory
well... you could do that a similar way....

tag their last time on in serv.time, tag their logon time in serv.time, calculate the difference and then divide by however long the time is to get the number of times the timer would have fired and then apply.

Infact you should be able to call their last online time as it is saved against their account.
I just dont recall how to get it.

[Image: 2nis46r.jpg]
(This post was last modified: 09-13-2012 08:55 AM by Mordaunt.)
09-13-2012 08:42 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #10
RE: Timer/memory
Yes, but with that system the players can not raise his skills online, they need to re-login to launch the script.

What I needed was a timer who worked online and offline, and it works, but I wonder if it was a easier way. Optimization is always desired. Smile
09-13-2012 08:11 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)