Date: 2016/08/29 04:57:31 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#---------------------------------------------+
#Created 29.08.16 - 29.08.16 |
#Script-Help by BloodEko |
# |
#Easy way to add a help command for dScripts |
# |
#Permission: scripthelp.use |
# Access to the /shelp command |
# |
#---------------------------------------------+
# Usage: /shelp |
#---------------------------------------------+
# Just create a yaml data/version script, |
# like the example script to hook it. |
# Note: |
# The name of the script must look like |
# shelp_<replace-with-your-name> |
#---------------------------------------------+
#Use only 'type: version' for repo-scripts |
#for proper use with the |
#'/denizen scriptversions' command |
#For all other/custom scripts use |
#'type: yaml data' like shown below. |
#---------------------------------------------+
shelp_examplescript_for_reposcripts:
type: version
author: BloodEko
name: Script Help
usage: /shelp syntax
version: 0.1
id: 105
link: http://old.mcmonkey.org/denizen/repo/entry/105
#ID is not needed here
#shelp_examplescript_for_customscripts:
# type: yaml data
# author: BloodEko
# name: Script Help
# usage: /shelp syntax
# version: 0.1
# link: https://www.google.com/
#
#--------------------------------------------+
# |
# Internal Scripts |
# |
#--------------------------------------------+
sh_command_handler:
type: command
name: shelp
usage: /shelp | author|version|link|usage <<>page<>>
description: Shows informations about hooked scripts
permission: scripthelp.use
permission message: You don't have the permission for using this command.
script:
#
# /shelp
#
- if <context.args.size> == 0 {
- define scripts_amount "<server.list_scripts.filter[starts_with[s@shelp_]].size||0>"
- if <def[scripts_amount]> < 1 { - narrate "no scripts found" - queue clear }
#
- if <def[scripts_amount]> <= 10 {
- narrate "-----[<&6>Scripts page <&f>1/1 ]-----"
}
else {
- define pages_amount "<def[scripts_amount].div[10].round_up>"
- narrate "-----[<&6>Scripts page <&f>1/<def[pages_amount]> ]-----"
}
- foreach <server.list_scripts.filter[starts_with[s@shelp_]].get[1].to[10]> {
- narrate " <&a><def[value].yaml_key[name]||unkown> <&f>- <&7><def[value].yaml_key[usage]||unkown>"
}
}
#
# /shelp author|version|link
#
else if <context.args.size> == 1 {
- define scripts_amount "<server.list_scripts.filter[starts_with[s@shelp_]].size||0>"
- if <def[scripts_amount]> < 1 { - narrate "no scripts found" - queue clear }
- if !<li@author|version|link|usage.contains[<context.args.get[1]>]> {
- inject locally sh_false_syntax
- queue clear
}
#
- if <def[scripts_amount]> <= 10 {
- narrate "-----[<&6>Scripts page <&f>1/1 ]-----"
}
else {
- define pages_amount "<def[scripts_amount].div[10].round_up>"
- narrate "-----[<&6>Scripts page <&f>1/<def[pages_amount]> ]-----"
}
- foreach <server.list_scripts.filter[starts_with[s@shelp_]].get[1].to[10]> {
- narrate " <&a><def[value].yaml_key[name]||unkown> <&f>- <&7><def[value].yaml_key[<context.args.get[1]>]||unkown>"
}
}
else if <context.args.size> == 2 {
- define scripts_amount "<server.list_scripts.filter[starts_with[s@shelp_]].size||0>"
- if <def[scripts_amount]> < 1 { - narrate "no scripts found" - queue clear }
- if !<li@author|version|link|usage.contains[<context.args.get[1]>]> {
- inject locally sh_false_syntax
- queue clear
}
- if <context.args.get[2]> !matches number {
- narrate "<&4>ERROR <&6><context.args.get[2]> <&4>is no valid number."
- queue clear
}
- define pages_amount "<def[scripts_amount].div[10].round_up>"
- define page "<context.args.get[2].as_int>"
- if <def[pages_amount]> < <context.args.get[2]> {
- narrate "<&6>There are only <&f><def[pages_amount]> <&6>pages. Showing page <&f>1 <&6>instead."
- define page "1"
}
#
- if <def[scripts_amount]> <= 10 {
- narrate "-----[<&6>Scripts page <&f>1/1 ]-----"
}
else {
- narrate "-----[<&6>Scripts page <&f><def[page]>/<def[pages_amount]> ]-----"
}
- define page_from "<el@val[1].add[<el@val[<def[page]>].sub[1].mul[10]>]>"
- define page_to "<def[page].mul[10]>"
- foreach <server.list_scripts.filter[starts_with[s@shelp_]].get[<def[page_from]>].to[<def[page_to]>]> {
- narrate " <&a><def[value].yaml_key[name]||unkown> <&f>- <&7><def[value].yaml_key[<context.args.get[1]>]||unkown>"
}
}
else {
- inject locally sh_false_syntax
}
sh_false_syntax:
- narrate "<&7>Command Syntax"
- narrate "<&7>[1] <&f>/shelp"
- narrate "<&7>[2] <&f>/shelp author | version | link | usage"
- narrate "<&7>[3] <&f>/shelp author | version | link | usage <<><&7>page<&f><>>"