-
Notifications
You must be signed in to change notification settings - Fork 2
/
MSR_GRP02.lua
131 lines (104 loc) · 4.09 KB
/
MSR_GRP02.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
119
120
121
122
123
124
125
126
127
128
129
130
131
-- MORE SCRIPTS TO REPLACE (MSR) II - GROUP 2
-- AUTHOR : ALTAMURENZA
main = function()
---------------------
-- # THE KEY OF MSR #
---------------------
main = nil
------------------------------
-- # RE-DEFINE IMPORT SCRIPT #
------------------------------
_G.ImportScript = function(FILE)
-- # QUALIFY THE CRITERIA #
if string.find(FILE, 'Library/', 1) or string.find(FILE, '\Library', 1) or string.find(FILE, 'Test/', 1) or string.find(FILE, '\Test', 1) then
-- # WAIT FOR STREAM #
while IsStreamingBusy() do
Wait(0)
end
-- # IMPORT FROM IMG ARCHIVE #
ImportScript(FILE)
else
-- # CALL THE FILE #
local SCRIPT, MESSAGE = loadfile(shared.gMoreScriptsToReplace.Path..'/GROUP_02_STC/MOD_'..(_G.FILE_LOAD_ORDER or '?')..'_IMPORT/'..FILE)
-- # EXECUTE LOADED FILE #
if SCRIPT then
SCRIPT()
else
-- # PRINT ERROR #
_G[shared.gMoreScriptsToReplace.Game == 'SE' and 'TextPrintString' or 'MinigameSetAnnouncement'](
shared.gMoreScriptsToReplace.Game == 'SE' and "'/GROUP_02_STC/MOD_"..(_G.FILE_LOAD_ORDER or '?')..".lur' is requiring '/GROUP_02_STC/MOD_"..(_G.FILE_LOAD_ORDER or '?').."_IMPORT/"..FILE.."' in order to work!" or FILE..' is required!',
shared.gMoreScriptsToReplace.Game == 'SE' and 10 or true,
shared.gMoreScriptsToReplace.Game == 'SE' and 2 or nil
)
end
-- # REMOVE LOADED FILE FROM THE MEMORY #
collectgarbage()
end
end
---------------------------
-- # CALL, INIT, & LAUNCH #
---------------------------
for ORDER = 1, 5 do
-- # SET GLOBAL #
_G.FILE_LOAD_ORDER = ORDER
-- # LOAD #
local SCRIPT, MESSAGE = loadfile(shared.gMoreScriptsToReplace.Path..'/GROUP_02_STC/MOD_'..ORDER..'.lur')
if SCRIPT then
SCRIPT()
-- # SWAP, ADD, & EXECUTE #
if type(main) == 'function' then
_G['GROUP_02_MAIN_0'..ORDER..'_DAT'] = {[1] = main, [2] = false}; main = nil
_G['GROUP_02_MAIN_0'..ORDER..'_MOD'] = function()
-- # FIND CURRENT SEQUENCE #
local CURRENT_SEQ = 0
for ORDER = 1, 5 do
if type(_G['GROUP_02_MAIN_0'..ORDER..'_DAT']) == 'table' and _G['GROUP_02_MAIN_0'..ORDER..'_DAT'][2] == false then
CURRENT_SEQ = ORDER
break
end
end
-- # RE-DEFINE IMPORT SCRIPT IN CURRENT THREAD #
_G.ImportScript = function(FILE)
-- # QUALIFY THE CRITERIA #
if string.find(FILE, 'Library/', 1) or string.find(FILE, '\Library', 1) or string.find(FILE, 'Test/', 1) or string.find(FILE, '\Test', 1) then
-- # WAIT FOR STREAM #
while IsStreamingBusy() do
Wait(0)
end
-- # IMPORT FROM IMG ARCHIVE #
ImportScript(FILE)
else
-- # CALL THE FILE #
local SCRIPT, MESSAGE = loadfile(shared.gMoreScriptsToReplace.Path..'/GROUP_02_STC/MOD_'..CURRENT_SEQ..'_IMPORT/'..FILE)
-- # CHECK THE LOADED FILE #
if SCRIPT then
SCRIPT()
else
-- # PRINT ERROR #
_G[shared.gMoreScriptsToReplace.Game == 'SE' and 'TextPrintString' or 'MinigameSetAnnouncement'](
shared.gMoreScriptsToReplace.Game == 'SE' and "'/GROUP_02_STC/MOD_"..CURRENT_SEQ..".lur' is requiring '/GROUP_02_STC/MOD_"..CURRENT_SEQ.."_IMPORT/"..FILE.."' in order to work!" or FILE..' is required!',
shared.gMoreScriptsToReplace.Game == 'SE' and 10 or true,
shared.gMoreScriptsToReplace.Game == 'SE' and 2 or nil
)
end
-- # REMOVE LOADED FILE FROM THE MEMORY #
collectgarbage()
end
end
-- # ENABLE THE FLAG & EXECUTE MAIN #
_G['GROUP_02_MAIN_0'..CURRENT_SEQ..'_DAT'][2] = true
_G['GROUP_02_MAIN_0'..CURRENT_SEQ..'_DAT'][1]()
end
-- # MULTITHREADING #
shared.gMoreScriptsToReplace.G02[ORDER] = CreateThread('GROUP_02_MAIN_0'..ORDER..'_MOD')
end
end
-- # REMOVE LOADED FILE FROM THE MEMORY #
collectgarbage()
end
---------------
-- # CLEAN UP #
---------------
_G.ImportScript, _G.FILE_LOAD_ORDER = nil, nil
collectgarbage()
end