Skip to content

Commit

Permalink
define command meta enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 9, 2022
1 parent 0612234 commit 7deaf42
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Expand Up @@ -42,7 +42,7 @@ public FlagCommand() {
// For non-persistent temporary memory, see instead <@link command define>.
// For more generic memory options, see <@link command yaml> or <@link command sql>.
//
// Flags can be sub-mapped with the '.' key, meaning a flag named 'x.y.z' is actually a flag 'x' as a MapTag with key 'y' as a MapTag with key 'z' as the final flag value.
// Flags can be sub-mapped with the '.' character, meaning a flag named 'x.y.z' is actually a flag 'x' as a MapTag with key 'y' as a MapTag with key 'z' as the final flag value.
// In other words, "<server.flag[a.b.c]>" is equivalent to "<server.flag[a].get[b].get[c]>"
//
// Server flags can be set by specifying 'server' as the object, essentially a global flag target, that will store data in the file "plugins/Denizen/server_flags.dat"
Expand Down
Expand Up @@ -14,9 +14,6 @@
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
import com.denizenscript.denizencore.scripts.queues.ScriptQueue;

/**
* Creates a queue/script-level variable.
*/
public class DefineCommand extends AbstractCommand {

public DefineCommand() {
Expand Down Expand Up @@ -47,38 +44,48 @@ public DefineCommand() {
//
// This command supports data actions, see <@link language data actions>.
//
// Definitions can be sub-mapped with the '.' character, meaning a def named 'x.y.z' is actually a def 'x' as a MapTag with key 'y' as a MapTag with key 'z' as the final defined value.
// In other words, "<[a.b.c]>" is equivalent to "<[a].get[b].get[c]>"
//
// @Tags
// <[<id>]> to get the value assigned to an ID
// <QueueTag.definition[<definition>]>
// <QueueTag.definitions>
//
// @Usage
// Use to make complex tags look less complex, and scripts more readable.
// - narrate 'You invoke your power of notice...'
// - narrate "You invoke your power of notice..."
// - define range <player.flag[range_level].mul[3]>
// - define blocks <player.flag[noticeable_blocks]>
// - narrate '[NOTICE] You have noticed <player.location.find_blocks[<[blocks]>].within[<[range]>].size> blocks in the area that may be of interest.'
// - define count <player.location.find_blocks[<[blocks]>].within[<[range]>].size>
// - narrate "<&[base]>[NOTICE] You have noticed <[count].custom_color[emphasis]> blocks in the area that may be of interest."
//
// @Usage
// Use to validate a player input to a command script, and then output the found player's name.
// - define target <server.match_player[<context.args.get[1]>]||null>
// - if <[target]> == null:
// - narrate '<red>Unknown player target.'
// - narrate "<red>Unknown player target."
// - stop
// - narrate 'You targeted <[target].name>!'
// - narrate "You targeted <[target].name>!"
//
// @Usage
// Use to keep the value of a replaceable tag that you might use many times within a single script.
// Use to keep the value of a tag that you might use many times within a single script.
// - define arg1 <context.args.get[1]>
// - if <[arg1]> == hello:
// - narrate 'Hello!'
// - narrate Hello!
// - else if <[arg1]> == goodbye:
// - narrate 'Goodbye!'
// - narrate Goodbye!
//
// @Usage
// Use to remove a definition.
// - define myDef:!
//
// @Usage
// Use to make a MapTag definition and set the value of a key inside.
// - define myroot.mykey MyValue
// - define myroot.myotherkey MyOtherValue
// - narrate "The main value is <[myroot.mykey]>, and the map's available key set is <[myroot].keys>"
//
// -->

public static class DefinitionActionProvider extends ActionableDataProvider {
Expand Down
Expand Up @@ -18,6 +18,7 @@ public DefinitionTagBase() {
// Returns a definition from the current queue.
// The object will be returned as the most-valid type based on the input.
// In most usages, the tag name is left blank, like "<[defhere]>".
// You can use "." in a definition name to read a submapped key if the root definition is a MapTag.
// @example
// - define x 3
// # Narrates '3'
Expand Down

0 comments on commit 7deaf42

Please sign in to comment.