SphereCommunity
Timer - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Timer (/Thread-Timer)



Timer - mrkarlo - 05-06-2015 03:08 AM

hey!!
I want to make some timer on command "home home home". Only one time can use it in 24h.
It's possible? And how will it look.


RE: Timer - Van Glan Bloom - 05-06-2015 07:10 AM

You can make something like this :

Code:
[FUNCTION Home]
IF <src.restest 1 home_timer>
SRC.SYSMESSAGE  @09c1 You need wait a X minutes.
RETURN 1
elseif (<SRC.FLAGS> & statf_dead)
src.sysmessage  @09c1 You will be teleporter in 45 secounds ...
elseif !<src.restest 1 home_memory>
src.newitem home_memory
src.act.equip
elseif !<src.restest 1 home_timer>
src.newitem home_timer
src.act.equip
endif

[ITEMDEF home_memory]
ID=i_memory
TYPE=t_eq_script
NAME=home Memory

on=@create
attr=04

ON=@equip
timer=1

on=@timer
cont.go 6116,1234,1  // define your area
cont.flags=<cont.tag.flags>
cont.tag.flags=
remove
return 1

[ITEMDEF home_timer]
ID=i_memory
TYPE=t_eq_script
NAME=home Timer

on=@create
attr=04
TIMER=84600

ON=@equip
timer=1

on=@timer
IF (<MORE>>0)
more=<more>-1
TIMER=1
ELSE
REMOVE
ENDIF
RETURN 1



RE: Timer - XuN - 05-06-2015 04:21 PM

And if you want to make it to work in the 'home home home', you'll have to add 'home' to speech:

Code:
[SPEECH spk_player]
// All players speech filtered through here.
ON=home home home   //   Ghosts can go home.
   IF (<FLAGS>&statf_dead)
      go <home> // <-- change this line to: home
   endif

EDIT: This is inside sphere_speech.scp


RE: Timer - mrkarlo - 05-07-2015 03:00 AM

Van Glan Bloom, Xun thank you guys!!


RE: Timer - mrkarlo - 05-08-2015 01:59 AM

I need lil information! How to insert into the sysmessage the number of minutes remaining till next try?


RE: Timer - Extreme - 05-08-2015 09:16 AM

Quick help

PHP Code:
ON=home home home
IF (<TAG0.HOMEHOMEHOME> > <SERV.TIME>)
 
SYSMESSAGE @026,,1 You need wait for <EVAL <TAG0.HOMEHOMEHOME>/10seconds to use this again.
 RETURN 
1
ELIF 
(<SRC.FLAGS> & STATF_DEAD)
 
GO <HOME>
 
TAG0.HOMEHOMEHOME <EVAL <SERV.TIME>+864000>
ENDIF 



RE: Timer - mrkarlo - 05-12-2015 01:19 AM

thanx Extreme. Serv.time+3600 its one hour? or +60?


RE: Timer - XuN - 05-12-2015 02:37 AM

serv.time is based on tenths of second so <serv.time>/10 gives you the seconds. 60*60*10 (36000) is the correct number.