Games (inc Online)Teh Mine

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2799 In reply to 38140.2797 
Or if you've allowed php to do exec then exec the tail from a PHP which is refreshed by JS. Can PHP then get stdout? I''ve not used exec for yeeears.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ANT_THOMAS     
38140.2800 In reply to 38140.2797 
Yup I agree.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2801 In reply to 38140.2798 
Yeah I want it all in one rather than tailing it to another file because that's too many things going on then. I was just showing with the tail example of what I'm after.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2802 In reply to 38140.2799 
I'm not exactly good at PHP but I shall get reading!
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2803 In reply to 38140.2801 
Just read the file into PHP, chop the bit you want (last n lines) then spit it out. Pull it in all ajaxy-like from a constantly running JS function and that's it.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2804 In reply to 38140.2802 
Ahh ok. I think all you'd need there is file() or file_get_contents() and a bit of regex to pull out the actual chat messages. Actually, may as well use file() then recurse through the array (file() puts the lines of a file into an array) for ones which don't start with a chat message character and discard those. Shouldn't even need regex then, just strpos()
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2805 In reply to 38140.2804 
So does that only work for the start of a line?

Because the log looks like this...

code:
2011-08-04 18:22:00 [INFO] <Spooneymania> i mean yes
2011-08-04 18:22:03 [INFO] <Jeesus> :D
2011-08-04 18:22:25 [INFO] <Spooneymania> i started a hangout thingu
2011-08-04 18:26:57 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 
2011-08-04 18:36:27 [INFO] wakeupbomb [/94.193.54.69:57470] logged in with entity id 543938 at ([world] 965.90625, 72.0, 94.53125)
2011-08-04 18:36:31 [INFO] [PLAYER_COMMAND] wakeupbomb: /who  
2011-08-04 18:38:15 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 
2011-08-04 18:42:09 [INFO] [PLAYER_COMMAND] Spooneymania: /weather dry 
2011-08-04 18:44:30 [INFO] chrishigs [/86.154.231.70:51136] logged in with entity id 546382 at ([world] -53.995520489623885, 23.0, 221.17613932596916)
2011-08-04 18:44:30 [INFO] [PLAYER_COMMAND] wakeupbomb: /weather wet 
2011-08-04 18:44:41 [INFO] [PLAYER_COMMAND] chrishigs: /who  
2011-08-04 18:44:54 [INFO] [PLAYER_COMMAND] chrishigs: /home  
2011-08-04 18:44:57 [INFO] [PLAYER_COMMAND] chrishigs: /spawn  
2011-08-04 18:45:19 [INFO] [PLAYER_COMMAND] chrishigs: /home  
2011-08-04 18:45:33 [INFO] <wakeupbomb> test
2011-08-04 18:45:38 [INFO] <Spooneymania> 123
2011-08-04 18:48:29 [INFO] [PLAYER_COMMAND] chrishigs: /time day 
2011-08-04 18:51:20 [INFO] [PLAYER_COMMAND] wakeupbomb: /time day 
2011-08-04 18:57:34 [INFO] [PLAYER_COMMAND] chrishigs: /home  
2011-08-04 18:57:45 [INFO] [PLAYER_COMMAND] chrishigs: /sethome  
2011-08-04 18:57:59 [INFO] [PLAYER_COMMAND] chrishigs: /spawn  
2011-08-04 18:59:09 [INFO] Connection reset
2011-08-04 18:59:09 [INFO] chrishigs lost connection: disconnect.endOfStream
2011-08-04 19:01:38 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 
2011-08-04 19:03:22 [INFO] mjwatmough [/82.38.245.253:54757] logged in with entity id 557366 at ([world] -59.25, 75.0, 249.0)
2011-08-04 19:12:22 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 
2011-08-04 19:13:07 [INFO] Read timed out
2011-08-04 19:13:07 [INFO] Spooneymania lost connection: disconnect.endOfStream
2011-08-04 19:13:27 [INFO] Spooneymania [/80.177.102.181:61709] logged in with entity id 561889 at ([world] 784.40625, 74.0, 585.125)
2011-08-04 19:21:12 [INFO] Connection reset
2011-08-04 19:21:12 [INFO] mjwatmough lost connection: disconnect.quitting
2011-08-04 19:24:25 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 
2011-08-04 19:35:02 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 
2011-08-04 19:45:52 [INFO] [PLAYER_COMMAND] Spooneymania: /time day 


So I'd need it to only pick lines that contain "[INFO] <"
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2806 In reply to 38140.2805 
easy then, gimme a min and I'll whip up something that might work if you want. Or would you rather do it yourself?
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2807 In reply to 38140.2806 
Go for it if you want to :D
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2808 In reply to 38140.2807 
Ok well this should work. It's no doubt poor code and PB or Matt or Andy will be along to betterise it but it works...

PHP code:
<?
 
$things = file('server.log');
$chats = "";
 
foreach ($things as $thing) {
	if (strpos($thing, "[INFO] <")) {
		$chats .= htmlspecialchars(substr($thing, 27)) . "<br />";
	}
}
 
echo $chats;
 
?>
0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  ANT_THOMAS     
38140.2809 In reply to 38140.2807 
Looking at the map.js source, there's an option 'messagettl' that seems to be the delay before messages are hidden. You should be able to edit config.js and add

messagettl: 10000

(I'm assuming it's measured in milliseconds)
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2810 In reply to 38140.2808 
:D I shall put that into use!
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  af (CAER)     
38140.2811 In reply to 38140.2809 
I think it's in seconds because it's currently "5" so I'll increase that too.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2812 In reply to 38140.2810 
Oh that'll do every chat message in the log though so...

PHP code:
<?
 
$things = file('server.log');
$chats = Array();
 
foreach ($things as $thing) {
	if (strpos($thing, "[INFO] <")) {
		$chats[] = htmlspecialchars(substr($thing, 27));
	}
}
 
$chatt = implode("<br />", array_slice($chats, -30));
echo $chatt;
 
?>


That'll get the last 30. Change the -30 on line 12 to adjust.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Drew (X3N0PH0N)     
38140.2813 In reply to 38140.2812 
(I left $chatt as a variable so you can regex some styling into it if you want)
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  Drew (X3N0PH0N)     
38140.2814 In reply to 38140.2813 
You are such a hard core haxor!
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2815 In reply to 38140.2813 
Give it a try on the mini-site. It's not linking to the live server.log, but just want to see if everyone else can see it.
0/0
 Reply   Quote More 

 From:  JonCooper  
 To:  Drew (X3N0PH0N)     
38140.2816 In reply to 38140.2812 
can you make it not include all the bollocks where people turn on the sun or turn off the rain etc?

Jon
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2817 In reply to 38140.2815 
Works for me.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  JonCooper     
38140.2818 In reply to 38140.2816 
He's already done that.
0/0
 Reply   Quote More 

Reply to All  
 

1–20  …  2741–2760  2761–2780  2781–2800  2801–2820  …  3921–3934

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats