so hey, I made a TSC event parser

Nov 28, 2019 at 4:36 AM
Junior Member
"It's dangerous to go alone!"
Join Date: Aug 5, 2019
Location: Hell
Posts: 41
Pronouns: he/him
I made a TSC event parser, which can be accessed here.

It translates TSC into readable(-ish) English.

I originally aspired for a full TSC parser (including parsing different events), but it's complicated and doesn't really add that much value

Screenshot
Screenshot_2019-11-27 TSC Command Parser.png
 
Last edited:
Nov 28, 2019 at 5:56 AM
Senior Member
"Huzzah!"
Join Date: Jul 6, 2019
Location: United States
Posts: 214
this is very cool! maybe soon you can make it so you can see the faces and maybe see their unique textured faces by inserting it some how
its kinda confusing why it tells you the <MSG is in a message box, but its whatever
 
Nov 28, 2019 at 7:35 AM
Deliverer of Sweets
Bobomb says: "I need a hug!"
Join Date: Jul 20, 2015
Location: Under sea level or something
Posts: 802
Age: 26
Pronouns: 菓子
This could be pretty useful for people that want to learn the language, and otherwise is still pretty cool to see even if it doesn't have a ton of use for me personally.
Two things that would be cool to see on this are support for using non-numbers for command arguments (which is done for negative input on stuff like lives and also out of bounds flagging) and maybe a bit more support for some more common custom commands.
 
Nov 28, 2019 at 11:22 AM
Senior Member
"Huzzah!"
Join Date: Mar 25, 2019
Location:
Posts: 206
Very interesting. I know many people would give up trying to learn TSC for the first time so maybe now that this is a thing more people will be interested in modding Cave Story.
It just needs to get more popular.
 
Nov 28, 2019 at 11:46 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Sep 23, 2019
Location:
Posts: 97
Pronouns: he/him
This could be quite promising. I'd suggest you continue working on it in order to improve whatever needs improving.
 
Nov 28, 2019 at 1:05 PM
Moo~
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2838
Age: 29
Pronouns: She/Her
so maybe now that this is a thing more people will be interested in modding Cave Story.
It just needs to get more popular.
If only this were the case 7 years ago, when CS modding was still relevant.
 
Nov 28, 2019 at 4:41 PM
Senior Member
"Huzzah!"
Join Date: Mar 25, 2019
Location:
Posts: 206
If only this were the case 7 years ago, when CS modding was still relevant.
Then we just need to make it rise from the grave with a meme or something.
Totally doable.
 
Nov 28, 2019 at 7:37 PM
Soup Man
"In Soviet Russia, graves keep YOU!"
Join Date: Jul 15, 2014
Location: IN YOUR HEAD, SHIT FOR BRAINS
Posts: 670
Age: 8
Pronouns: she/her
can you make this but for assembly code
 
Nov 29, 2019 at 2:03 AM
World's #1 Laharl Kinnie
"All your forum are belong to us!"
Join Date: Sep 22, 2012
Location: Hell
Posts: 611
Pronouns: She/It
I wonder if a tsc constructor could be made of this parser that could work like RPG Maker's script editor...
 
Nov 29, 2019 at 2:37 AM
Moo~
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2838
Age: 29
Pronouns: She/Her
I wonder if a tsc constructor could be made of this parser that could work like RPG Maker's script editor...
Include <VAR and then it will be exactly like RPG Maker's script editor
 
Nov 29, 2019 at 9:21 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Aug 5, 2019
Location: Hell
Posts: 41
Pronouns: he/him
Thanks for the feedback!

Individual responses:

this is very cool! maybe soon you can make it so you can see the faces and maybe see their unique textured faces by inserting it some how
its kinda confusing why it tells you the <MSG is in a message box, but its whatever

