evaera / cmdr Goto Github PK
View Code? Open in Web Editor NEWExtensible command console for Roblox developers
Home Page: https://eryn.io/Cmdr/
License: MIT License
Extensible command console for Roblox developers
Home Page: https://eryn.io/Cmdr/
License: MIT License
Parse bind resources arguments as $1
Ambient arguments like $hover
Bindable resources: !
Bindable players (chat): @
Add commands:
For example, hiding admin commands from the everyday user if Cmdr is being used as a gameplay element as well as an admin console. Maybe a BeforeRun hook could be used for this, maybe the help command could read from context.State.Hidden
if it exists, or maybe context.State.Whitelist
?
A custom help command can do this, but what about the default one?
Here is what my Model to Lua plugin spit out, which could easily be integrated into the Scripts. It would make setup easier and it would better guarantee that this repo is fully functional.
local Cmdr = Instance.new("ScreenGui")
Cmdr.DisplayOrder = 1000
Cmdr.Name = "Cmdr"
Cmdr.ResetOnSpawn = false
local Frame = Instance.new("ScrollingFrame")
Frame.BackgroundColor3 = Color3.fromRGB(17, 17, 17)
Frame.BackgroundTransparency = 0.4
Frame.BorderSizePixel = 0
Frame.CanvasSize = UDim2.new(0, 0, 0, 100)
Frame.Name = "Frame"
Frame.Position = UDim2.new(0.025, 0, 0, 25)
Frame.ScrollBarThickness = 6
Frame.ScrollingDirection = Enum.ScrollingDirection.Y
Frame.Selectable = false
Frame.Size = UDim2.new(0.95, 0, 0, 50)
Frame.Visible = false
Frame.Parent = Cmdr
local Autocomplete = Instance.new("Frame")
Autocomplete.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
Autocomplete.BackgroundTransparency = 0.5
Autocomplete.BorderSizePixel = 0
Autocomplete.Name = "Autocomplete"
Autocomplete.Position = UDim2.new(0, 167, 0, 75)
Autocomplete.Size = UDim2.new(0, 200, 0, 200)
Autocomplete.Visible = false
Autocomplete.Parent = Cmdr
local UIListLayout = Instance.new("UIListLayout")
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout.Parent = Frame
local Line = Instance.new("TextLabel")
Line.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Line.BackgroundTransparency = 1
Line.Font = Enum.Font.Code
Line.Name = "Line"
Line.Size = UDim2.new(1, 0, 0, 20)
Line.TextColor3 = Color3.fromRGB(255, 255, 255)
Line.TextSize = 14
Line.TextXAlignment = Enum.TextXAlignment.Left
Line.Parent = Frame
local UIPadding = Instance.new("UIPadding")
UIPadding.PaddingBottom = UDim.new(0, 10)
UIPadding.PaddingLeft = UDim.new(0, 10)
UIPadding.PaddingRight = UDim.new(0, 10)
UIPadding.PaddingTop = UDim.new(0, 10)
UIPadding.Parent = Frame
local Entry = Instance.new("Frame")
Entry.BackgroundTransparency = 1
Entry.LayoutOrder = 999999999
Entry.Name = "Entry"
Entry.Size = UDim2.new(1, 0, 0, 20)
Entry.Parent = Frame
local UIListLayout2 = Instance.new("UIListLayout")
UIListLayout2.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout2.Parent = Autocomplete
local Title = Instance.new("Frame")
Title.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
Title.BackgroundTransparency = 0.2
Title.BorderSizePixel = 0
Title.LayoutOrder = -2
Title.Name = "Title"
Title.Size = UDim2.new(1, 0, 0, 40)
Title.Parent = Autocomplete
local Description = Instance.new("Frame")
Description.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
Description.BackgroundTransparency = 0.2
Description.BorderSizePixel = 0
Description.LayoutOrder = -1
Description.Name = "Description"
Description.Size = UDim2.new(1, 0, 0, 20)
Description.Parent = Autocomplete
local TextButton = Instance.new("TextButton")
TextButton.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
TextButton.BackgroundTransparency = 0.5
TextButton.BorderSizePixel = 0
TextButton.Font = Enum.Font.Code
TextButton.Size = UDim2.new(1, 0, 0, 30)
TextButton.Text = ""
TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
TextButton.TextSize = 14
TextButton.TextXAlignment = Enum.TextXAlignment.Left
TextButton.Parent = Autocomplete
local TextBox = Instance.new("TextBox")
TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextBox.BackgroundTransparency = 1
TextBox.ClearTextOnFocus = false
TextBox.Font = Enum.Font.Code
TextBox.LayoutOrder = 999999999
TextBox.Position = UDim2.new(0, 140, 0, 0)
TextBox.Size = UDim2.new(1, 0, 0, 20)
TextBox.Text = "x"
TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
TextBox.TextSize = 14
TextBox.TextXAlignment = Enum.TextXAlignment.Left
TextBox.Parent = Entry
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.BackgroundTransparency = 1
TextLabel.Font = Enum.Font.Code
TextLabel.Size = UDim2.new(0, 133, 0, 20)
TextLabel.Text = ""
TextLabel.TextColor3 = Color3.fromRGB(255, 223, 93)
TextLabel.TextSize = 14
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
TextLabel.Parent = Entry
local Field = Instance.new("TextLabel")
Field.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Field.BackgroundTransparency = 1
Field.Font = Enum.Font.SourceSansBold
Field.Name = "Field"
Field.Size = UDim2.new(0, 37, 1, 0)
Field.Text = "from"
Field.TextColor3 = Color3.fromRGB(255, 255, 255)
Field.TextSize = 20
Field.TextXAlignment = Enum.TextXAlignment.Left
Field.Parent = Title
local UIPadding2 = Instance.new("UIPadding")
UIPadding2.PaddingLeft = UDim.new(0, 10)
UIPadding2.Parent = Title
local Label = Instance.new("TextLabel")
Label.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Label.BackgroundTransparency = 1
Label.Font = Enum.Font.SourceSansLight
Label.Name = "Label"
Label.Size = UDim2.new(1, 0, 1, 0)
Label.Text = "The players to teleport. The players to teleport. The players to teleport. The players to teleport. "
Label.TextColor3 = Color3.fromRGB(255, 255, 255)
Label.TextSize = 16
Label.TextWrapped = true
Label.TextXAlignment = Enum.TextXAlignment.Left
Label.TextYAlignment = Enum.TextYAlignment.Top
Label.Parent = Description
local UIPadding3 = Instance.new("UIPadding")
UIPadding3.PaddingBottom = UDim.new(0, 10)
UIPadding3.PaddingLeft = UDim.new(0, 10)
UIPadding3.PaddingRight = UDim.new(0, 10)
UIPadding3.Parent = Description
local Typed = Instance.new("TextLabel")
Typed.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Typed.BackgroundTransparency = 1
Typed.Font = Enum.Font.Code
Typed.Name = "Typed"
Typed.Size = UDim2.new(1, 0, 1, 0)
Typed.Text = "Lab"
Typed.TextColor3 = Color3.fromRGB(131, 222, 255)
Typed.TextSize = 14
Typed.TextXAlignment = Enum.TextXAlignment.Left
Typed.Parent = TextButton
local UIPadding4 = Instance.new("UIPadding")
UIPadding4.PaddingLeft = UDim.new(0, 10)
UIPadding4.Parent = TextButton
local Suggest = Instance.new("TextLabel")
Suggest.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Suggest.BackgroundTransparency = 1
Suggest.Font = Enum.Font.Code
Suggest.Name = "Suggest"
Suggest.Size = UDim2.new(1, 0, 1, 0)
Suggest.Text = " el"
Suggest.TextColor3 = Color3.fromRGB(255, 255, 255)
Suggest.TextSize = 14
Suggest.TextXAlignment = Enum.TextXAlignment.Left
Suggest.Parent = TextButton
local Type = Instance.new("TextLabel")
Type.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Type.BackgroundTransparency = 1
Type.BorderColor3 = Color3.fromRGB(255, 153, 153)
Type.Font = Enum.Font.SourceSans
Type.Name = "Type"
Type.Position = UDim2.new(1, 0, 0, 0)
Type.Size = UDim2.new(0, 0, 1, 0)
Type.Text = ": Players"
Type.TextColor3 = Color3.fromRGB(255, 255, 255)
Type.TextSize = 15
Type.TextXAlignment = Enum.TextXAlignment.Left
Type.Parent = Field
And potentially single-character commands without spaces
Like a relative3
type that accepts ~
coordinates like Minecraft does. to @ ~, ~500, ~
would teleport you 500 studs into the air. to @ ~, ~-500, ~
500 studs down.
Interpreting what these coordinates are relative to would be at the command's discretion.
I may be doing something horribly wrong, but hooks don't seem to work properly and I can't create a permissions system because of it.
Trying to do it this way on the server:
local Cmdr = require(script.Cmdr)
Cmdr:AddHook("BeforeRun", function(context)
print("test")
end)
Cmdr:RegisterDefaultCommands()
'test' never gets printed on accurate play solo, or testing with 2 players.
This is using the .rbxm under release and seems to also apply to the RoStrap version.
Autocompletes with players in-game, but also allows any string. Resolves to the player's user ID.
Code:
Server:
local replicatedStorage = game:GetService('ReplicatedStorage')
local cmdr = require(replicatedStorage.Cmdr)
cmdr:RegisterDefaultCommands({'Help', 'DefaultUtil'})
Client:
local replicatedStorage = game:GetService('ReplicatedStorage')
local cmdr = require(replicatedStorage:WaitForChild('CmdrClient'))
cmdr:SetPlaceName('[censored]')
cmdr:SetMashToEnable(true)
cmdr:SetActivationKeys({Enum.KeyCode.Semicolon})
Result:
You sure this is only help and util?
I installed it with RoStrap, I'll try manually installing it from the repo and see if the issue's fixed.
I'm on an environment right now where I can't use WASD to move. I'll open Cmdr, type the commands I need, then use the arrow keys to move. This will open up the autocomplete window, even if Cmdr is not open.
If the first argument of a bound command is of type inputState
, then send true
on key down, and false
and key release.
any arguments should be appended after this
A client-side command that would use the DefaultUtil
group.
When run, it would simply remove all lines besides the input line from the console screen.
Also: Don't send if required arguments are missing
Default implies optional
Union types that default to one type, but given a prefix (such as %
) turn into another type. Would be delivered to function runner as { type="type"; value="value" }
.
This could be useful for re-implementing team matches. Union between players and teams. Maybe a new type known as teamplayers, which matches teams, but returns array of players to the function. Under that system, current players type would be players % teamplayers
(union)
another example:
"players % teamplayers # place : string"
If you have a listable type, and attempt to use CSV with quotes, the values aren't found.
As a simple example using built-in types/commands:
This command would work: teleport TripleFrequency,TripleFrequency TripleFrequency
But this command wouldn't: teleport "TripleFrequency",TripleFrequency TripleFrequency
This is only an issue when specifying multiple values, if you only have one value of a listable type, then it still works: teleport "TripleFrequency" TripleFrequency
If any of values in a listable type are in quotes, then it fails.
There are a number of problems with this. For one, it gives a copy to everyone by default. Furthermore, if this code runs after any players have already joined, then it will not be replicated to them. Instead, authorized players who should be able to use Cmdr should call the instantiation function on their machines.
Imagine this:
Type h
. You see help
, but you want history
. Down arrow to select history
, review the description, looks good. Right arrow... doesn't autocomplete, nothing happens. That's okay... clicking on the item also does nothing... Well heck, now I have to type a whole 5 letters. This is definitely not okay.
:)
Allow the !
prefix to bind network events.
Should this replace anything that was listening to this event before? Probably...
...
Args = {
{
Type = "players";
Name = "from";
Description = "The players to teleport";
OverrideType = {
Autocomplete = function (context, default) -- Accepts the command context, and the default function from the type defintion
return function (value) -- Can inspect the context and return either the `default` value or a new function to replace the one in the type definition
if context:GetArgument(1):GetValue() == "something" then
return {1, 2, 3}
end
end
end
}
},
}
...
natural
, which would be a subset of the current integer
type, would allow numbers in the range 0..n
.
positive
, which would be a subset of natural
, would allow the range 1..n
byte
, which would allow the range 0..255
.
digit
, which would allow the range 0..9
.
Maybe a list of prefixes in the autocomplete menu?
Should this also be set server side to protect against exploiters?
Will this be all it is or do you plan to make a full-fledged admin system or is that up to the developer themselves. Just curious.
Add a third, optional parameter as a number. Lower should be sooner.
takes an unlistable type and makes it a listable type
for convenience
And add runif
to the meta-commands section (and rename that section to "meta-commands")
runif
arguments&&
in all contexts, not just alias.run
to eval
Can you at least give us a place demo? (It can be useful when people don't understand how to use this)
And Where is the adminlist userid? I can't find it somewhere.
And what's the prefix key? To open the command bar?
All of your tutorial is which I don't understand how to run it.
Alias:
Search command string for sequences to automatically determine number of arguments, with optional type checking and naming.
$1{string|Name here}
ALSO allow alias description in name
alias "something|this is the description" echo $1
which means that argument can be a comma-separated list of values
Commands that are executed inside of other commands, with the format ${command}
This is a blank table where hooks could add information to a command that the command could consume.
Registry:RegisterCommandObject
Not a bug, but if someone is doing this then they are confused and we should tell them about it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.