Date: 2014/05/11 20:29:34 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
################################################################################
#
# Dynamic Command Handler Example
#
#
# An example of a command handler that accepts variable input. It doesn't
# matter what order the user puts in the arguments. It defaults the dryrun and
# verbose options to false.
#
# USAGE
#
# /cmdtest -a someValue -b anotherValue -c "Strings in quotes work too!" --dryrun --verbose
#
#
'DynamicCommandHandlerExample':
type: world
debug: false
events:
on cmdtest command:
- if !<player.has_permission[denizen.cmdtest]> queue stop
- define dryrun '<tern[<c.args.contains[--dryrun]>]:true || false>'
- define verbose '<tern[<c.args.contains[--verbose]>]:true || false>'
- if <c.args.find[-a].is[OR_MORE].than[0]> {
- define a <c.args.get[<c.args.find[-a].add[1].as_int>]>
- narrate "<&b>a<&co> <&a>%a%"
}
- if <c.args.find[-b].is[OR_MORE].than[0]> {
- define b <c.args.get[<c.args.find[-b].add[1].as_int>]>
- narrate "<&b>b<&co> <&a>%b%"
}
- if <c.args.find[-c].is[OR_MORE].than[0]> {
- define c <c.args.get[<c.args.find[-c].add[1].as_int>]>
- narrate "<&b>c<&co> <&a>%c%"
}
- narrate "<&b>dryrun<&co> <&a>%dryrun%"
- narrate "<&b>verbose<&co> <&a>%verbose%"
- determine FULFILLED
################################################################################