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-nmm6 (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-nmm6 (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-nmm6 (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
Real Time
Author Message
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #1
Real Time
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>>
05-19-2012 06:00 PM
Find all posts by this user Like Post Quote this message in a reply
Crusader
Master
**

Posts: 254
Likes Given: 7
Likes Received: 19 in 12 posts
Joined: Apr 2012
Reputation: 6

Erehwon New Hera

Post: #2
RE: Real Time
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 ^^
(This post was last modified: 05-19-2012 06:27 PM by Crusader.)
05-19-2012 06:26 PM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #3
RE: Real Time
try to regulate it with the function f_onserver_timer
05-20-2012 01:23 AM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #4
RE: Real Time
Tyvm Crusader for idea but admin phoenix how to do it i think it will be more easier with onserver_timer
05-21-2012 06:14 PM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #5
RE: Real Time
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.
05-21-2012 07:59 PM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #6
RE: Real Time
(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
05-21-2012 09:49 PM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #7
RE: Real Time
check it out Smile

remember that you have to set your timer call in the sphere ini.
I use 5 minutes.
(This post was last modified: 05-21-2012 10:25 PM by admin phoenix.)
05-21-2012 10:25 PM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #8
RE: Real Time
(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 )
05-21-2012 11:43 PM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #9
RE: Real Time
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.
05-24-2012 05:11 PM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #10
RE: Real Time
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
05-24-2012 07:57 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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