Enquirer Home Page | Twitter | Back to Improbable Island

 Forum Index > Off-Topic > Out-of-Game New Topic Post Reply
 Timestamp Thingies
 |  Printable Version
Darael
 Tuesday, May 15 2012 @ 03:40 PM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

Quote by: Trowa


That would be awesome!! Mr. Green



I'll try, but seriously: No promises. For a start I'm more of a Lispnik than a JS hacker, and I haven't had much time for my own projects recently.

EDIT: Incidentally, I wonder if CMJ (or whoever handles the wiki software if it's someone else) could be persuaded to add the dokuwiki "color" plugin, with colornames.php adjusted such that the one-character colour codes from the game worked? That'd be kind of cool, and would mean that version 1.0 of this little script could be able to fully convert to wiki syntax. It need not be the one-character codes, of course, since the HTML source doesn't use those but some longer names, but it would be more familiar, I think, for manual usage.


 
Profile Email
Quote
Anonymous: Laurence
 Tuesday, May 15 2012 @ 04:28 PM UTC  


Quote by: Count+Sessine

On the other hand, for uploading to the Wiki, a text-only file with no span tags at all is what's required, and for that it would also be nice to have \\ inserted before newlines.



While it's no good for gdoc beautifying, this sucker should do the trick if you wanted plaintext with the timestamp stripped and \\ before newlines:

https://docs.google.com/spreadsheet/ccc?key=0AtMwg_m_OXS-dE1iWHNoRnBQbWpQOEtKSG1nSVhGSVE

(The magic being the formula for the B column, of course.)


 
Quote
Full Metal Lion
 Friday, July 08 2016 @ 09:04 AM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 12/19/11
Posts: 437

Quote by: Full+Metal+Lion

As a Person Who Roleplays Sometimes, I copy-paste the roleplay I do into a text file(compulsively). Sometimes, I wish to copy-paste from the text file onto the wiki. However, I'm sure it'd look much better without the "[XXmXXs]|" timestamp. Does anyone have a simple, low effort way to remove the timestamps from a text file, other than just deleting them one by one?


Ha ha, look at this adorable guy who doesn't know how to use regexes! WOOK AT HIS WIDDLE FACE.

Ahem. Anyhow, Darael had it mostly right, but the regex I would recommend is
^.*?│ ?
because this will catch everything from the beginning of the line up through the "│" and will catch the space before a character's name, if there is one (characters with no title have a space in front of their names). This fixes an edge case where a player might literally type "[01h01m]│" or something that fits the pattern into chat. I suppose that you could use
^\[[0-9][0-9][dhm][0-9][0-9][hms]\]│ ?
but why would you?

(You might want to if, say, a player has figured out how to sneak newlines into chat and keeps typing "│" after everything he types for some reason, but fuck that guy! He doesn't deserve to have his chat logged!)

As noted, the vertical line is not a pipe ("|"), but rather U+2502 : BOX DRAWINGS LIGHT VERTICAL.

Using this regex is the hard part, because the text editor you most likely have on your computer is Notepad, which won't help you here. If you don't want to install a better text editor (gedit and Notepad++ are fine, user-friendly options) then you can use various websites on the internet to apply your regexes. Just type "apply regex online" into your preferred search engine and pick the first thing that comes up. You will need to specify for these sites that you are using the flags/modifiers "g" for global and "m" for multi-line. You may also need to find the button that lets you actually use the regex to replace what it matches (you want to replace the matches with the empty string, of course).


 
Profile Email Website
Quote
Trowa
 Friday, July 08 2016 @ 02:12 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 01/09/11
Posts: 426

Quote by: Trowa

Quote by: Darael

I was mostly thinking that it's easier to push a button and they disappear before you copy-paste than it is to run something on the doc afterwards. Thanks, though, for the reminder that I need not to use any GM-specific functions if I do write this thing, to make sure it does work in Chrome.


That would be awesome!! Mr. Green



Quote by: Full+Metal+Lion

Quote by: Full+Metal+Lion

As a Person Who Roleplays Sometimes, I copy-paste the roleplay I do into a text file(compulsively). Sometimes, I wish to copy-paste from the text file onto the wiki. However, I'm sure it'd look much better without the "[XXmXXs]|" timestamp. Does anyone have a simple, low effort way to remove the timestamps from a text file, other than just deleting them one by one?


Ha ha, look at this adorable guy who doesn't know how to use regexes! WOOK AT HIS WIDDLE FACE.





Good grief, I totally forgot about this thread. And you know what I did? I went and made a GDoc that deletes the time stamps at the push of a button!

https://docs.google.com/document/d/1gdujlgQ7eSpL61afkknPJQUe8-gqgGQXZ-1EFwrjzj8/edit?usp=sharing

I just never shared it here because CMJ was working on one already (has produced one by now), and didn't want to compete with his. I shared my doc with other people, though, who shared it with other people, who shared it with more people, and so on. >_>

Mine goes a couple steps further now, though. Some people asked if they could use it with old logs copied with CMJ's old export tool (before the chat was all upgraded and fancified), and if I could also get it to delete time stamps from Rentoraa's chat logging script. I did all this, and more! For place owners (or just those with the right keys), you can copy and paste an entire log including the GREM'd posts, and my script will highlight them.

For the nuts and bolts, I used...

Quote by: Full+Metal+Lion

I suppose that you could use

^[[0-9][0-9][dhm][0-9][0-9][hms]]│ ?
but why would you?



::stares at his own script::
bodyElement.replaceText('\\[[0-9]{2}[mhd][0-9]{2}[smh]\]\!? ?✓?X?│? *', '');

....

DAMNIT.


On the other hand... your shortened and very awesome tidbit of code fails on Special Comments. So I'm gonna go test on that when I have time this weekend. But to be honest, I had no idea what I was doing or how regular expressions worked until I started this project three years ago. My original version of this script had about five different lines for some reason! Rolling Eyes


For reference, in the copy of log snippets I received to test on, Rentoraa's script was replacing the "box drawings light vertical" with a regular pipe. However, that script does this to moderators that were copy/pasting their logs:
X [Tue 10 Mar 2015 18:59:02]| The Dandy Wallguard TrowaX│The Dandy Wallguard Trowa says "Hello, Quinn!"


And the "legacy" (as I call them) logs looked like this:
2011-03-10 18:33:37: Lizard of Fury Ryushi: : comes out of Booz with glowing red eyes of rage. Though, he seems like he's handling it well... "Neat."


PS: You the man, FML!


Something something unintelligible gibberish something.
 
Profile Email
Quote
Full Metal Lion
 Saturday, July 09 2016 @ 07:54 AM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 12/19/11
Posts: 437

Quote by: Trowa

your shortened and very awesome tidbit of code fails on Special Comments.


Dang. You are so right.

I mean, you should be able to fix this using
^.*?\]\!? ?✓?X?│? ?
(I don't know what that exclamation mark and first space are doing but I trust you) but it's also just struck me that this makes it theoretically impossible to tell what should be included by using a regex and plain text. What if, for example, I wanted to make the special comment"*│"? This would show up as "[00m00s]|" and be caught by the regex. Even worse, the special comment "*X|" would match if a person without the right keys copy-pasted it.

This is only unsolvable in theory, of course. The practical answer is that no one cares.

No, you da man!


 
Profile Email Website
Quote
Snow Gray
 Tuesday, July 19 2016 @ 02:27 PM UTC  
Forum Contender
Contender

Status: offline

Registered: 12/24/09
Posts: 41

Totally irrelevant to the current coding back and forth, but I just wanted to pipe up that I still use Trowa's log gdoc for my RPs! Big Grin


 
Profile Email
Quote
Content generated in: 0.24 seconds
New Topic Post Reply



 All times are UTC. The time is now 10:46 AM.

Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content