Sadly, it’s incomplete, and I had to jerry-rig it to not error out on things like *gosub, *return, *else, etc.
It’s in java, so you have to compile it. Then you need a graphviz viewer like xdot.
I’m wondering if this could be put on the web somewhere, so people could upload or paste in their choicescript, hit a button, and get the resultant flowchart. Anyone know how to do that?
Oh I’ve been wondering if something like this was possible! I’ll definitely be following this topic. I’m sure many others would be interested in creating flowcharts if someone can get a simplified tool up somewhere for popular use
Unfortunately with it being Java, you’d need to host it on a server somewhere (i.e. it’d cost some money to host, and time in maintenance). By no means impossible, but it raises the bar a little for a hobbyist.
Note #1: The choicescript .txt file must use tabs for indentation (not spaces).
This is a pretty big limitation. Worth noting in the first post?
Maybe, but it’s pretty easy to fix, I think. I forget what it’s like to not be a programmer sometimes. I just did retab! in vim to convert spaces to tabs. Maybe just for fun I’ll learn enough java to support spaces too, as this kind of flowchart is something I’d get a lot of use out of. Maybe others will as well if we can get it into an easily usable form.
I’ve been growing less and less interested in ChoiceScript itself (still like IF though), but this problem seems interesting and not that hard.
You don’t even need a full parser, you only need to parse flow control commands such as goto, gosub, if and their variations, and labels. Then build a tree and plot using D3.js or something similar. If you use only JavaScript then you can run it in any browser locally.
It’s still just a prototype, but it can already open and close branches and analyze a scene’s stats.
Then I made Choicescript Analyzer which converts it back into graphviz after condensing the tree down to just the parts relevant to analyzing the tree for the different values all the stats can be. This was the hardest part for me when making games, so I’m really excited. I’m going to make a new post about just this tool now.