howmanytimes()

As bugs and suggestions are fixed/implemented/rejected, they will be moved in here.
sh0e
Forum Maniac
Posts: 290
Joined: Mon Apr 19, 2004 6:13 pm

Post by sh0e »

crons.php howmanytimes(): if lasttime == 0 return 1
not sure if this is the "desired" behavior?

whats with the (blah)_last stuff?
can someone explain for example bmper_last or pvmarket_last?
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

that's when stuff was last run.
:wq
sh0e
Forum Maniac
Posts: 290
Joined: Mon Apr 19, 2004 6:13 pm

Post by sh0e »

are you sure?
why are the (blah)_last stored as $time - $time % 60 or something strangely complex rather than just $time?
its confusing me the way its being calculated
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

Because otherwise you'd get "turn delays", e.g. turns coming 7 minutes late, and such.
:wq
sh0e
Forum Maniac
Posts: 290
Joined: Mon Apr 19, 2004 6:13 pm

Post by sh0e »

ill look further into it and see if i can understand it better
but id like to mention that something isnt working completely right because pvt sell refills way too fast..

could someone verify whether my "fix" is the "desired" behavior?
sh0e
Forum Maniac
Posts: 290
Joined: Mon Apr 19, 2004 6:13 pm

Post by sh0e »

crons will execute more than they should
happens often if you trigger the crons quickly
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

howmanytimes($cannon_balls->fly());
:wq
Veranor
FAF Co-Programmer
Posts: 310
Joined: Mon Mar 08, 2004 8:12 pm

Post by Veranor »

The Beatles wrote: howmanytimes($cannon_balls->fly());

code: Select all

while(!callMan($man))  {
       $man->walkdown($road);
        $x++;
}
"The truth is a trap: you can not get it without it getting you; you cannot get the truth by capturing it, only by its capturing you." - Søren Kierkegaard
User avatar
Devari
Mr. -1
Posts: 3194
Joined: Wed Mar 10, 2004 5:02 am
Location: British Columbia, Canada

Post by Devari »

In the immortal words of Philip:

"Ah, you are a poet!"
If you go down to the woods today, you better not go alone
It's a lovely day in the woods today, but safer to stay at home
BECAUSE EVIL FREEN IS KILLING ALL THE TEDDY BEARS AT THEIR PICNIC
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

:D ROFL
:wq
sh0e
Forum Maniac
Posts: 290
Joined: Mon Apr 19, 2004 6:13 pm

Post by sh0e »

made a change to lib/pvtsellcron.php
got rid of explode.. not entirely sure if it really helped
but sell doesnt seem to refill immediately anymore

sell cron seems to still be allowed to trigger more than it should sometimes
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

Thanks for your work sh8e. It's very appreciated. I feel I'm a bit burned out now, so your review and work is a great relief.
:wq
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

Devari wrote: In the immortal words of Philip:

"Ah, you are a poet!"
*laughs* nice one :P
I do not have a signature, you must be imagining

http://florida4us.com/

Image
sh0e
Forum Maniac
Posts: 290
Joined: Mon Apr 19, 2004 6:13 pm

Post by sh0e »

when bmper (sell) is maxed out (8571 or 85.71%)
sell amounts can go negative (if the troops are high enough?)

anyhow sell cron still triggers when its not supposed to
not sure why at this point
Veranor
FAF Co-Programmer
Posts: 310
Joined: Mon Mar 08, 2004 8:12 pm

Post by Veranor »

I have no idea here so disregard if this seems obvious but, why is the return from howmanytimes() rounded instead of floored? Is that somehow related to the $time - $time % 60 thing?




Suppose something happens every 10 minutes. Event last occured at 11000 and the time now is 11300 (yes I know, 1970 was a long time ago), the event will be triggered because you round up:

(11300 - 11000) / (60 * 10) = 300 / (600) = .5 = 1 after rounding...

Last time will be stored as (11300) - (11300 % (600)) = 11300 - 500 = 10800?!

Now if the page is reaccessed, will it not happen again?

EDIT: I believe if you floor this resolves itself.
"The truth is a trap: you can not get it without it getting you; you cannot get the truth by capturing it, only by its capturing you." - Søren Kierkegaard
Post Reply
  • Members connected in real time

    🔒 Close the panel of connected members