Community
SCI Programming => SCI Development Tools => Topic started by: gumby on September 26, 2012, 08:43:47 PM
-
I've put together a new tool which goes through all source script files & extracts all the Print() strings and puts them into text resources. It adds a comment immediately after the modified Print() call so the developer still has a clue as to what will actually be printed. Multiple executions of the tool against a game are supported, so you can run it against your game periodically and it will 'clean up' your Prints, appending them to your existing text resources.
Here's an example:
Before
...
Print("Hello world!")
...
After
...
Print(1 0) /* Hello world! */
...
The C# code is included. Note that the source code also includes code that extracts & repacks resources to/from a RESOURCE.001 file, as well as code for rebuilding the MAP file.
Enjoy!
-
And I know what prompted you to do this. ;D
-
Does the text number correspond to the room number. And I'm assuming you would also need to compile all after running the tool?
-
Yes, the text resource number is the same as the script number.
Which brings us to the limitation; you cannot have more that 1000 prints in a single script, though I can't conceive who would. Plus I think you'd probably have hit heap issues before that anyway.
I originally considered a 'dense packing' option, where you would start with a specified text resource #, fill it all the way up and then move to the next resource. I scrapped that idea as I couldn't really see the value in it.
-
By the way, this tool has managed to find it's way onto the tools page. I didn't take any screenshots of it in action because I haven't actually run it yet, but it sounds pretty useful so I stuck it up there.
-
Nice. Don't worry about the screenshot, there isn't anything to take - it's just a command line application.
-
I just realized there is a feature that is needed with this tool. Ideally, this tool should validate any existing Print() calls that use text resources.
Here are a couple of scenarios:
1) Deletion of Print() statements which already reference a text resource
2) Addition of unreferenced text resource value
3) Update of an Print() statement (after running tool, it would be scenario #1)
Essentially the goal would be that a developer should never need to manipulate the text resources directly. They should be maintained strictly by the existence (or nonexistence) of Print() statements. This means that the Print()s would be maintained completely from the comments, which probably should be moved to be within the Print:
Before initial run of tool:
Print("Hello there!")
Result after tool is run:
Print(/* Hello there! */ 1 3)
Developer changes their mind, just modify the comment & re-run the tool - the text resource should be updated:
Print(/* Goodbye */ 1 3)
Upon execution of tool, any Print() statements that reference text resources would be rebuilt based on contents of comment. Any leading or trailing whitespace within the comment would be removed as well.
-
How did I miss this tool for so long. I am eager to try this out. If I haven't said so before, thank you for developing these awesome extra tools!
EDIT - I ran the program and saw no change. Do I need to run it from within a particular folder or...?
-
It should just work. I've attached a screenshot of the more-or-less expected output (ran it against LockerGnome Quest).
Make sure you run it against to the game directory, not the /src dir. It extracts all the resources out of the resource.001 archive file.
-
When I run the program, it just flashes on screen and then exits immediately. I attached a screen shot
EDIT - OK, I ran it in command prompt as your pic show and it worked. Thanks for the awesome tool :)