I'm thinking about it.
There is a way to upload images into websites locally (think imgur) without sending them to a remote server (I think), but it's weird.
I'll take a look at that.
( plus, even if it does take a remote server I could just put it onto my personal server so that's not really an issue)

This could be pretty useful for people that want to learn the language, and otherwise is still pretty cool to see even if it doesn't have a ton of use for me personally.
Two things that would be cool to see on this are support for using non-numbers for command arguments (which is done for negative input on stuff like lives and also out of bounds flagging) and maybe a bit more support for some more common custom commands.
I'm also thinking about this.
I started writing this as a project to understand better what TextScr.cpp is doing, and how to modify it, so custom commands and non-numbers (which would also be a custom command) would be in line with that goal

Very interesting. I know many people would give up trying to learn TSC for the first time so maybe now that this is a thing more people will be interested in modding Cave Story.
It just needs to get more popular.
Really? Why give up on TSC? It's really simple as long as you have reference docs.
If it helps some people learn though, that's good enough for me. It's as much to help me learn as anyone else, just learning different things.

This could be quite promising. I'd suggest you continue working on it in order to improve whatever needs improving.
planning on it.
there'll probably be an update out in a bit (maybe a week?) regarding showing default facepics.
I'm unsure when I'll have time for much else - the custom facepics thing will probably take a while - but it'll get there, eventually.

can you make this but for assembly code
nope, not possible, sorry
assembly (from what I've seen) is completely different - it's modifying already-existing stuff (which is hard enough) AND it's modifying an EXE, which is even harder.

I wonder if a tsc constructor could be made of this parser that could work like RPG Maker's script editor...
I haven't seen RPG Maker's script editor, but I could probably do something like that.
The issue is that even just writing the parser took around 5 hours, so writing a creator would take a while

there are ways I could shorten it, though

nerd stuff in the spoiler
so I could set up some supporter code running through an array of objects

example:
Code:
var commands = [
	{
		"code": "MSG",
		"args": [],
		"descriptor": ["Open a message box."],
	},
	{
		"code": "TRA",
		"args": ["num", "num", "num", "num"],
		"descriptor": ["Travel to stage #", " and run event #", ". While you're at it, set the player coords to ", ","],
	},
]

then, do stuff with that
for example,
Code:
	commands.forEach((e) => {
		var x = document.createElement("span");
		listOfPossibleCommands.appendChild(x);

		if (e.descriptor.length!==0 && (e.args.length !== e.descriptor.length)) {
			throw `Err: ${e.code}'s args and descriptor length need to be the same, but they're ${e.args.length} and ${e.descriptor.length}`; 
		}

		if (e.descriptor.length===0) {
			x.innerText = "<"+e.code + ": "+e.descriptor[0];
		} else {
			x.innerText = "<"+e.code + ": ";
			for (let l = 0; l < e.descriptor.length; l++) {
				let v = document.createElement("input");
				x.innerHTML += e.descriptor[l];
				x.appendChild(v);
				v.addEventListener("input", // actual input stuff );
			}
		}
		
	});

i would put in stuff for using the input types but this has taken WAY too long and it's just an example
anyways, it's possible

Include <VAR and then it will be exactly like RPG Maker's script editor
I'll probably put in <VAR
that type of thing is the entire reason WHY i made this
 
Nov 29, 2019 at 9:36 PM
Senior Member
"Huzzah!"
Join Date: Mar 25, 2019
Location:
Posts: 206
Really? Why give up on TSC? It's really simple as long as you have reference docs.
If it helps some people learn though, that's good enough for me. It's as much to help me learn as anyone else, just learning different things.
Trust me. Many people give up on certain things if they don't succeed at them immediately because they think it's too difficult for them or something.
 
Nov 29, 2019 at 10:13 PM
Moo~
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2838
Age: 29
Pronouns: She/Her
I'll probably put in <VAR
that type of thing is the entire reason WHY i made this
If you need help with some <VAR stuff, I'll be available when I can.
 
Nov 29, 2019 at 10:15 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Aug 5, 2019
Location: Hell
Posts: 41
Pronouns: he/him
If you need help with some <VAR stuff, I'll be available when I can.
the problem isn't using it

the problem is recreating it in C++ while I only know JavaScript (which is 5 languages under a trench coat, so I understand most of the syntax, but STILL)

Trust me. Many people give up on certain things if they don't succeed at them immediately because they think it's too difficult for them or something.
huh. my philosophy has always been "if you want to do it, and it's worth it to you, do it. if you don't know how, learn how."
 
Last edited:
Nov 29, 2019 at 10:29 PM
Deliverer of Sweets
Bobomb says: "I need a hug!"
Join Date: Jul 20, 2015
Location: Under sea level or something
Posts: 802
Age: 26
Pronouns: 菓子
More nitpicking:
• For the parser commands seem to be case-sensitive.
• '<TRA0000<0019_012992942<MSGTest<END' returns the tra event as it should so good work on considering using different symbols between parameters, but I also get '[position 27, char T] Warn: Message box is closed, but you're trying to print to it??? Ignoring that for now.' which probably doesn't sound good. I think I get this when I put<MSG behind anything with parameters.
The event written above is wrong anyway, but returns a message that shouldn't be there either way. An event that looks like '<MSGTest<TRA0000:0000:0000:0000' would return this message too, I wonder if you can find out what it is. ; )
 
Nov 30, 2019 at 8:50 AM
Senior Member
"Wahoo! Upgrade!"
Join Date: Dec 22, 2018
Location: Sand Zone Residence
Posts: 55
Pronouns: he/him
This is a regex I used in a different project. It parses TSC tags and attributes. You might find it helpful in the long run:
Code:
/\<(([A-Z0-9+-]){3}(([0-9]){4})?)((\:([0-9]){4})?){0,3}/g
i'm not a regex god and i'm sure there's a shorter way to achieve the same thing but please dont yell at me
 
Nov 30, 2019 at 11:02 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Aug 5, 2019
Location: Hell
Posts: 41
Pronouns: he/him
More nitpicking:
• For the parser commands seem to be case-sensitive.

easy enough to fix, I just have to edit the IS_COMMAND function to put a
.toString().toUpperCase() before it checks stuff

edit: fixed

• '<TRA0000<0019_012992942<MSGTest<END' returns the tra event as it should so good work on considering using different symbols between parameters,

I'm actually using Pixel's function there (with slight modifications), so that's on him - it skips the input one character, he just used colons for consistency ( I think )


but I also get '[position 27, char T] Warn: Message box is closed, but you're trying to print to it??? Ignoring that for now.' which probably doesn't sound good. I think I get this when I put<MSG behind anything with parameters.
The event written above is wrong anyway, but returns a message that shouldn't be there either way. An event that looks like '<MSGTest<TRA0000:0000:0000:0000' would return this message too, I wonder if you can find out what it is. ; )
something's wrong with the <MSG parser, gimme a sec to debug this (I'll edit this post when I'm done)

edit: fixed
both the TRA and the MSG parser were wrong lol

explanation of the error message:
the error message you were seeing ("Warn: Message box is closed, but you're trying to print to it??? Ignoring that for now.") is shown whenever you try to show a message onto the message box, but the message box isn't open.

obviously, it was wrong in thinking that the message box was closed

the "[position 27, char T]" you saw was telling me where the issue was
character #27, which is a T
Code:
12345678901234567890123456 V (below the V is character #27, which happens to be a T)
<TRA0000<0019_012992942<MSGTest<END

if the problem were at the G before it, it would show:
Code:
[position 26, char G]
1234567890123456789012345 V (below the V is character #26, which is a G)
<TRA0000<0019_012992942<MSGTest<END


This is a regex I used in a different project. It parses TSC tags and attributes. You might find it helpful in the long run:
Code:
/\<(([A-Z0-9+-]){3}(([0-9]){4})?)((\:([0-9]){4})?){0,3}/g
i'm not a regex god and i'm sure there's a shorter way to achieve the same thing but please dont yell at me

Hmmm... I'm probably not going to use this, because I'm trying to stick close(-ish) to Pixel's code, but this could be useful for other projects.


Also,
work has begun on a TSC creator.
and by "work," I mean "I sketched out how it will probably work on printer paper."

edit:
because I'm on Linux, I had to get the drivers for the scanner manually, so it took a while to get this up

here are (some) of the notes I sketched out:
the details make sense to only me, but the gist of it is that it's a list (think iOS) that you can modify

what a mess.png
as I said, most of it makes sense to only me

the instructions on the bottom-right-ish are thinking as individual list items

commands are list items, and there'll be a pop-out list at the left of all possible commands sorted alphabetically
 
Last edited:
Dec 1, 2019 at 3:56 AM
Junior Member
"It's dangerous to go alone!"
Join Date: Aug 5, 2019
Location: Hell
Posts: 41
Pronouns: he/him
Maybe replace direction numbers with actual directions?
Typically 0,1,2,3 are left,up,right,down. There are also special directions for many things. (Like I think MYB > 10 faces an entity with the event number you entered)

I would've, but I didn't know the convention. Updating it (should be up in 10 minutes or so)

edit: updated. server should be putting up the updated version any second now (by the time you see this, it should be done)
 
Last edited:
Dec 1, 2019 at 4:09 AM
Moo~
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2838
Age: 29
Pronouns: She/Her
Are there any special directions beyond 4 (facing center/facing the player)? Because that's the first time I've ever heard of that.
 
Back
Top