Factorio Mod Creator Studio [IN DEVELOPMENT]

Tools which are useful for mod development.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Anyone here who knows a good JavaScript to Lua Converter for Java..... or as command line tool?
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

OK. for the ones who are not willing to learn Lua but already know JavaScript(for example me... but i'm willing to learn Lua), I present you a solution.
I will allow both Lua and JavaScript(not for browsers and with much less features, basically only the things that lua has.... but I may implement switch-case at a later point).

So this:

Code: Select all

script.on_event(defines.events.on_entity_died, function(event) {
	var recently_deceased_entity = event.entity;
	var time_of_death = event.tick
	
	for(player in game.players) {
		player.print("Let it be known that " + recently_deceased_entity.name +
                     " died a tragic death on tick " + time_of_death);
	}
});
Is equal to this:

Code: Select all

script.on_event(defines.events.on_entity_died, function(event)
  local recently_deceased_entity = event.entity
  local time_of_death = event.tick

  for _, player in pairs(game.players) do
    player.print("Let it be known that " .. recently_deceased_entity.name ..
                 " died a tragic death on tick " .. time_of_death)
  end
end)
WARNING!: I can not garantuee that the code conversion(JavaScript -> Lua) will be perfect in the first alpha versions.
Last edited by RalleYTN on Fri Feb 10, 2017 11:38 am, edited 1 time in total.
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Another example:

Lua:

Code: Select all

data:extend({
  {
    type = "item",
    name = "bomber",
    icon = "__BomberTutorial__/graphics/icon_bomber.png",
    flags = { "goes-to-quickbar" },
    subgroup = "ammo",
    place_result="bomber",
    stack_size= 1,
  }
})
JavaScript:

Code: Select all

data:extend([
	{
		type:"item",
		name:"bomber",
		icon:"__BomberTutorial__/graphics/icon_bomber.png",
		flags: [
			"goes-to-quickbar"
		],
		subgroup:"ammo",
		place_result:"bomber",
		stack_size:1
	}
]);
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

I added a language selection to the "New Project"-wizard. Depending on what you choose you will code in only that language.
You may notice that the JavaScript says "FMCS Edition". This just means that it isn't the default ECMAScript you would encounter in web or some servers.
It is basically just Lua with curly-brackets-syntax and some syntactic features like "continue" or at a later version "switch-case".
It can access all Lua functions and has no functions on its own. If you have some self-written libraries in Lua you can still import them into your project and acces all of its functions from JavaScript.
Attachments
fmcs-016.jpg
fmcs-016.jpg (108.31 KiB) Viewed 12500 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

For everyone interested: I pushed the first source code to the github repo.
https://github.com/RalleYTN/Factorio-Mod-Creator-Studio
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

I implemented a really primitive LuaParser now which allows me to highlight errors in the syntax.
Attachments
ergebnis.jpg
ergebnis.jpg (54.6 KiB) Viewed 12408 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by daniel34 »

You've been replying 6 times today already to this topic, without any other user replying inbetween.

It's looking like you're trying to bump this topic and get it to the current new/active thread listing on the main forums page, don't do that. Currently there are 26 posts to this topic, 24 are from you. If you make a daily report that's fine, but don't publish your progress every few hours just to get more visitors.


See my answer below.
quick links: log file | graphical issues | wiki
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by Supercheese »

daniel34 wrote:You've been replying 6 times today already to this topic, without any other user replying inbetween.

It's looking like you're trying to bump this topic and get it to the current new/active thread listing on the main forums page, don't do that. Currently there are 26 posts to this topic, 24 are from you. If you make a daily report that's fine, but don't publish your progress every few hours just to get more visitors.
Well, they do seem like legitimate development reports to me...
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by Nexela »

I agree, don't censor the reports.
Xeanoa
Fast Inserter
Fast Inserter
Posts: 190
Joined: Tue Apr 26, 2016 4:32 pm
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by Xeanoa »

Does anyone seriously look at the view couter? It may as well not be there.

I just drop by to see how it's going, and leave. No need to post anything.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by daniel34 »

I'm sorry if that came on rude, but on the Steam forums (where I also moderate) we don't like repeated bumps to existing posts, and even on this forums repeat posts (3-4 posts in a row) have been reprimanded in the past. I do like this project and where it is going, and RalleYTN is showing new ideas (a difference from the usual bump posts), so I agree with you all and I'm sorry I did write my last post so harsh, you (RalleYTN) are free to continue posting your development reports if the community likes them.

My only issue is that apart from prq (who gave him some hints) none of you acknowledged his work by posting and my thought was you're not interested in it. Imagine a thread where 24 of 26 posts (within one week) are OP's posts - you'd check that out. That's what I did and I apparently came to the wrong conclusion. I'm sorry. Please continue writing your development reports for us, I can't wait to see the finished product.
quick links: log file | graphical issues | wiki
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

daniel34 wrote:I'm sorry if that came on rude, but on the Steam forums (where I also moderate) we don't like repeated bumps to existing posts, and even on this forums repeat posts (3-4 posts in a row) have been reprimanded in the past. I do like this project and where it is going, and RalleYTN is showing new ideas (a difference from the usual bump posts), so I agree with you all and I'm sorry I did write my last post so harsh, you (RalleYTN) are free to continue posting your development reports if the community likes them.

My only issue is that apart from prq (who gave him some hints) none of you acknowledged his work by posting and my thought was you're not interested in it. Imagine a thread where 24 of 26 posts (within one week) are OP's posts - you'd check that out. That's what I did and I apparently came to the wrong conclusion. I'm sorry. Please continue writing your development reports for us, I can't wait to see the finished product.
I'm not trying to bump. Everytime I make a goal I just say: "look! I made dis!"
sometimes I ask questions or just talk about what wanders my mind. but its always on topic.
I'm happy to see that people actually replyied to this topic. :)
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

So. I tuned the Lua Parser a bit. I am now able to to through Lua code step by step (meaning getting exact locations of functions or if blocks in code). That allows me to check if a function was already declared somewhere else and then mark every new declaration as error. It also allows me to reverse engineer already existing mods into a project file.

I found out how to change the editor theme in RSyntaxTextArea(also found arround 25 other customization options). So It will be possible to set the theme to an editor that you like. Eclipse or VS for example.

Since all the themes get loaded at the beginning and alot of images and later all the auto-completions the start up will be slower. To prevent the user from thinking that nothing happened after starting the application I now show a small splash screen.
Attachments
fmcs-theme-vs.jpg
fmcs-theme-vs.jpg (45.27 KiB) Viewed 12166 times
fmcs-theme-eclipse.jpg
fmcs-theme-eclipse.jpg (39.65 KiB) Viewed 12166 times
fmcs-theme-dark.jpg
fmcs-theme-dark.jpg (37.56 KiB) Viewed 12166 times
fmcs-theme-default.jpg
fmcs-theme-default.jpg (43.35 KiB) Viewed 12166 times
splash.jpg
splash.jpg (668.26 KiB) Viewed 12166 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Added spell checking for comments and code folding for Lua block comments(the other stuff doesn't work yet).

PS: ignore tha fact that some of the text is german. some of the UI elements auto-translate to your system language.
Attachments
spellcheck.jpg
spellcheck.jpg (103.13 KiB) Viewed 12160 times
folding.jpg
folding.jpg (104.62 KiB) Viewed 12160 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

I re-did the menus and converted the button bar to a bar of sub tool bars. this allows you to move some of the button groups arround or detach them completely from the menu bar.
Attachments
fmcs-toolbars.jpg
fmcs-toolbars.jpg (61.29 KiB) Viewed 12146 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Seems I can't use LuaJ. It throws the weirdest error messages at me, has big problems with comments, marks the wrong code(usually comments) as error and so on.
that means that I will probably sit at least 3 weeks on writing my own parser.

except someone here has a good Lua 5.2 parser which can be embedded into Java....
seriously, if you have one, give it to me... you save me weeks.
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Current status on the JavaScript to Lua translator:

JavaScript

Code: Select all

// Line Comment
// Line Comment

var globalVariable = "hi";

function myFunction() { // Line Comment

	/**
		Block Comment
		with
		more
		lines
	*/
	
	var hello = "Hello";
	hello = null;
	hello = undefined;
	
	if(hello != undefined && hello !== undefined) {
	
		for(var index = 0; index < 10; index++) {
		
			print('Hi');
		}
		
		do {
		
		} while(something);
	}
}
Resulting Lua Code:

Code: Select all

-- Line Comment
-- Line Comment

 globalVariable = "hi";

function myFunction()  -- Line Comment

	--[[*
		Block Comment
		with
		more
		lines
	]]--
	
	local hello = "Hello";
	hello = nil;
	hello = nil;
	
	if(hello ~= nil and hello ~= nil) then
	
		for(local index = 0; index < 10; index++) {
		
			print('Hi');
		}
		
		repeat 
		
		 until(something);
	}
end

I know it's not correct right now but at least the biggest part is translated.
I will probably have to write a small definition of JavaScript(FMCS Edition) as it too different from normal JavaScript.
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Custom Libraries are now also shown in the tree. And with them all their child elements.
Attachments
fmcs-libs.jpg
fmcs-libs.jpg (96.7 KiB) Viewed 12066 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

Hmmm...
Attachments
1jj9pw.jpg
1jj9pw.jpg (55.02 KiB) Viewed 12047 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: Factorio Mod Creator Studio [IN DEVELOPMENT]

Post by RalleYTN »

I MADE IT!!!
I made the first big step towards a functional editor.
It is now possible to open things in the project tree with double click!!!
...
...
But it's currently only possible for elements inside of custom libraries
...
And only if these elements are either .lua or .js files.
...
BUT I CAN OPEN THEM!!!
Attachments
fmcs-big-progress.jpg
fmcs-big-progress.jpg (252.43 KiB) Viewed 12035 times
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
Post Reply

Return to “Development tools”