• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Release OTA RME 4.2.0 - LUA Scripting

Michy

Active Member
Joined
May 20, 2010
Messages
114
Reaction score
30
Hello, it's been many years since I've been here.

I've been quite active in the community recently and have become a contributor to the OTA Remeres Map Editor repository.

On this occasion, I'm here to present update 4.2.0, which I believe is quite disruptive because it allows you to extend the Editor to suit your needs without having to compile, allowing you to create dynamic windows, interact with the environment, and more.

For now, this is the API, but I believe it will grow as different types of needs are identified.

Lua API:
  • app (editor state, transactions, selection, clipboard, camera, events, storage)
  • map, tile, item, creature/spawn, selection
  • brushes
  • Dialog (UI)
  • Image
  • mapView (overlays)
  • http
  • noise, algo, geo (procedural & geometry)

Full API docs: README.md
Download: OTAcademy RME 4.2.0




Quick preview of a small favorites tool I created for myself

Example of a script for generating random terrain

You have plenty of freedom to create tools that make your work much easier. I hope it helps you and your fellow mappers build more and better!
 
Thank you! Hopefully people will use it and propose new APIs needed to work more freely from LUA
 
Congratulations Michy, its a great release, I hope soon they open a new forum session for RME scripts, xDDD
 
This is really awesome, sadly I am having an issue with
Code:
 attempt to index a nil value (global 'io')
Which is making it so I can't read files.
 
Last edited:
This is really awesome, sadly I am having an issue with
Code:
 attempt to index a nil value (global 'io')
Which is making it so I can't read files.
File reading is sandboxed to prevent access to files outside the script folder context, with the intention of preventing malicious scripts.

It seems I forgot to update the documentation.

You can only use paths relative to the script folder using SCRIPT_DIR as a reference to the current folder. You can also use require(“YOUR_FOLDER/...”)
 
Thanks for the quick response!
Hmm, alright. That makes sense, but I am still a little confused on how you would go about reading an arbitrary .txt file that's in the SCRIPT_DIR? require() works for .lua files, but what about plain text files like .txt or .csv?
 
Thanks for the quick response!
Hmm, alright. That makes sense, but I am still a little confused on how you would go about reading an arbitrary .txt file that's in the SCRIPT_DIR? require() works for .lua files, but what about plain text files like .txt or .csv?
It's true that I didn't think about this scenario when I added the limitations, but it's also true that each use case is unique. I will propose this change, but always with security in mind.

For now, the only workaround you have is dofile, but you would have to change the content of the .txt or .csv file to a suitable format with return in .lua
 
I understand the security concerns, it makes sense to be careful with file access.
But I do feel like reading files from the scripts folder specifically would be really useful and still safe since users are already trusting scripts enough to run them. The file picker widget especially feels incomplete without a way to actually read the selected file. Using .lua files with string content works as a workaround, but it's a bit awkward when the data is naturally .txt or .csv.
 
Thank you for your feedback and interest in scripting in RME. File reading is a big topic of debate, but I think we can find a solution that suits everyone. The idea behind this first iteration was to gauge the response and identify any weaknesses. We could say that this is one such weakness, and we will have to resolve it!
 
Back
Top