Looking for a good freeware text editor/linebreaker (SOLVED)

Started by GarageGothic, Tue 19/07/2005 12:08:43

Previous topic - Next topic

GarageGothic

Ok, so the Shadowplay Hypertext Engine (also known as SHYTE) is finished. However, due to AGS' string length limit, I need to chop the text into units of 200 characters (198 + 2 characters of formatting code if the line continues/is continued), and frankly it's a bit of a pain doing it by hand.

So I'm looking for a macro text editing program, preferably freeware, which will take a raw text file, split it into units of 198 characters (or the last spacing) and - if possible - auto-insert my code at the beginning and end of every line (AddText("*string*")), so that it can be pasted directly into my script.

Any suggestions?

Gilbert

#1
Will this do? :=

something uglily mucked up in a few minutes, just compile it with AGS V2.62.

Sample usage:
1. launch the "game".
2. Input the name of the import file, e.g. hello.txt
3. Input the "front" text for each line, e.g. Display("
4. Input the "end" text for each line, e.g. ");

The "game" should end automatically, creating a file called output.txt, in which each line will be some thing like:
Display("...");

Note that since I used while loops, if your input file is VERY large, it's possible that the game will crash out because of the iteration limit exceeded, this of course can be fixed with scripting, but I'm so lazy at the moment, if you're interested you can look at the source yourself.

Edit: I was bored, so I slightly modified it, so I think (hope) it won't crash for large files (get here).


GarageGothic

Thank you so much Gilbot, I had considered writing it in AGS, but for some reason I couldn't see past the 200 character limit. But of course that's no problem when writing raw characters. This was very much what I was looking for. I'll just refine it a bit to handle some other formatting codes, and it'll be ready to include with my script module.

You just earned yourself a big "thank you" credit!

Gilbert

Yeah, it's rushed ugly codes, just play with the source and make it into whatever monster which is more suitable to your needs. :)

SMF spam blocked by CleanTalk