Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

rbx-cmdr

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rbx-cmdr - npm Package Compare versions

Comparing version
1.1.2
to
1.1.3
+74
CHANGES.md
# v1.1.3
- Fix an issue where the arrow keys could be used to open auto complete when the menu is closed (#62)
- Make AutoExec commands only run on the client (#61)
# v1.1.2
## Command history
- Up/down arrow now traverses command history when you haven't entered any text.
- New `history` utility command which dynamically returns your previously-entered commands based on a number index.
- New alias `! <number>` to re-run previous commands.
- `! -1` re-reruns your last command.
- `! 2` re-runs your second command.
- New alias `!!` to re-run your last command.
- New alias `^ <search> <replace>` to re-run your last command with string substitution, replacing `search` with `replace`.
## New utility commands
- `history` (see above)
- `position [player]`: Returns the Vector3 position of a player (or yourself if omitted) as a string `X,Y,Z`.
- `replace <haystack> <needle> <replacement>`: Substitutes text inside `haystack` matching Lua pattern `needle` with `replacement`.
- `discard <command string>`: Identical to `run`, except the return value is discarded (always returns `""`).
- `clear`: Clears the console
## New default types
- Plural primitives (strings, numbers, integers, booleans)
- *Plural* types simply resolve into an array of the named type.
- brickColor(s)
- teamColor(s): Resolve into a BrickColor based on the color of a Team
- color3(s)
- hexColor3(s): Resolve into a Color3 from a hexadecimal color
- brickColor3(s): Resolve into a Color3 from a BrickColor
- vector3(s), vector(2)s
- duration(s): Resolve human-readable times like 20Minutes, 2Hours, 1Year into a number of seconds.
## Usage improvements
- Cmdr now supports escape sequences
- `\\` for escaping a literal backslash
- `\"` and `\'` for escaping quotes inside of strings
- `\t`
- Tab stops display as expected when `\t` is present in a line on the console
- `\n`
- New lines are not displayed in the console as of right now and are displayed as a space. However, `\n` literals may still be useful for custom commands.
- `\xA9` (2-digit) and `\u2661` (4-digit) hexadecimal unicode escapes
- `\$` for escaping argument replacements and embedded commands in command strings *only*.
- Invalid escape sequences are left in-place.
- `help` command now lists command aliases
- `teleport` and `to` now accept a Vector3 with the `@` prefix
## API Improvements and Changes
- Cmdr now enforces that types begin with a lowercase letter or digit for consistency.
- `Dispatcher:RegisterHooksIn`, `RegisterTypesIn`, and `RegisterCommandsIn` now allow nesting via folders.
- `Dispatcher:AddHook` has been renamed to `Dispatcher:RegisterHook`. The old name still exists as a fallback, but is undocumented and may be removed in the future.
- Cmdr now throws an error if a command has both `Data` and `Run` (not a bug, but if someone is doing this then they are confused)
- Hooks now have an optional third parameter `priority`. Hooks run in order of priority; lower numbers run first. The default priority is `0`.
- CommandContexts now have an empty `State` table. This is intended to be used in combination with the `BeforeRun` hook to allow you to add custom information to this command that you can consume inside of your command logic or other hooks.
- For example, if you want many commands to have different behavior based on someone's rank, you can add their rank in the `State` table for your commands to consume and branch off of.
- New function `CmdrClient:SetMashToEnable(true)` to enable *Mash to Enable* mode, which requires the player to press the activation key 7 times in quick succession to open the Cmdr menu for the first time. This is not meant as a security feature, but rather as a way to ensure that the console is not accidentally obtrusive to regular players of your game.
- New client-only function `Dispatcher:GetHistory()` to get an array of the local user's command history. This only includes commands actually typed by the user, no embedded or programmatically run commands.
- `Dispatcher:EvaluateAndRun` now accepts an options table in the third parameter rather than Data.
- Automatic Execution: Commands can now contain an `AutoExec` table which contains commands to execute immediately as the command is registered.
- This is useful for registering aliases associated with your command or initializing state.
- Commands listed in AutoExec are deferred until the end of the Lua cycle, which eliminates any possibility of ordering issues caused by commands being registered out of order.
## Utility methods
- `Util.MakeEnumType` and `Util.MakeFuzzyFinder` now accept `Enum`s and arrays of tables with a `Name` key. (These functions can already accept: array of strings, array of Instances, array of EnumItems, or a single Instance whose children are used).
- New functions `Util.Map` and `Util.Each` for mapping values of an array and tuple respectively.
- New function `Util.MakeSequenceType` for quickly creating a type that contains a value sequence, like Vector3 or Color3. The delimeter can be either `,` or whitespace, checking `,` first.
- New functions `Util.SplitPrioritizedDelimeter`, `Util.ParseEscapeSequences`, and `Util.EmulateTabstops`.
## Bug fixes
- `announce` command text is now filtered through chat filter
- Added an additional check that RoStrap is being used to help prevent false positives
- Fixed a bug preventing command data from being accessible
## roblox-ts npm package
Cmdr is now available as an [npm package](https://www.npmjs.com/package/rbx-cmdr) for usage in [roblox-ts](https://roblox-ts.github.io/).
+1
-1

@@ -9,3 +9,3 @@ return {

Type = "players";
Name = "Fromrom";
Name = "From";
Description = "The players to teleport";

@@ -12,0 +12,0 @@ },

@@ -0,0 +0,0 @@ local Util = require(script.Parent.Parent.Shared.Util)

@@ -71,3 +71,3 @@ -- Here be dragons

local line = Line:Clone()
line.Text = self.Cmdr.Util.EmulateTabstops(text, 4) or "nil"
line.Text = self.Cmdr.Util.EmulateTabstops(text or "nil", 8)
line.TextColor3 = color or line.TextColor3

@@ -217,3 +217,3 @@ line.Parent = Gui

if self.Cmdr.Enabled == false then
if self.Cmdr.Enabled == false or not self:IsVisible() then
if self:IsVisible() then

@@ -220,0 +220,0 @@ self:Hide()

@@ -93,3 +93,3 @@ local RunService = game:GetService("RunService")

if commandObject.AutoExec then
if commandObject.AutoExec and RunService:IsClient() then
table.insert(self.AutoExecBuffer, commandObject.AutoExec)

@@ -96,0 +96,0 @@ self:FlushAutoExecBufferDeferred()

@@ -455,3 +455,3 @@ local TextService = game:GetService("TextService")

result = result .. (char == "\t" and string.rep(" ", 4 - #result % tabWidth) or char)
result = result .. (char == "\t" and string.rep(" ", tabWidth - #result % tabWidth) or char)
end

@@ -458,0 +458,0 @@ return result

{
"name": "rbx-cmdr",
"version": "1.1.2",
"version": "1.1.3",
"description": "Cmdr is a fully extensible and type safe command console for Roblox developers.",

@@ -5,0 +5,0 @@ "main": "./Cmdr/init.lua",

+18
-17

@@ -221,18 +221,19 @@ <div align="center">

`string`, `strings`: string, array<string>
`number`, `numbers`: number, array<number>
`integer`, `integers`: number, array<number>
`boolean`, `booleans`: boolean, array<boolean>
`player`, `players`: Player, array<Player>
`team`, `teams`: Team, array<Team>
`teamPlayers`: Player, array<Player>
`command`, `commands`: string, array<string>
`userInput`, `userInputs` Enum.UserInputType | Enum.KeyCode, array<Enum.UserInputType | Enum.KeyCode>
`brickColor`, `brickColors`: BrickColor, array<BrickColor>
`teamColor`, `teamColors`: BrickColor, array<BrickColor>
`color3`, `color3s`: Color3, array<Color3>
`hexColor3`, `hexColor3s`: Color3, array<Color3>
`brickColor3`, `brickColor3s`: Color3, array<Color3>
`vector3`, `vector3s`: Vector3, array<Vector3>
`vector2`, `vector2s`: Vector2, array<Vector2>
- `string`, `strings`: `string`, `array<string>`
- `number`, `numbers`: `number`, `array<number>`
- `integer`, `integers`: `number`, `array<number>`
- `boolean`, `booleans`: `boolean`, `array<boolean>`
- `player`, `players`: `Player`, `array<Player>`
- `team`, `teams`: `Team`, `array<Team>`
- `teamPlayers`: `Player`, `array<Player>`
- `command`, `commands`: `string`, `array<string>`
- `userInput`, `userInputs`: `Enum.UserInputType | Enum.KeyCode`, `array<Enum.UserInputType | Enum.KeyCode>`
- `brickColor`, `brickColors`: `BrickColor`, `array<BrickColor>`
- `teamColor`, `teamColors`: `BrickColor`, `array<BrickColor>`
- `color3`, `color3s`: `Color3`, `array<Color3>`
- `hexColor3`, `hexColor3s`: `Color3`, `array<Color3>`
- `brickColor3`, `brickColor3s`: `Color3`, `array<Color3>`
- `vector3`, `vector3s`: `Vector3`, `array<Vector3>`
- `vector2`, `vector2s`: `Vector2`, `array<Vector2>`
- `duration`, `durations`: `number`, `array<number>`

@@ -685,2 +686,2 @@ Plural types (types that return a table) are listable, so you can provide a comma-separated list of values.

#### `Util.ParseEscapeSequences(text: string): string`
Replaces escape sequences with their fully qualified characters in a string. This only parses `\n`, `\t`, `\uXXXX`, and `\xXX` where `X` is any hexadecimal character.
Replaces escape sequences with their fully qualified characters in a string. This only parses `\n`, `\t`, `\uXXXX`, and `\xXX` where `X` is any hexadecimal character.