Quicks
Note: If you want something simple this can be super simple, but all the docs below are also for advanced users
What is it?
Quicks is a plugin that lets you type short “commands”, and it will generate the full code.
How does this differ from other snippet tools?
This one is different because it’s more than just simple snippets. This one has many other features like importing module scripts by name(it will find the one you want and import it), generating arrays of any size auto-filled with anything, as well as auto importing services when they are not imported, and smartly using already imported services to get module scripts instead of making its own. On top of that, it supports you to make your own snippets that range from just simply replacing text to analyzing the rest of the document and making smart decisions. Making your own “commands” is simple, and contains a built-in API for doing more advanced things that you might not want to code yourself. In short, it’s smarter and super easy to extend.
I still do recommend taking a look at other tools, because they have their own advantages like a nice UI that might be a little more beginner-friendly when adding your own commands, but this does limit them to very basic functionality(almost like a copy and paste).
How do I use it?
Note: To use this you need to enable the script editor API under beta features, and also when installing the plugin allow the permissions it needs like “Script Injection”.
Basic Use:
To use it just install the plugin, and then if all settings are on default settings then you can start by typing “>
”, this is the default opening character for all commands. Then just type a command after that. Eg. “>GS(Players)
”, will get the player service after hitting tab after the last character on that line. It should look like this: local Players = game:GetService("Players")
Note: commands are case sensitive unless you edit that in “Quicks Config”
Built in commands
- GS(ServiceNames) - This gets the service input. If you need multiple services you could do
>GS(Players, Lighting, ReplicatedFirst)
- MS(Module Script Name) - This will search through the whole project and find a module script with that name. Again this can be used with multiple scripts, and these will all be imported on separate lines.
>MS(PlayerLogic, InventoryManager)
- ARR(length of array, default value of all indexes, ?array name) - This generates an array. The array’s name is not needed.
>ARR(10, 1)
will createlocal array = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
,>ARR(5,2,Number2)
will createlocal Number2 = { 2, 2, 2, 2, 2 }
. Also, Note that the character~
will get the current index of the array, this can be multiplied or have any basic math applied to it. Here is an example:>ARR(5,~ * 2,MultiplesOf2)
will createlocal MultiplesOf2 = { 2, 4, 6, 8, 10 }
- CLASS(Class Name) - This will generate a basic class template. To generate a class with the name Tree we can write
>CLASS(Tree)
That is all for now. If you have any suggestions for commands or improvements feel free to tell me.
How do I add my own commands?
You can add your own commands by finding the module script named “Custom Quicks” if it’s hidden try typing >show in the terminal (You can also use >hide in the terminal to hide both of the plugin config files). Once you locate this file and open it you will see this:
-- doc is the whole document of the modified script
-- arguments is an array of items within (), and split by commas (assuming the ARGUMENT_SPLITTER is a comma)
-- EG. >TEST(hello, world) makes arguments equal to {"hello", "world"} (All passed-in values are always strings)
-- Also note that if you make a command that has the same "command" as a built-in command it will overwrite it
return {
["TEST"] = {
func = function (doc, arguments, Utils, Settings, Defaults)
return "This replaces the command"
end,
},
}
Note: Naming your command the same name as a default command will overwrite it
This already has a custom command in it called TEST. To try it out you can do >TEST()
or >TEST
in another file, and it should replace with what’s in that return statement. To change the name just change where it says [“TEST”] to whatever you want your commands name to be. Then inside func, you can code whatever you want it to be replaced with, not limited to plain strings. If you want to make more than one custom command you can copy this:
["ANOTHER_COMMAND"] = {
func = function (doc, arguments, Utils, Settings, Defaults)
return "This replaces the command"
end,
},
Then add that below where the test command ends.
So what are all these parameters in the function?
- doc is just a ScriptDocument (there is no proper documentation for this out yet unfortunately)
- arguments is an array of all the things passed into the command, its a good idea to always check and make sure that the correct amount of arguments are passed in
- Utils contain a lot of utility functions to help with stuff you might not want to code yourself, more on this later
- Settings is a table of all the user’s settings in “Quicks Config”. It even supports custom settings if you add it to the config file! Eg
Settings.PREFIX
will get the current command prefix, probably>
if you have not edited the config - Defaults return the default functions for all the built-in commands, this can be used to rename a default command or to extend its behavior. More on renaming commands later.
Utils (For making your own commands easier and faster)
There are many helpful things under the Utils perimeter when making a custom command.
- PLUGIN_NAME - Yea this gets the plugins name
- Version - If you ever wanted to check the version, here you go
- CheckPeramCount(requiredPeramCount, params) - returns true if there are at least x amount of params required when the command was ran
- Warn(Warning Message) - Let’s you put a warning in the console. Good for letting them know they passed too few arguments in or something
- Trim(str) - Trims whitespace at the start and end of any passed-in string
- SplitBy(str, splitArr) - returns an array split by multiple different characters instead of just 1. Use like
Utils.SplitBy("Another-Hello.World", {"-","."})
This would return{"Another", "Hello", "World"}
- IsValidServiceName(serviceName) - returns true if its a valid service name
- GetServicesString(serviceList) - returns a string that contains all the code needed to import all the services. Basically, this is what
>GS(services)
does and uses - FindObj(loc, objType, name, whitelistedCategories) - this returns the found object. loc is the root location you want it to search(will only search under the whitelistedCategories param), objType is a string of the object type you want, for example
"ModuleScript"
, or"Part"
, can be nil. name is the name of the object you want to find. whitelistedCategories is an array of areas it can search. Its recommended to pass in the settings SEARCH_LOCATIONS, but if you want to confine the search even more you can here. - GetVarName(lineString) - gets the name of a variable on any given line. Pass in the line as a string
- IsGetServiceLine(lineString, service) - This makes sure that there is a variable that holds a service on that line. Returns a boolean. lineString is the string of the line you want to check. service is the service we want to check for.
Renaming commands
Renaming commands is simple. Let’s say you want to rename the GS command to GetService. To do this you would do the following:
return {
["GS"] = {
func = function (doc, arguments, Utils, Settings, Defaults)
--Make the default one do nothing
return nil
end,
},
["GetService"] = {
func = function (doc, arguments, Utils, Settings, Defaults)
return Defaults["GS"].func(doc, arguments, Utils, Settings, Defaults)
end,
},
}
First, we are overwriting the default GS command so that it does nothing. Then we are making our own GetService command and just telling it to use the default GS function.
Some Extra Stuff
-
Commands that don’t need any perimeters can just be run without even requiring parenthesis. Right now no built-in commands can be run without any arguments so it only applies to custom commands
-
When this plugin updates and has some extra settings added, it will automatically open the settings file and add all the missing settings. It won’t change any already set settings
-
I want to sometime make an actual website with all the documentation split up better, but for now, this is all there is.
-
If updates are slow it’s because I’m working on my own games, and other things. Thanks for understanding
-
If you create a really useful command feel free to post the source code and what it does, and if it’s okay with you ill try to implement it into the core plugin.
-
Want anything else in this plugin? feel free to ask
-
Feel free to report any bugs down below, ill get to them when I can.