RPG Maker MZ Typescript edition

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV

What does this mean for the project?
not that much the 'deprecated' method is quite nice tho. but mostly it'S just improvement.
 

RaiderSoap

Researcher
Member
Joined
Mar 30, 2016
Messages
6
Reaction score
1
First Language
Mandarin
Primarily Uses
RMMZ
Very Interesting, I have always been thinking to develop plugins in TypeScript, although I am still learning the basics of TS. It seems like to me that we must write declaration files for the RMMZ's code first? Now we sees the source code, it seems like a lot of work, but is there any significant challenges for that?
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
most of the time No @RaiderSoap code is enough clear to understand the type directly from the sources code.
what gets complicated is when there's cross references between class that are not yet being defined in TS (like I didn't did the definitions files for it) so it get complicated.

Also as I love TS it can be challenging to work dynamically for plugin development (when you don't know module augmentation and such)
Although as explained above if we follow the cyclone engine way of doing alias or extending class it will be way easier. even if I think some input will be lost but ill figure it out when it come to it.
 

Ghost314

Villager
Member
Joined
Aug 13, 2020
Messages
15
Reaction score
12
First Language
English
Primarily Uses
RMMZ
If I want to contribute documentation to classes/methods as I continue experimenting with RMMZ, should I write them in JSDoc format or TSDoc format?

Also is it worth copy/pasting the comments from the base javascript files into the corresponding places in the d.ts files, or will those be linked in automatically somehow?
 
Last edited:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
If I want to contribute documentation to classes/methods as I continue experimenting with RMMZ, should I write them in JSDoc format or TSDoc format?

Also is it worth copy/pasting the comments from the base javascript files into the corresponding places in the d.ts files, or will those be linked in automatically somehow?
The typescript and MZ code base are kinda separated I do plan to speak with degica to introduce the code definitions into MZ doc. but take it with a grain of salt. As for the doc depending what they use as parser we might need to anotate but per functionality Typescript already anotate the type so just having comment works per say.
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
552
Reaction score
790
First Language
English
Primarily Uses
RMMV
JsDoc comments work perfectly fine for TS. If you wanted to contribute it'd have to be to the repository itself.

There's a significant rewrite process for MZ for Typescript definitions so it will take time.
 

Ghost314

Villager
Member
Joined
Aug 13, 2020
Messages
15
Reaction score
12
First Language
English
Primarily Uses
RMMZ
I was already planning to write my scripts in typescript since it's what my work uses and I could use the extra practice. So I have a strong interest in this project.

I've been a bit hesitant to help with the re-writing of the code because I can't find any indication on the project page of who may already be working on what. I would hate to rewrite something only to find out someone else was already doing it. How are you coordinating things?
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
I was already planning to write my scripts in typescript since it's what my work uses and I could use the extra practice. So I have a strong interest in this project.

I've been a bit hesitant to help with the re-writing of the code because I can't find any indication on the project page of who may already be working on what. I would hate to rewrite something only to find out someone else was already doing it. How are you coordinating things?
So far I am the only one working on it.

how I coordinate things I generally work on one rmm_***.js file at a time as a separated file. an extra hand wouldn't be wrong.
I am very peculiar with the organization (you can refers to how I approach the declarations files)

but as I said it's not actual code it's definitions files. so there's no 'body' content.
just 'declarations'

SO FAR I am doing the Game_Object file. so the other files are still in dev.

I also changed the way you bundle the files (they are now will all be bundle in one single file so doing )

Code:
import {Scene_Base} from "../rpg_scene/Scene_Base";
in files is perfectly fine.
 

Ghost314

Villager
Member
Joined
Aug 13, 2020
Messages
15
Reaction score
12
First Language
English
Primarily Uses
RMMZ
I took a look at the windows.js file and tried writing out the type definitions for Window_Base. It took longer than I expected :dizzy: but I have a pull request on GitHub that you can review when you have time. I'll probably try to do at least one class a day during the week.
 

RaiderSoap

Researcher
Member
Joined
Mar 30, 2016
Messages
6
Reaction score
1
First Language
Mandarin
Primarily Uses
RMMZ
I am interested in helping this project, as Ghost314 suggest we can somehow coordinate this.

I have wrote my own plugin TypeScript + rollup environment and all I need is to wait for the '@types/rmmz'
(or something like that, hopefully it can be published to npm
(Can't wait for this already,
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
I mean I can try to publish to NPM although I am not super strong when it come to that (I don't use it since I work with Unity most of the time so npm isn't used widely)

and you free to help!
and most of the typing will be compiled to rmmz_api.d.ts
@Ghost314 ill review it.
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
552
Reaction score
790
First Language
English
Primarily Uses
RMMV
I actually created one yesterday but I need some testers.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
I posted this issue related to the RPG namespace
which solve a lots for the

also for any moderator will it be possible to finally repine the project? it was unpinned as reason it was supposed to be moved to a 'proper' place and pinned back but it didn't happened yet.
 

Ghost314

Villager
Member
Joined
Aug 13, 2020
Messages
15
Reaction score
12
First Language
English
Primarily Uses
RMMZ
I got tired of manually creating files and copy-pasting class and method names so I created a java utility to do most of the work. It takes 2 arguments when run, first is the path to a javascript file, and the second is an output directory folder.

It parses the javascript file with regular expressions to find lines that look like class/method/constructor definitions and generates a corresponding typescript declaration file in the output directory folder for each class that it finds.

It obviously can't figure out any of the type information, and it also doesn't parse Object.defineProperty statements, so the output still has to manually verified and completed. It saves a bit of time with copy and pasting though, since it generates files like this to use as a starting point:
starting class.jpg

I made it leave the return type of each method blank so it's easy to tell which classes still need to be worked on.

I don't think the tool is smart enough to be worth distributing as a separate project, so I just attached the full source code to this post in a .zip file in case anyone else wants to use it.
 

Attachments

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
oh jesus it is awesome xD
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
552
Reaction score
790
First Language
English
Primarily Uses
RMMV

RaiderSoap

Researcher
Member
Joined
Mar 30, 2016
Messages
6
Reaction score
1
First Language
Mandarin
Primarily Uses
RMMZ
You can use tsc to generate .d.ts files from .js files. Although not all types are correct, but it saves you all the copy & paste steps. Most importantly, it never miss any functions.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,040
First Language
French
Primarily Uses
RMMV
You can use tsc to generate .d.ts files from .js files. Although not all types are correct, but it saves you all the copy & paste steps. Most importantly, it never miss any functions.
wait you can D: ? I didn't know that lol
 

Ghost314

Villager
Member
Joined
Aug 13, 2020
Messages
15
Reaction score
12
First Language
English
Primarily Uses
RMMZ
I actually knew about tsc, you can use compiler options to tell it to compile .js files and you can tell it to emit .d.ts files both at the same time. I ran into trouble though trying to actually compile those .js files (I am relatively new to typescript). So I ended up doing it myself.

If someone can figure out how to properly set up the tsc for this then let me know, it would be a good way to error check our work.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I had lots of fun! Kids loved me, and some took pictures. Unfortunately, the videos didn't send... but you'll see Chica in action when I do a trailer for Fandom Scouts!
Dama wrote on akoniti's profile.
Hi
Thanks for your review.
I was checking the trailer for details and as the woman shut the door at the exact moment the song I was hearing said "you slim the door" and I couldn't resist to add it there. :D And I used this idea one more time on another scene.
Just doing some tileset tinkering again...
rux
Someone please help me make my game.
I need someone to volunteer, I am on my knees man.

Forum statistics

Threads
104,690
Messages
1,008,150
Members
136,184
Latest member
Nitrostat
Top