Note: I have not yet released this tool, as it is still incomplete, I am simply looking for some feed back on the idea, until such time that I feel it is fully usable.
As a programmer, there’s several things I find to be rather tedious and time consuming to do in ChoiceScript, so for a while, I’ve been toying with the idea of writing a tool to make things easier to do, mostly revolving around the pseudo-arrays that have been implemented somewhat recently. This tool is a result of that idea.
Basically, it works by nesting new commands in ChoiceScript *comment lines, so that the helper can exist along side the legitimate code without interfering. From there, the tool translated these new commands to basic ChoiceScript. So in reality, its not adding anything new, but rather streamlining certain time consuming and tedious tasks. As noted by @CJW, its a pre-processor, so it will take the new lines and translate them into pure ChoiceScript.
As an example, consider the following scenario: You want to create an Inventory system using arrays. Nothing complex, just a list of item names and their descriptions, so you create an array:
*create inv_0_name "" *create inv_0_desc "" *create inv_1_name "" *create inv_1_desc "" .... *create inv_24_name "" *create inv_24_desc ""
… Boy, that sure is a lot of typing! … But hey, say now you wanted to add a third part, like a quantity amount… Why, you’d have to write out another 25 lines! … And if you wanted to increase the number of slots, why that’s even more work.
… With the tool, you can shrink this all down to a single line!
*comment : *csh_array_create inv [0 to 24] ["name" "desc" "qty"] default:["" "" 0]
… Which when processed by the tool will expand to the tedious monstrosity above!
I also have similar commands to fill arrays, create/save/load checkpoint variables, as well as support for the CS Password system I wrote. The program will also parse your entire project all at once, and create backups automatically. In the future, I plan to add the ability to automatically restore back ups, have a toggle for implicit_control_flow, and have a project cleaner, which completely removes all CS Helper lines for when a CS project is complete.
So my question is, would any of you find such a tool useful? And also, does anyone have any other ideas for Helper Commands?
The list of commands currently is as follows (minus the opening ‘csh_’ part):
- array_create: Created an array of variable type and dimensions
- array_set: Sets values to multiple array indexes in a single line
- generated_code_start/generated_code_end: Surrounds generated code, so that when you next run the tool, it knows what code was generated previously, thus will delete the old code before regenerating the updated code.
- checkpoint_start/checkpoint_end: Used in the ‘startup’ scene to start reading variables to be saved at a check point.
- checkpoint_generate: Creates checkpoint variables for any variable detected by checkpoint_start/end.
- checkpoint_save/load: Loads and saves checkpoint values
- password_start/end_generate: Same as the checkpoint counterparts, but for use with my CS Password system
- skip/skip_end: CS Helper will skip processing any lines between these two commands
- skip_all: Skips the remainder of the scene
Edit: Just need to work on ‘array_create’ now, which is the most complicated feature.
Looking forward to your input!