Timer/memory - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Timer/memory (/Thread-Timer-memory) Pages: 1 2 |
Timer/memory - Mordaunt - 09-10-2012 03:07 AM 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 RE: Timer/memory - Extreme - 09-10-2012 03:17 AM place it on ground, lock down and link it. RE: Timer/memory - Mordaunt - 09-10-2012 03:23 AM Well yes I know that one, thought there was a better way... never mind... RE: Timer/memory - Gil Amarth - 09-10-2012 08:22 AM 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 RE: Timer/memory - Mordaunt - 09-10-2012 09:02 AM Did it a far simpler way with serv.time RE: Timer/memory - Gil Amarth - 09-10-2012 09:13 AM Can you post your solution? RE: Timer/memory - Mordaunt - 09-10-2012 11:03 AM 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 RE: Timer/memory - Gil Amarth - 09-13-2012 06:33 AM 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. RE: Timer/memory - Mordaunt - 09-13-2012 08:42 AM 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. RE: Timer/memory - Gil Amarth - 09-13-2012 08:11 PM 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. |