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:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird Timer Issue
Author Message
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #1
Weird Timer Issue
Hey everyone! How's your day? =P

Something is driving me insane.

I currently have a problem with a very, very old script, that used to work just fine back in the days (or maybe I fooled myself all this time?! Sad)

Code:
[function rareSpawn]
if (0<var.rareSpawn.l1>)
try uid.<var.rareSpawn.l1>.remove
endif
if (0<var.rareSpawn.l1.uid>)
try uid.<var.rareSpawn.l1.uid>.remove
endif
newitem i_rareSpawn_l1
new.p 5448,1079
new.timer 1

[ITEMDEF i_rareSpawn_l1]
ID=01ed2
TYPE=t_eq_script
Name=Rare Spawn Level 1 Manager

ON=@CREATE
timer = 5
attr=08090
var.rareSpawn.l1.uid = <uid>
       

ON=@TIMER
if (0<var.rareSpawn.l1>)
try uid.<var.rareSpawn.l1>.remove
endif
       
dorand 5
tag.pos = 4171,3697
tag.pos = 4290,752
tag.pos = 3333,333,4
tag.pos = 1274,534,30
tag.pos = 1162,2906
enddo
       
dorand 3
tag.type = horse
tag.type = llama
tag.type = ostard
enddo
       
dorand 3
tag.race = frost
tag.race = earth
tag.race = fire
enddo
       
newitem i_worldgem_bit
var.rareSpawn.l1 = <new.uid>
new.p = <tag.pos>
new.type 34
new.amount 1
new.more c_<tag.race>_<tag.type>
new.morep 1440 1441 15
new.attr 00b0
new.timer 1
timer = 86400 // 24 HOURS
return 1

As you can see, it is a random spawner. It picks a POS, TYPE and RACE and spawns. After the timer in the manager, it removes the spawn and picks another POS, TYPE and RACE.

Problem is: Apparently, it is working, but it's not!

When I check locations, they have the same mount as the day before after the 24 hours have passed.
I then, check the manager with .tweak/.info and the time for the next spawn is exactly and always the 86400 (24 hours).
Alright, I go back to the locations and boom, a new POS/TYPE/RACE was picked...

But the weirdest thing is that if you test with lower times, it will work just fine, without me having to .info it!

Now I wonder, why is .info triggering it? Why does it work with low times and not with high times?

Thanks everyone for reading!
(This post was last modified: 08-31-2013 07:41 PM by pinku.)
08-31-2013 07:39 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Weird Timer Issue
It's possible that is related to Sectors sleeping (timer stop ticking if there are no players in a sector for a while), maybe you can use timerf.
(This post was last modified: 08-31-2013 10:17 PM by darksun84.)
08-31-2013 10:14 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #3
RE: Weird Timer Issue
Also, the spawner various spawner items (a function creates a spawner item which then creates another spawner item) may need a decay flag for the timer to fire properly when it does eventually reach that point.

As Dark said, sectors with no people in them tick slower than others... so time passes, but at a fraction of normal.
09-01-2013 12:30 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: #4
RE: Weird Timer Issue
Check this: Random Rares

Inspired by your problem.

[Image: 2nis46r.jpg]
09-02-2013 11:55 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #5
RE: Weird Timer Issue
The problem was indeed the sectors.
I ran some tests with it and can't be anything else.

Fool me, I didn't know about this before. Sad

Thank you both dark and Ran!

(09-02-2013 11:55 AM)Mordaunt Wrote:  Check this: Random Rares

Inspired by your problem.

I feel honored but I know I should not. xD
Thanks Mourdant, it is a big help!
09-02-2013 07:03 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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