howmanytimes()
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
Alright, I'll do it.
Now reads as:
Now reads as:
code: Select all
function HowManyTimes($lasttime, $perminutes) {
global $time;
if($lasttime == 0)
return 1;
return floor(($time-$lasttime)/(60*$perminutes));
}"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
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
Yeah. That makes sense. And the purpose of the (time - time % (60 * perminutes)) is to ensure that turns don't continue to come X minutes later right? Really good work on the whole thing I must say.The Beatles wrote: The function of the lasttime == 0 line is to ensure if it's never been run yet, we only run it once.
"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
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
Eh, inevitable bugs. I certainly couldn't have done a better job. Besides, it is otherwise quite clean. 
Just as long as you don't use the same kind of thing as the ancient fakecron.php you gave me. Now, THAT was something that had some bugs.
Just as long as you don't use the same kind of thing as the ancient fakecron.php you gave me. Now, THAT was something that had some bugs.
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
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
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
I wrote one for something else a long time ago but I don't believe I gave it to Devari... I didn't write the WWII one I just helped him with it.
"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
On Terrouge, yes.
From my uber-nooblet days:

As a side note, when I look at my code on Ragnarok, I tend to cringe. I was quite clueless.
(http://www.declarus.com/ragnarok/ragnarok.tgz)
From my uber-nooblet days:
It worked, eventually, after a number of modifications. Then again, it was written up quickly on a whim, so it couldn't really be expected to be right on the mark.Yet I don't recommend you do that... turns does a lot of things. Instead I recommend you do something like... well, here's a simple solution I wrote up now:Make a file called fakecron.php. In it:Then somewhere in header.html, say, right after the call to printStatsBar(), put this:code: Select all
<? include('const.php'); $time = time(); $tmpdir = '/tmp'; $authhash = md5($dbpass); $lastrun = shell_exec("cat $tmpdir/prom_lastrun.txt"); shell_exec("echo $time > $tmpdir/prom_lastrun.txt"); $lastrun = round($lastrun); if($lastrun == 0) $lastrun = $time-1; $interval = $interval-$time; $times = floor($interval/$perminutes); for($i=0; $i<=$times; $i++) { echo "<img src='turns.php?auth=$authhash' width='0' height='0' border='0' />\n"; } ?>Then at the top of turns.php, where it goescode: Select all
require_once("fakecron.php");orcode: Select all
if($REQUEST_URI) {replace that line with:code: Select all
if($_SERVER["REQUEST_URI"]) {Then if you go to a server with crons, all you need to do is comment out that line in header.phpcode: Select all
if($_SERVER['REQUEST_URI'] && $_GET['auth'] != md5($dbpass)) {
Now, this solution works if you install it as I've written. However, /tmp gets cleared by random people often, so I suggest you create a dir called crontmpdir, and chmod it to 777, and set the $tmpdir variable to 'crontmpdir', NO leading slash.
You can do that via most FTP apps or this php script:
<?
shell_exec('mkdir crontmpdir');
shell_exec('chmod 0777 crontmpdir');
I'm of course assuming this is a *NIX host, as most hosts are. If it isn't, get a new host.
As a side note, when I look at my code on Ragnarok, I tend to cringe. I was quite clueless.
(http://www.declarus.com/ragnarok/ragnarok.tgz)
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
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
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
Bah. It WAS a hack job. My only acheivement was seamless integration of some FAF code. 
I added a couple major bugs, though. Two of the RWL bugs are fixed; the city demolition bug and the bldlst/trplst/prdlst bug.
I had the original BAXX code from the first release; I'm fairly sure that many of the bugs I have no longer exist. I'd hope, for RWL's sake, that they don't.
I added a couple major bugs, though. Two of the RWL bugs are fixed; the city demolition bug and the bldlst/trplst/prdlst bug.
I had the original BAXX code from the first release; I'm fairly sure that many of the bugs I have no longer exist. I'd hope, for RWL's sake, that they don't.
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
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
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
-
Members connected in real time