Heres another PR.
In my spare time I worked on something called MGVE, which is just like MQLE, but this time, it is for Global's.
#Snippet#
HTML Code:
-- ***** ** ** * *** ***** * ** ***** **
-- ****** ***** ***** * **** ****** * ***** ****** **** *
-- ** * * ***** ***** * * *** ** * * ***** ** * * ****
--* * * * ** * ** * ** *** * * ** * ** * * * **
-- * * * * * *** *** * *** * * *
-- ** ** * * ** ** ** ** ** * ** **
-- ** ** * * ** ** ** ** ** * ** **
-- ** ** * * ** ** ** ** ** * ** ******
-- ** ** * * ** ** ** ** ** * ** *****
-- ** ** * ** ** ** ** ** ** * ** **
-- * ** * ** ** ** *** ** ** ** * * **
-- * * ** ** * **** ** * * *
-- **** * ** *** *** *** * **** *
-- * ***** ** ******* ** ******* * ***********
--* ** *** ** *** * ******
--* ** *
-- ** * **
-- *
-- *
--ooooooooooooooooooooooooooooooooooooooooooooo
-- V E R S I O N :: 1 . 1_IR
-- A U T H O R :: Nocalora
--SW3EXP.Framework :: 0.6.2X
--ooooooooooooooooooooooooooooooooooooooooooooo
-- Monitored Global Variables Environment (MGVE)
-- Replaces Functions: [MGVS, getglobal]
--##### W A R N I N G /// W A R N I N G /// W A R N I N G #####
--
-- Warning: Do NOT Modify MGVE in any shape or form, only Proceed if you know what you are doing.
--
--##### W A R N I N G /// W A R N I N G /// W A R N I N G #####
--Function VarNames
-- "IDAL" = I-D Associated Link
--Amount of Total Globals existing.
__MGVE_GVAmount = 0;
--Amount of Total Global writes (MGVS -> MSGV)
__MGVE_GVWrites = 0;
--Amount of Total Global reads (getglobal -> MGGV)
__MGVE_GVReads = 0;
--Amount of Total Global deletes (Delete a Global -> MCGV)
__MGVEGVDeletes = 0;
--Allow the Real-Time OutputToScreenLOG LOG of existing MGVE Variables
__MGVE_LiveDebugMenuEnable = TRUE;
--Main Data Table containing all information about current existing MGVE for Diagnostic purposes
__MGVE_DataTable = {};
--Allow to Dump the Data in the Data Table into a AUTOGEN file
__MGVE_DumpDataTable_ExtendedLOG = TRUE;
--Allow the load of an GV Environment from a Table
__MGVE_LoadGVTableEnable = FALSE;
--Allow the Deletion of the complete MGVE Space when using the LoadGVTable Function.
__MGVE_LoadGVTableClearMGVEEnable = FALSE;
--Allow the Deletion of the complete MGVE Space when using the LoadGVFromFile Function.
__MGVE_LoadGVEnvironmentFromFileClearMGVEEnable = TRUE;
--The GV Environment Loading Table
__MGVE_LoadGVTable = {
{"Developer_Mode", "False"}
};
--Simple Settings Section
--Allow LOGging of MGVE (Recommended Value: TRUE)
--// WARNING: Only disable this if you know what you're doing
__MGVE_SGCLOG = FALSE;
-- == I N S T R U C T I O N S == --
-- __MGVE_LoadGVTable:
-- If Enabled, this table will allow you to Load Global Variables from a Table.
-- - Uses: Default-Restoration, User-Sharing of Global Variable Environments, BackUp of Important Global-Space Data, Diagnostic Utilities.
--
-- __MGVE_LiveDebugMenuEnable:
-- If Enabled, this will Show a Real-Time OutputToScreenLOG Textblock with the following variables shown:
-- "__MGVE_GVAmount, __MGVE_GVWrites, __MGVE_GVReads, __MGVE_GVDeletes".
--
-- __MGVE_DumpDataTable_ExtendedLOG:
-- If Enabled, the function "MGVE_DumpDataTable" will not only Output the MGVE in the LOG, -
-- but also in a seperate file, in the AUTOGEN folder.
--
-- == I N S T R U C T I O N S == --
--+-------------------------+
--|+ Functions + + + + + + |
--+-------------------------+
--MGVS Replacement ( MSGV(VAL1, VAL2) = MGVS(VAL1, VAL2) )
function MGVS(GlobalName, GlobalContent)
if (__MGVE_SGCLOG == TRUE) then LOG("[MSGV]WRITE: '"..tostring(GlobalName).."'='"..tostring(GlobalContent).."', MGVE_id = "..__MGVE_GVAmount); end;
setglobal(GlobalName, GlobalContent);
setglobal("__MGVE_IDAL:"..GlobalName, __MGVE_GVAmount);
setglobal("__MGVE_IDAL:"..__MGVE_GVAmount, GlobalName);
--//Diagnostics
tinsert(__MGVE_DataTable, GlobalName..":"..tostring(GlobalContent));
__MGVE_GVAmount = __MGVE_GVAmount + 1;
__MGVE_GVWrites = __MGVE_GVWrites + 1;
end;
--getglobal Replacement ( MGGV(VAL1) = getglobal(VAL1) )
function MGGV(GlobalName)
if (getglobal("__MGVE_IDAL:"..GlobalName)) then
local GetIDAL = getglobal("__MGVE_IDAL:"..GlobalName);
if (__MGVE_SGCLOG == TRUE) then LOG("[MGGV]READ: '"..tostring(GlobalName).."'='"..tostring(getglobal(GlobalName)).."', MGVE_id = "..GetIDAL); end;
else --No Idal -> \
if (__MGVE_SGCLOG == TRUE) then LOG("[MGGV]READ: '"..tostring(GlobalName).."'='"..tostring(getglobal(GlobalName)).."', MGVE_id = !!! NO IDAL LINKED !!!"); end;
end;
--//Diagnostics
__MGVE_GVReads = __MGVE_GVReads + 1;
return (getglobal(GlobalName));
end;
--ClearGlobal Replacement ( MCGV(VAL1) = ClearGlobal(VAL1) )
function MCGV(GlobalName)
if (getglobal("__MGVE_IDAL:"..GlobalName)) then
local GetIDAL = getglobal("__MGVE_IDAL:"..GlobalName);
if (__MGVE_SGCLOG == TRUE) then LOG("[MGGV]DELETE: '"..tostring(GlobalName).."'='"..getglobal(GlobalName).."', MGVE_id = "..GetIDAL); end;
setglobal(GlobalName, nil);
setglobal("__MGVE_IDAL:"..GetIDAL, nil);
setglobal("__MGVE_IDAL:"..GlobalName, nil);
--//Diagnostics
__MGVE_GVAmount = __MGVE_GVAmount - 1;
__MGVE_GVDeletes = __MGVE_GVDeletes + 1;
else --No Idal -> \
if (__MGVE_SGCLOG == TRUE) then LOG("[MGGV]DELETE: '"..tostring(GlobalName).."'='"..getglobal(GlobalName).."', MGVE_id = !!! NO IDAL LINKED !!!"); end;
setglobal(GlobalName, nil);
--//Diagnostics
__MGVE_GVAmount = __MGVE_GVAmount - 1;
__MGVE_GVDeletes = __MGVE_GVDeletes + 1;
end;
end;
--Looping function to show the MGVE Variables in Realtime
function MGVE_LiveDebugMenu()
if (__MGVE_LiveDebugMenuEnable==TRUE) then
ClearScreenLOG();
OutputToScreenLOG("[MGVE] Deletes: "..__MGVE_GVDeletes,0.318712);
OutputToScreenLOG("[MGVE] Reads: "..__MGVE_GVReads,0.318712);
OutputToScreenLOG("[MGVE] Writes: "..__MGVE_GVWrites,0.318712);
OutputToScreenLOG("[MGVE] Exist: "..__MGVE_GVAmount,0.318712);
Timer_Seq(0.318712, MGVE_LiveDebugMenu);
end;
end;
--Function to Dump the Data Table to a AUTOGEN file
function MGVE_DumpDataTable()
LOG("[MGVE] BEGIN DUMP DATA");
for Data, CurData in __MGVE_DataTable do
LOG("[MGVE] '"..CurData.."'");
end;
if (__MGVE_DumpDataTable_ExtendedLOG)==TRUE then
local game_path = GetUserFolder();
local input_filename = game_path.."Autogen/_AUTO_MGVE.lua";
SaveToFile(input_filename, __MGVE_DataTable, "MGVE_Data");
end;
LOG("[MGVE] END DUMP DATA")
end;
--Function to Toggle the Real-Time LOGging of MGVE
function MGVE_Toggle()
if (__MGVE_LiveDebugMenuEnable==TRUE) then
__MGVE_LiveDebugMenuEnable = FALSE;
elseif (__MGVE_LiveDebugMenuEnable==FALSE) then
__MGVE_LiveDebugMenuEnable = TRUE;
else
return FALSE;
end;
LOG("[MGVE] GV Live Debug Active: "..__MGVE_LiveDebugMenuEnable);
end;
--Function to Load A Stored GV inside a Table
function MGVE_LoadGVEnvironmentFromTable(xTable)
LOG("[MGVE] BEGIN LOAD FROM TABLE...");
if (xTable) then
--Delete whole GV Environment
if (__MGVE_LoadGVTableClearMGVEEnable~=FALSE) then
LOG("[MGVE]: Deleting MGVE...");
MGVE_DeleteGVEnvironment();
LOG("[MGVE]: Deleted MGVE.");
end;
LOG("[MGVE]: Accessing Table-Loader...");
local ProccessedItems = 0;
SplittedStr = {};
for Objects, CurObject in xTable do
if (type(CurObject)~="number") then
SplittedStr = strsplit(CurObject[1], ":");
MSGV(SplittedStr[1], SplittedStr[2]);
LOG("[MGVE][TABLE-LOADER]: Asserted GV: "..SplittedStr[1].." with Value: "..SplittedStr[2].." from Stored GV Table");
ProccessedItems = ProccessedItems + 1;
else
LOG("[MGVE][TABLE-LOADER]: Number Received, skipping...");
end;
end;
LOG("[MGVE][TABLE-LOADER]: Job Done. Proccessed: "..ProccessedItems.." GV-Values.");
else
return FALSE;
end;
LOG("[MGVE] END LOAD FROM TABLE");
end;
--Function to Delete the complete current Monitored Quest-Label Environment
function MGVE_DeleteGVEnvironment()
LOG("[MGVE][DELETER]: BEGIN MGVE DELETION.");
for Objects, CurObject in __MGVE_DataTable do
MCGV(CurObject);
LOG("[MGVE][DELETER]: Deleting: "..CurObject);
end;
LOG("[MGVE][DELETER]: Job Done.");
__MGVE_DataTable = {};
LOG("[MGVE][DELETER]: END MGVE DELETION.");
end;
--Function to Load the MGVE.Load File.
function MGVE_LoadGVEnvironmentFromFile()
LOG("[MGVE]: BEGIN LOAD FILE.");
--Delete whole GV Environment
if (__MGVE_LoadGVEnvironmentFromFileClearMGVEEnable~=FALSE) then
LOG("[MGVE]: Deleting MGVE...");
MGVE_DeleteGVEnvironment();
LOG("[MGVE]: Deleted MGVE.");
end;
LOG("[MGVE][FILE-LOADER]: Loading File...");
ExecuteScriptFile("DATA/Addons/@MGVE/MGVE.Load.lua");
LOG("[MGVE][FILE-LOADER]: File Loaded!...");
--Proccess Numerical Table
__MGVE_ProccessedNumericalTable = {};
SplittedStr = {};
for Objects, CurObject in __MGVE_LoadNumericalTable do
LOG(CurObject);
SplittedStr = strsplit(CurObject, ":");
--SplittedStr[2] = gsub(SplittedStr[2], "%s+", "")
--if (SplittedStr[1]) then LOG("Split 1 is something!"); end;
--if (SplittedStr[2]) then LOG("Split 2 is something!"); end;
--LOG("Split 1:"..SplittedStr[1].." Split 2:"..SplittedStr[2]);
tinsert(__MGVE_ProccessedNumericalTable, {SplittedStr[1]..":"..tostring(SplittedStr[2])});
SplittedStr = {};
end;
--Proccess END
--Reload MGVE with MGVE_DATA_TABLE
LOG("[MGVE]: Re-Loading MGVE...");
MGVE_LoadGVEnvironmentFromTable(__MGVE_ProccessedNumericalTable);
LOG("[MGVE]: MGVE Reloaded.");
LOG("[MGVE]: END LOAD FILE.");
end;
I think its pretty neat, but lets move to another thing I have worked on: The Addonloader, I decided to tweak it a bit more, and the Loader has now the capabilities to autorun functions that you can define in a table, take a peak
#Snippet#
HTML Code:
--WARNING: This embedded Autorun has a Higher load Priority than SW3 Expansion's GetFollowers() Init Hook, so if -
-- - you use this Autorun, make sure it doesn't rely on SW3EXP Functions
-- "Addon Name", "Content-Type", {Table of Functions to be Executed}
__AddonsList = {
--Addons
{"MGVE", "Addon", {"LOG4GV_Clear"}},
{"MQLE", "Addon", {"LOG4QL_Clear"}},
{"StarRover", "Addon"},
{"SW3_Expansion", "Addon"},
{"Motherships_Mod_0.27", "Addon"},
{"Fleet_Mod", "Addon"},
{"Plugins", "Addon"},
--Core Scripts
{"Data/Scripts/", "Core"}
};
This change, along with other additions I plan to take, would make it easier for say: Mod Manager's and such to come up, as I plan to make one eitherway when I finish this Mod, this change will most likely make it worth the effort I put into it, even tho its minimal
RCFF: MAJOR progress done, it will be probably done in like at most like 3 - 4 weeks, I wish I had more time to work on this mod tho, it really sucks.
But be assured that Progress is made, and the Mod is still being worked on.
ALSO: I Plan to release a Experimental Build which is basically 0.6.1.9P2H1 but with MQVE and the new Addonloader in the following weeks, to see if its stable.
Note: An Official Repo of the Script Code of the Mod will go online in the near future, might depend on how tricky its going to be to set one up.
Thanks 4 Reading!