Quicks - A Smart Snippet Coding Tool

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.

Quicks Demo

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 create local array = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, >ARR(5,2,Number2) will create local 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 create local 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 :slight_smile:

  • 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 :slight_smile:

  • Feel free to report any bugs down below, ill get to them when I can.

Get The Plugin Here

27 Likes

Update: major bug fix.
This bug seemingly got pushed to a later patch update. This made it so the plugin couldn’t init properly, and that made the plugin not work at all. This should be fixed now, tell me if you find anything else.

This plugin is very useful, maybe add some more defaults.

When using spaces in names of instances it will try to make a variable with spaces when using >MS() I know using spaces isn’t smart for instances but maybe a thing you should fix.
Off topic: I don’t use spaces, was just for testing purposes.

Also when using >show maybe print something to say it was success, some people don’t have an organised game and spam it because they don’t see it.

I would recommend using this to save custom quicks and the config:
Plugin:SetSetting()
Plugin:GetSetting()

1 Like

I made a custom quick that makes a killpart.
How to use
1: Run >show in the terminal if you haven’t done this yet.
2: Paste the code (seen below) into the Custom Quicks module script. Place it above the last comma(highlighted in the screenshot)
image
3: Use it like any other quick. (>KILLPART(Part))
Notes
-You can also use multiple instances but I don’t recommend it. (Use CollectionService instead it is a lot less messy with 2+ parts)

-This is just something quick to learn the api.
Code

		func = function (doc, arguments, Utils, Settings, Defaults)
			if arguments[1] == "" then
				Utils.Warn("Please provide a part.")
				return
			end
			
			if arguments[2] then
				Utils.Warn("Consider using CollectionService(https://create.roblox.com/docs/reference/engine/classes/CollectionService) for multiple kill parts. (This quick will still run)")
			end
			
			local result = ""
			
			for _, argument in arguments do
				if result then
					result = result.."\n"..argument..[[.Touched:Connect(function(hit)
	local Humanoid = hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid", true)
	if not Humanoid then
		return
	end
	Humanoid.Health = 0
end)]]
				else
					-- Removes new line from first part.
					result = result..argument..[[.Touched:Connect(function(hit)
	local Humanoid = hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid", true)
	if not Humanoid then
		return
	end
	Humanoid.Health = 0
end)]]
				end
			end
			
			return result
		end,```
1 Like

Hello. I am planning to add more. Also ill have to investigate the space bug.
What was the exact “command”/quicks that you ran?
Was it >MS(Module Script)?
After some testing its probably that, I will add this to my list of bugs to fix.

Also it does use
Plugin:SetSetting()
Plugin:GetSetting()
They save when they are modified.

Yes, it was exactly that.

Oh, I didn’t know that.

1 Like

Alright well that should be fixed now!
>MS(Module Script) now gives you
local Module_Script = require(StarterPlayer["Module Script"])

Thanks for the report!

1 Like

Update 0.1.1

Fixed bug where spamming >show would create multiple of the same config file. This would confuse the plugin.

New Beta Feature:

Ability to install plugins other people have made just from a command line command

How do I install modules through it?

In the command line you can type >install (module name)
To execute it add a space to the end of the command(this is a limitation of custom terminal commands, ill probably be moving most commands to UI soon.)
image
If this is your first time installing you will see something like this
image
Allow it so it can download the module

What are modules?

Modules are things you can install to gain a bunch of new quicks. A module can contain 1 or more quick.

Warnings on this feature

No there shouldn’t be any viruses since when commits are made to the repo it will go though a verification process. The issue is if there is already a quick with the same name it may conflict. In the future I want to make it check for this, but for now open the file and make sure there are no issues. Rename any commands that are conflicting.
Another issue is that if your last curly brace in the return doesn’t end in a comma it will just append the module without adding one. You will need to add one manually.

How can I make a module that can just be installed?

  1. Go here to the github repo
  2. read the README on how to format the file.
  3. Add your stuff and make a pull request. You need to wait till it gets past this verification step till it gets put in the main repo.
  4. If all goes well you should be able to type >install (module name)

So whats my module name?
Your module name is whatever you named your folder. (It cant be named the same thing as another folder, all module names have to be unique)

If you cant figure this out, or don’t have a GitHub account feel free to reply to this or contact me, ill put it up for you if you send the code. :slight_smile:

Thanks for reading!