[CSM] CSM Designing and Testing Environment [csm_dte]

Post Reply
User avatar
FiftySix
Member
Posts: 16
Joined: Sun Jan 14, 2018 10:58
GitHub: BenjieFiftysix
In-game: fiftysix or 56
Location: Scotland
Contact:

[CSM] CSM Designing and Testing Environment [csm_dte]

by FiftySix » Post

CSM DTE
Client Side Mod Designing & Testing Environment

An advanced, ingame lua and formspec editor.

This can be used for creating, testing and using CSMs without reloading the game, and without the game crashing. This is also the easiest way to create advanced formspecs. It was tested with multiple CSMs, and they all worked. (actually in the current version, a few things might not work, but they will be fixed in the future)

CSMs can be created, or pasted in, and they should work the same as they would normally, except errors won't crash the game!

functions that are registered with minetest can be put in a function safe(func) to output errors to the UI when minetest calls them

scripts can be put in startup to run them automatically when the game loads. errors are also put in the UI

Features:
lua editor:

- print function
- coloured error output
- multiple files
- file creation and deletion
- safe function execution
- automatically run files at startup

formspec editor:

- every widget is available
- widgets are easy to edit
- formspec preview, shows what it will look like
- export as a function with parameters
- export as a string
- and a whole bunch of fancy stuff

Download
Github
Download


Screenshots:
Lua editor:
Image
Formspec editor
Image

To Use:

- use the command .dte to open the editor
- select the lua editor tab to run and edit CSMs
- select the formspec editor tab to create a formspec
- select the files tab to open, create, and delete files
- select the startup tab to select lua files to run when the game loads

How to install

- make sure you have client modding enabled (search for client modding in advanced settings, and set it to true)
- download and extract the zip file into clientmods\csm_dte or paste the init.lua file into it.
- add load_mod_csm_dte = true to the clientmods\mods.conf file
- join a game or server, and it should work!


Please tell me of any differences when running a CSM in this and the usual way. Thanks
I also need a list of API functions for registering functions with minetest, and a list of functions which only work before the game has loaded.
Last edited by FiftySix on Mon Jul 02, 2018 11:48, edited 6 times in total.

User avatar
Lejo
Member
Posts: 718
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: [CSM] lua IDE [lua_ide]

by Lejo » Post

Nice!!!

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [CSM] lua IDE [lua_ide]

by octacian » Post

This is a very interesting concept, and I quite like it - in fact, I once considered making something similar. There is one very basic problem, however, that for me anyway voids the usefulness of the entire concept. That reason is that Minetest's textarea is very limited. For me to be happy with writing more than a few short lines of code in an editor, it must at least have automatic indentation and syntax highlighting, two things which are completely impossible to implement within Minetest. Besides that, I'd prefer if it had the ability to do things such as select multiple parts of the code at once (multiple cursors). Not only that, but I usually have trouble copy-pasting stuff in and out of Minetest due to a weird bug in Irrlicht related to Linux, so I wouldn't be able to use it efficiently no matter what, but this is in no way your fault as it doesn't even have anything to do with Minetest.

Anyways, TL;DR: this is an amazing idea and a good implementation, but it lacks features that are impossible in Minetest, features that I consider a requirement for a good code editor.

May I also suggest that maybe you rename this to "lua_editor", and title it "In-Game Lua Code Editor"? Why? Well, the term IDE (Integrated Development Environment) refers to an environment usually specialized for a specific language, having debugging and testing tools, and usually having many if not all of the features I mentioned above.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
FiftySix
Member
Posts: 16
Joined: Sun Jan 14, 2018 10:58
GitHub: BenjieFiftysix
In-game: fiftysix or 56
Location: Scotland
Contact:

Re: [CSM] lua IDE [lua_ide]

by FiftySix » Post

octacian wrote:This is a very interesting concept, and I quite like it
Thank You!

