forked from TES3MP/CoreScripts
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadvancedExample.lua
More file actions
107 lines (103 loc) · 4.41 KB
/
advancedExample.lua
File metadata and controls
107 lines (103 loc) · 4.41 KB
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
Menus["advanced example origin"] = {
text = {
color.Orange .. "Welcome, " .. color.Yellow,
menuHelper.variables.currentPlayerVariable("data.login.name"),
color.Orange .. "! This is an example of an advanced menu. Use it as a starting point for your own.\n\n" ..
color.White .. "Select what kind of functions you want to run."
},
buttons = {
{ caption = "Player functions",
destinations = { menuHelper.destinations.setDefault("advanced example player") }
},
{ caption = "World instance functions",
destinations = { menuHelper.destinations.setDefault("advanced example world") }
},
{ caption = "logicHandler functions",
destinations = { menuHelper.destinations.setDefault("advanced example logichandler") }
},
{ caption = "Global functions",
destinations = { menuHelper.destinations.setDefault("advanced example global") }
},
{ caption = "Exit", destinations = nil }
}
}
Menus["advanced example player"] = {
text = color.Orange .. "Select a function to run on this player.",
buttons = {
{ caption = "Save()",
destinations = {
menuHelper.destinations.setDefault(nil,
{
menuHelper.effects.runPlayerFunction("Save")
})
}
},
{ caption = "Message(\"This is a test\n\")",
destinations = {
menuHelper.destinations.setDefault(nil,
{
menuHelper.effects.runPlayerFunction("Message", {"This is a test\n"})
})
}
},
{ caption = "Back", destinations = { menuHelper.destinations.setFromCustomVariable("previousCustomMenu") } },
{ caption = "Exit", destinations = nil }
}
}
Menus["advanced example world"] = {
text = {
color.Orange .. "The world time is set to year " .. color.Yellow,
menuHelper.variables.globalVariable("WorldInstance", "data.time.year"),
color.Orange .. ", month " .. color.Yellow,
menuHelper.variables.globalVariable("WorldInstance", "data.time.month"),
color.Orange .. " and day " .. color.Yellow,
menuHelper.variables.globalVariable("WorldInstance", "data.time.day"),
color.Orange .. ". Select a function to run on this world."
},
buttons = {
{ caption = "IncrementDay() and LoadTime(nil, true)",
destinations = {
menuHelper.destinations.setDefault(nil,
{
menuHelper.effects.runGlobalFunction("WorldInstance", "IncrementDay"),
menuHelper.effects.runGlobalFunction("WorldInstance", "LoadTime",
{menuHelper.variables.currentPid(), true})
})
}
},
{ caption = "Back", destinations = { menuHelper.destinations.setFromCustomVariable("previousCustomMenu") } },
{ caption = "Exit", destinations = nil }
}
}
Menus["advanced example logichandler"] = {
text = color.Orange .. "Select a function to run on the logicHandler.",
buttons = {
{ caption = "CreateObjectAtPlayer(menuHelper.variables.currentPid(), \"rat\", \"spawn\")",
destinations = {
menuHelper.destinations.setDefault(nil,
{
menuHelper.effects.runGlobalFunction("logicHandler", "CreateObjectAtPlayer",
{menuHelper.variables.currentPid(), "rat", "spawn"})
})
}
},
{ caption = "Back", destinations = { menuHelper.destinations.setFromCustomVariable("previousCustomMenu") } },
{ caption = "Exit", destinations = nil }
}
}
Menus["advanced example global"] = {
text = color.Orange .. "Select a global function to run.",
buttons = {
{ caption = "OnPlayerSendMessage(menuHelper.variables.currentPid(), \"This is a test chat message\")",
destinations = {
menuHelper.destinations.setDefault(nil,
{
menuHelper.effects.runGlobalFunction(nil, "OnPlayerSendMessage",
{menuHelper.variables.currentPid(), "This is a test chat message"})
})
}
},
{ caption = "Back", destinations = { menuHelper.destinations.setFromCustomVariable("previousCustomMenu") } },
{ caption = "Exit", destinations = nil }
}
}