Currently, it is hard to add a script to a game that is treated by Studio just as simple text, rather than code (like a .txt file, which is what would be used in other coding environments).
Right now, you can use a fully commented out Script as so:
--[[
Hello world
]]
But, there are a few problems with this
- The entire script is in the comment colour, which a lot of people have as fairly close to the background colour, making it hard or weird to read, especially for longer text
- It can be hard to parse, which can sometimes be done in plugins. For example, there are many different ways to fully comment out a script, all of which can take a lot of effort to account for.
- It feels like a workaround
It would be nice to have either a new Script type, or a new Script property. This could be used for:
- READMEs in models
- JSON input/output for plugins
- Comments actually in the game structure
- Documentation
- General notes that are easy to be shared between developers
You can use StringValues for this, but they are quite hard to read.
9 Likes
I think a way this could be implemented is using the RunContext from the script. Would be as PlainText.
1 Like
What would be even better is a separate script type that would instead have a property specifying what kind of data it is holding, which would determine how it is formatted in the editor (for example, having an option between Plain, JSON and Markdown) which would cover most common use cases.
RunContext doesn’t really make sense because plain text is not a “context” but the type of data the script holds.
4 Likes
StringValues and attributes both give you this functionality, dont see why you’d want to use a script for this.
An editor for plaintext string values would be cool though, but thats for the plugin space to solve
1 Like
Without plugins, the text in StringValues and attributes are small, single-line and hard to read, since they’re only really intended for short text, or just for the use of scripts.
If you need a text editor plugin, it doesn’t make it as shareable or recognisable as text. For example, a README should be easily accessible out of the box, but needing a plugin removes that.
As for using Scripts, I more mean a Script-similar instance would be nice. “Script” does sort of imply code, so there could be a better name for this.
1 Like