The textarea is not great for writing in, but things can easily be pasted into it. My idea of how I would use it, was to write the code in a normal text editor, then copy it into the textarea (I'm on windows), so I wouldn't have to reload the game, and it wouldn't crash.
My post was poorly written and rushed, so I will probably make it more usefull in the future.

I will rename it to something else, probably not "Lua Editor", because I plan on adding some features for UI design and testing. Maybe "CSM Designing and Testing Envirnonment", or "CSM DTE" for short.

User avatar
Linuxdirk
Member
Posts: 3216
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [CSM] lua IDE [lua_ide]

by Linuxdirk » Post

FiftySix wrote:CSMs can be pasted in and used permanently using the startup option. You don't even have to reload the game!
Great, no more script-based automatic CSM updates using Git!

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Lone_Wolf » Post

This looks slightly cooler than the basic_robot csm. Love it!
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Lejo
Member
Posts: 718
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Lejo » Post

If you run a not Startup CSM with minetest.register_on_joinplayer(function(player)
The minetest.register_on_joinplayer(function(player) will never be done.

User avatar
FiftySix
Member
Posts: 16
Joined: Sun Jan 14, 2018 10:58
GitHub: BenjieFiftysix
In-game: fiftysix or 56
Location: Scotland
Contact:

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by FiftySix » Post

All(most?) options for registering functions with minetest will be overwritten in a future version, meaning they will work after startup. So far the only function which I have done this for is minetest(/core).get_mod_storage(). They will also automatically be run in a safe environment (error catching) without using the safe() function, and can hopefully be unregistered from the GUI.

A list of API functions for registering things or commands would be usefull, since I am new to modding. but most importantly all functions which don't work after startup.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Sokomine » Post

The idea of a preview of a formspec is very good. I wonder if it might be possible to just write the code with a normal editor and let the test mod read and interpret that text file whenever the developper requests an update. Would be horribly insecure in general gameplay; but developping your own mods is another matter.
A list of my mods can be found here.

User avatar
FiftySix
Member
Posts: 16
Joined: Sun Jan 14, 2018 10:58
GitHub: BenjieFiftysix
In-game: fiftysix or 56
Location: Scotland
Contact:

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by FiftySix » Post

I'm pretty sure you have misunderstood (or is it me?). I am talking about a preview of part of the project I am working on. The file (which I called the preview file) is a formspec creator, which generates the code for a formspec. And your idea for reading a file which was edited with a normal editor is currently not possible, because CSMs don't have file access (my few tests show at least).

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Lone_Wolf » Post

I love the formspec editor. Just one request. Allow users to reset the editor if this happens?
Image
(I just unchecked the item tickbox to remove but it the img was bigger...)

Also: maybe add the ability to set the background? (I didn't see it)
EDIT: The ability to duplicate elements would be nice
EDIT2: The ability to move elements around with some buttons in this form on the side somewhere

Code: Select all

  ^
<   >
  v
would be nice
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Lone_Wolf » Post

It would be nice if users were able to import formspecs too. I've already met with a time where that would be useful
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
FiftySix
Member
Posts: 16
Joined: Sun Jan 14, 2018 10:58
GitHub: BenjieFiftysix
In-game: fiftysix or 56
Location: Scotland
Contact:

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by FiftySix » Post

There is now a new version.
- Widgets can't overlap the editor. A red box is displayed to show the area it would be
- The colour of the background can be set
- Images can be made background images
- Widgets can be duplicated
- The new widget menu can be accessed without having to leave the selected widget
- the delete button has moved
- 2 new widgets have been added: tooltip and tabs
- The colour of InvLists can now be changed (from the Display tab because you can't change individual list colours)
- The Size menu has been renamed to Display because it has more stuff
- The size of the window is now displayed with an outline (shows actual size, and 0, 0 to width, height)

Edit:
I will not add the movement control buttons, but I will try and make keyboard controls move widgets (edit 2: not possible as far as I can see).
If I do add an option to import formspec strings, it won't be any time soon
Last edited by FiftySix on Sun Jul 01, 2018 12:37, edited 2 times in total.

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Lone_Wolf » Post

FiftySix wrote:There is now a new version.
- Widgets can't overlap the editor. A red box is displayed to show the area it would be
- The colour of the background can be set
- Images can be made background images
- Widgets can be duplicated
- The new widget menu can be accessed without having to leave the selected widget
- the delete button has moved
- 2 new widgets have been added: tooltip and tabs
- The colour of InvLists can now be changed (from the Display tab because you can't change individual list colours)
- The Size menu has been renamed to Display because it has more stuff
- The size of the window is now displayed with an outline (shows actual size, and 0, 0 to width, height)
Awesome! I'm loving this CSM
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
FiftySix
Member
Posts: 16
Joined: Sun Jan 14, 2018 10:58
GitHub: BenjieFiftysix
In-game: fiftysix or 56
Location: Scotland
Contact:

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by FiftySix » Post

I have finally put the formspec editor into the main file!
So the formspec editor is part of the same mod, and can be accessed from the same UI, using tabs.
Now it is is much easier to access the formspec editor, because it doesn't have to be installed separately, and I hope more people will get to use it!

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by Lone_Wolf » Post

This clientmod will crash if you don't delete modstorage before using the latest update (For me anyway).
The modstorage is in /minetest/client/modstorage/
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by aristotle » Post

@FiftySix
+1!
Thank you. :)
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by ChimneySwift » Post

Wow, much better than I at first thought.

This is going to become my go-to for whenever something wants a formspec.
A spoon is basically a tiny bowl with a stick on it

User avatar
HackerinPink
Member
Posts: 43
Joined: Tue Oct 29, 2019 19:36
Location: Somewhere in a 100% regular place.
Contact:

Re: [CSM] CSM Designing and Testing Environment [csm_dte]

by HackerinPink » Post

I don't know anything about coding in Lua, or making mods, but I NEED THIS!
A Dude with power and Intellect.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest