SphereCommunity
Real Time - Printable Version

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

Pages: 1 2


Real Time - Alias - 05-19-2012 06:00 PM

Hi, Could some1 give me scp who spawn for example bandage at 16:00 i made lil scp by my self but it wont work every time 1 time it work another no ...

Code:
[ITEMDEF i_real_timespameris]
NAME=Real TimeL
ID=i_floor_marble
  
ON=@CREATE
TIMER=1
COLOR=04af
ATTR=attr_invis

ON=@TIMER
TIMER=1
IF STRMATCH("*16:00","<rtime.hoursek>")
serv.newitem i_bandage
NEW.P = 4304,984
NEW.UPDATE
TIMER=61
ELSE
SAY <RTIME.HOURSEK>
endfor
RETURN 1
ENDIF



[FUNCTION rtime.hoursek]
return <strsub 10 6 <serv.rtime>>



RE: Real Time - Crusader - 05-19-2012 06:26 PM

since the script doesn't work properly....u say that sometimes it works, sometimes not....my idea is that the timer check comes too late. So my idea is to use timerD instead of timer that checks every tenth of sec.
since this check is more heavy i'll start doing it only 10 mins before 16.00.

Code:
[ITEMDEF i_real_timespameris]
NAME=Real TimeL
ID=i_floor_marble
  
ON=@CREATE
TIMER=1
COLOR=04af
ATTR=attr_invis

ON=@TIMER
TIMERD=1 //TimerD more precise
IF STRMATCH("*16:00","<rtime.hoursek>")
serv.newitem i_bandage
NEW.P = 4304,984
NEW.UPDATE
TIMER=3000*24 // since u have to do every 24 hours i'll put the timerd fast check after 23 hours and 50mins
ELSE
SAY <RTIME.HOURSEK>
endfor   // <- ???
RETURN 1
ENDIF



[FUNCTION rtime.hoursek]
return <strsub 10 6 <serv.rtime>>

try and lemme know if it works.

If it works, the matter is only about the timer check, and u can improve my mod in some ways after that ^^


RE: Real Time - admin phoenix - 05-20-2012 01:23 AM

try to regulate it with the function f_onserver_timer


RE: Real Time - Alias - 05-21-2012 06:14 PM

Tyvm Crusader for idea but admin phoenix how to do it i think it will be more easier with onserver_timer


RE: Real Time - admin phoenix - 05-21-2012 07:59 PM

you have got the problem that your sector will sleep after some time if no one enter the sector.
this means that your timer will not count anymore.
and if you have 1000 of this spawns you will have 1000 timer more on your shard.
with the onserver_timer function you can check (maybe) every 5 min. if the time has come and it is 16:00 o'clock.
if this is true make and foritems loop and let´s spawn the monsters.
that´s for me, the best solution but maybe others will also work.

with the method I controll my headhunter system.
every saturday at 17:00 o'clock the headhunter system restarts on my server.

it works very good.


RE: Real Time - Alias - 05-21-2012 09:49 PM

(05-21-2012 07:59 PM)admin phoenix Wrote:  you have got the problem that your sector will sleep after some time if no one enter the sector.
this means that your timer will not count anymore.
and if you have 1000 of this spawns you will have 1000 timer more on your shard.
with the onserver_timer function you can check (maybe) every 5 min. if the time has come and it is 16:00 o'clock.
if this is true make and foritems loop and let´s spawn the monsters.
that´s for me, the best solution but maybe others will also work.

with the method I controll my headhunter system.
every saturday at 17:00 o'clock the headhunter system restarts on my server.

it works very good.
ok tyvm 4 idea, but will this work ?

[function f_onserver_timer]
IF STRMATCH("*16:00","<rtime.hoursek>")
serv.newitem i_bandage
NEW.P = 4304,984
NEW.UPDATE
RETURN 1
ENDIF


RE: Real Time - admin phoenix - 05-21-2012 10:25 PM

check it out Smile

remember that you have to set your timer call in the sphere ini.
I use 5 minutes.


RE: Real Time - Alias - 05-21-2012 11:43 PM

(05-21-2012 10:25 PM)admin phoenix Wrote:  check it out Smile

remember that you have to set your timer call in the sphere ini.
I use 5 minutes.
ok ty )


RE: Real Time - Alias - 05-24-2012 05:11 PM

Sorry for double post.
But could some1 give me an example how to set item spawn with f_onserver_timer ?
I try a lot but could get it to work ...
Thanks.


RE: Real Time - admin phoenix - 05-24-2012 07:57 PM

why to set a new spawn item?
check the time via f_onserver_timer and when it is 16:00 o´clock make and
foritem 6400, search for this "special" spawn and restart the timer of the spawn