-
Notifications
You must be signed in to change notification settings - Fork 0
/
notecard 2.0.lua
118 lines (100 loc) · 3.45 KB
/
notecard 2.0.lua
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
--local commander = "9d42ad"
local commander = "878b50"
function onLoad()
local data = {
click_function = "parse",
function_owner = self,
label = "Parse",
position = {-0.39, 2.4, -0.43},
rotation = {0, 180, 0},
scale = {0.1, 1, 0.18},
width = 1100,
height = 400,
font_size = 400,
color = {0.1341, 0.1341, 0.1341, 1},
font_color = {1, 1, 1, 1}
}
self.createButton(data)
end
--/|2|r50-68|12|6|2d6+4
function parse()
if self.getDescription() ~= "" and self.getName() ~= "" then
local vars = JSON.decode(self.getDescription())
local npc_commander = getObjectFromGUID(commander)
if vars.name then
npc_commander.call("setName", {input = vars.name})
end
if vars.ini then
npc_commander.call("setINI", {input = vars.ini})
end
if vars.hp then
npc_commander.call("setHP", {input = vars.hp})
end
if vars.ac then
npc_commander.call("setAC", {input = vars.ac})
end
if vars.mov then
npc_commander.call("setMovement", {input = vars.mov})
end
if vars.size then
npc_commander.call("setSize", {input = vars.size})
end
if vars.image then
npc_commander.setDescription(vars.image)
npc_commander.call("toggleIsBoss", {input = true})
else
npc_commander.call("toggleIsBoss", {input = false})
end
if vars.side then
npc_commander.call("setSide", {input = vars.side})
else
npc_commander.call("setSide", {input = "enemy"})
end
if self.getGMNotes() ~= "" then
-- this means i have multiple that i want to make
local number = tonumber(self.getGMNotes())
npc_commander.call("setNumberToCreate", {input = number})
else
npc_commander.call("setNumberToCreate", {input = 1})
end
-- local stuff = mysplit(mysplit(self.getDescription(), "\n")[1], "|")
-- local npc_commander = getObjectFromGUID(commander)
-- npc_commander.call("setName", {input = stuff[1]})
-- npc_commander.call("setINI", {input = stuff[2]})
-- npc_commander.call("setHP", {input = stuff[3]})
-- npc_commander.call("setAC", {input = stuff[4]})
-- npc_commander.call("setATK", {input = stuff[5]})
-- npc_commander.call("setDMG", {input = stuff[6]})
-- if stuff[7] then
-- npc_commander.call("setMovement", {input = stuff[7]})
-- end
-- if stuff[8] then
-- npc_commander.call("setSize", {input = stuff[8]})
-- end
-- local second_line = mysplit(self.getDescription(), "\n")[2]
-- if second_line ~= nil and second_line ~= "" then
-- -- this means it is a boss
-- npc_commander.setDescription(second_line)
-- npc_commander.call("toggleIsBoss", {input = true})
-- else
-- npc_commander.call("toggleIsBoss", {input = false})
-- end
-- if self.getGMNotes() ~= "" then
-- -- this means i have multiple that i want to make
-- local number = tonumber(self.getGMNotes())
-- npc_commander.call("setNumberToCreate", {input = number})
-- end
end
end
function mysplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t = {}
i = 1
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
t[i] = str
i = i + 1
end
return t
end