The API documentation is a work in progress and not automated.
It may become out of date, or change drastically.
Not all methods are listed here, as some are very niche or shouldn't really be used when making mods.
To get the latest, up-to-date documentation, read the XAML docstrings in MSL's source code.
Replaces a gameobject from the game with your own.
Example
Msl.SetObject("o_myobject",myObject)
Arguments
Type
Name
Description
String
name
The name of the gameobject to replace.
UndertaleGameObject
o
The gameobject to replace it with.
Returns
Type
Description
N/A
N/A.
Events
AddNewEvent method
Summary
Adds a new event to a gameobject.
Examples
// Example 1 : Create Event from string, with object nameMsl.AddNewEvent("o_myobject","scr_actionsLogUpdate(\"hello world\")",EventType.Create,0);// Example 2 : Other Event from file, with object nameMsl.AddNewEvent("o_anotherobject",ModFiles.GetCode("myScript.gml"),EventType.Other,24);
// Example 3 : Create Event from string, with object as a variableMsl.AddNewEvent(myVarContainingAGameObject,"scr_actionsLogUpdate(\"hello world\")",EventType.Create,0);
Arguments
Type
Name
Description
String
objectName
The name of the gameobject to add the event to.
String
eventCode
The code for the event you're adding.
Msl.EventType
eventType
The type of event to add.
uint
subtype
The subtype of the event to add. (Some events have different sub-events, like Other or Draw)
Type
Name
Description
UndertaleGameObject
gameObject
Reference to the gameobject to add the event to.
String
eventCode
The code for the event you're adding.
Msl.EventType
eventType
The type of event to add.
uint
subtype
The subtype of the event to add. (Some events have different sub-events, like Other or Draw)
Returns
Type
Description
N/A
N/A
Exception
ArgumentException thown if the event already exists.
ApplyEvent method
Injects your data into an existing table from the vanilla game.
The various fields depend on the specific method, and your IDE should let you know what it needs.
Here's a list of the available methods :
InjectTableConsumParam
InjectTableContract
InjectTableCreditsBackers
InjectTableEnemyBalance
InjectTableLocalizationUtils
InjectTablePotion
InjectTableSkillsStat
InjectTableArmor
InjectTableWeapons
Examples
// Example 1 (EnemyBalance)Msl.InjectTableEnemyBalance("Enemy1",1,"ID1",Msl.EnemyBalanceType.undead,Msl.EnemyBalanceFaction.Undead,Msl.EnemyBalancePattern.Melee,Msl.EnemyBalanceSpawnType1.Fighter,Msl.EnemyBalanceWeapon.sword,Msl.EnemyBalanceArmor.Light,Msl.EnemyBalanceMatter.bones,1);// Example 2 (SkillsStat)Msl.InjectTableSkillsStat(Msl.SkillsStatMetaGroup.BEASTS,"wild_shape","o_wild_shape",Msl.SkillsStatTarget.NoTarget,"0",30,20,0,0,0,0,false,Msl.SkillsStatPattern.normal,Msl.SkillsStatClass.spell,true,"",Msl.SkillsStatBranch.none,false,true,Msl.SkillsStatMetacategory.none,0,"",false,false,false,false,true);
Code
AddCode method
Summary
Adds a code to the game.
Example
Msl.AddCode("scr_actionsLogUpdate(\"Hello World !\")","myCode")
Inserts a string of GML into a file at a specific position.
Example
Msl.InsertGMLString("scr_actionsLogUpdate(\"Hello World !\")","gml_GlobalScript_scr_sessionDataInit",14)
Arguments
Type
Name
Description
String
codeAsString
The string of GML code to insert.
String
fileName
The name of the code to insert the GML into.
Int
position
The line below which we inject the GML code.
Returns
Type
Description
N/A
N/A
Assembly
GetAssemblyString legacy method
TODO
SetAssemblyString legacy method
TODO
InsertAssemblyString legacy method
Summary
Inserts an assembly instruction below the provided line.
Example
// Example : Inserts the instruction 'pushi.e 1' in 'gml_GlobalScript_scr_sessionDataInit' below line 14.Msl.InsertAssemblyString("pushi.e 1","gml_GlobalScript_scr_sessionDataInit",14)
Arguments
Type
Name
Description
String
codeAsString
The string of assembly instruction(s) to insert.
String
fileName
The name of the code to insert the assembly into
Int
position
The line below which we inject the assembly instruction(s)
Returns
Type
Description
N/A
N/A
ReplaceAssemblyString legacy method
Summary
Replaces the provided line with an assembly instruction given as string.
Example
// Example : Replaces the 8th line in 'gml_GlobalScript_scr_sessionDataInit' with 'pushi.e 1'.Msl.ReplaceAssemblyString("pushi.e 1","gml_GlobalScript_scr_sessionDataInit",8)
// Example : Replaces the 8th line in 'gml_GlobalScript_scr_sessionDataInit' with 'pushi.e 1' and erases the 3 lines below.Msl.ReplaceAssemblyString("pushi.e 1","gml_GlobalScript_scr_sessionDataInit",8,3)
Arguments
Type
Name
Description
String
codeAsString
The string of assembly instruction(s) to insert.
String
fileName
The name of the code to insert the assembly into.
Int
position
The line to be replaced.
Type
Name
Description
String
codeAsString
The string of assembly instruction(s) to insert.
String
fileName
The name of the code to insert the assembly into.
Int
start
The line to be replaced.
Int
len
The number of lines to be erased after the replacement.
Returns
Type
Description
N/A
N/A
InjectAssemblyInstruction legacy method
TODO
Functions / Strings / Variables
AddFunction method
Summary
Adds a function to the game.
Example
Msl.AddFunction("scr_actionsLogUpdate(\"Hello World !\")","myFunction")
Arguments
Type
Name
Description
String
codeAsString
The gml code to put in the function as a string.
String
name
The name of the function to create.
Returns
Type
Description
UndertaleCode
The code created for the function.
GetVariable method
Summary
Gets a variable from the game files.
Example
Msl.GetVariable("display_x")
Arguments
Type
Name
Description
String
name
The name of the variable to get.
Returns
Type
Description
UndertaleVariable
The variable if found.
GetString method
Summary
Gets a variable from the game files.
Example
Msl.GetString("questBreweryOdarAccept00")
Arguments
Type
Name
Description
String
name
The name of the string to get.
Returns
Type
Description
UndertaleString
The string if found.
Settings
UIComponent type
Summary
Hold data needed to create an entry in the in-game mod menu.
Example
// Example : Creates a slider that changes the value held by a global variable named menu_slider in gml.// The slider will have a range from 2 to 5, with a default value of 4.UIComponentsliderEntry=new(name:"This is a slider",associatedGlobal:"menu_slider",UIComponentType.Slider,(2,5),4)
// Example : Creates a drop down list that changes the value held by a global variable named menu_combo in gml.// The drop down list will display only two elements, Option_1 and Option_2.UIComponentcomboEntry=new(name:"This is a drop down list",associatedGlobal:"menu_combo",UIComponentType.ComboBox,newstring[]{"Option_1","Option_2",})
// Example : Creates a check box that changes the value held by a global variable named menu_check in gml.// The check box will have the value 0 if not slected, 10 else.UIComponentcheckEntry=new(name:"This is a check box",associatedGlobal:"menu_check",UIComponentType.CheckBox,10)
Arguments
Type
Name
Description
String
name
The displayed name in the menu.
String
associatedGlobal
The name of the global variable modified by this component. In the case of a slider, the global variable will hold a real value.
UIComponentType
componentType
The type of the component. Expected to be a UIComponentType.Slider.
(int, int)
sliderValues
Min and Max values for a slider, floating-point values are not supported.
int
defaultValue
Default value of the component.
bool
onlyInMainMenu
If true, this entry will only appear in the main menu of the game. False by default.
Type
Name
Description
String
name
The displayed name in the menu.
String
associatedGlobal
The name of the global variable modified by this component. In the case of a combobox, the global variable will hold a string.
UIComponentType
componentType
The type of the component. Expected to be a UIComponentType.ComboBox.
string[]
dropDownValues
List of all possible values held by the global variable.
bool
onlyInMainMenu
If true, this entry will only appear in the main menu of the game. False by default.
Type
Name
Description
String
name
The displayed name in the menu.
String
associatedGlobal
The name of the global variable modified by this component. In the case of a combobox, the global variable will hold either 0 or 1.
UIComponentType
componentType
The type of the component. Expected to be a UIComponentType.CheckBox.
int
defaultValue
Default value of the component.
bool
onlyInMainMenu
If true, this entry will only appear in the main menu of the game. False by default.
Returns
Type
Description
UIComponent
A ui component
AddMenu method
Summary
Adds entries to the in-game mod menu, which lets users configure settings at runtime.
Example
// Example : Adds a slider to the mod menu to change a value hold by a global named menu_test in gml.// The slider will have a range from 2 to 5, with a default value of 4.Msl.AddMenu("MyMod",newUIComponent(name:"The displayed name in the menu",associatedGlobal:"menu_test",UIComponentType.Slider,(2,5),4))
Arguments
Type
Name
Description
String
name
The name of the category in which to place the new entry.
UIComponent[]
components
The component(s) to add to the mod menu. Can be a CheckBox, ComboBox or Slider.
Returns
Type
Description
N/A
N/A
AddCreditDisclaimerRoom method
Summary
Adds your mod's name and authors to MSL's credits room, which is shown before the main menu.
The gameobject to show in the room. This should act as an overlay and contain all you want to display.
Returns
Type
Description
N/A
N/A
Loot
AddLootTable method
Summary
Creates a new loot table, which is a weighted list of gameobjects that can be found/dropped.
Example
// Creates a new loot table with guaranteed items and items that have various chances of dropping.// Also handles empty drops and items with rarity / durability.Msl.AddLootTable(lootTableID:"bookshelf",guaranteedItems:newItemsTable(listItems:newstring[]{"copper_candelabrum","scroll_disenchant"},listRarity:newint[]{-1,-1},listDurability:newint[]{-1,-1}),randomLootMin:1,randomLootMax:2,emptyWeight:100,randomItemsTable:newRandomItemsTable(listItems:newstring[]{"oil","bottle","thread","Joust Cape"},listRarity:newint[]{-1,-1,-1,6},listDurability:newint[]{-1,-1,-1,10},listWeight:newint[]{20,1,1,100}));
Arguments
Type
Name
Description
String
lootTableID
The name of the loot table to create.
ItemsTable
guaranteedItems
The items that are guaranteed to drop.
int
randomLootMin
The minimum amount of random items to drop.
int
randomLootMax
The maximum amount of random items to drop.
int
emptyWeight
The weight of the empty drop.
RandomItemsTable
randomItemsTable
The items that can randomly drop, if any.
Returns
Type
Description
N/A
N/A
AddReferenceTable method
Summary
Assigns a gameobject to a specific loot table.
This means that any and all instances of the gameobject will drop items from the specified loot table.
Examples
// Example 1: Assigns all `o_bandit_goon_club` instances to the `barrelsSpecial` loot table.Msl.AddReferenceTable(nameObject:"o_bandit_goon_club",table:"barrelsSpecial");// Example 2: Assigns all `o_bandit_goon_club` to the `barrelsSpecial` loot table// except the instances with ids 2334 and 2335 which are assigned to the `goon` and `goon2` tables.Msl.AddReferenceTable(nameObject:"o_bandit_goon_club",table:"barrelsSpecial",ids:newids[]{{id:2334,table:"goon"},{id:2335,table:"goon2"}});// Example 3: Assigns all `o_bandit_goon_club` to the `barrelsSpecial` loot table by default.// If a tier can be computed (such as in a donjon), it will follow the rules below:// - Tiers 1-3 will be assigned to the default table.// - Tiers 4-6 will be assigned to the `goon` table.// - Tiers 7+ will be assigned to the `goon2` table.Msl.AddReferenceTable(nameObject:"o_bandit_goon_club",table:"barrelsSpecial",tiers:newtiers[]{{tier:4,table:"goon"},{tier:7,table:"goon2"}});// Example 4: Same as above, except ids 2334 and 2335 ignore the tier rules and are assigned to `goon3` and `goon4` respectively.Msl.AddReferenceTable(nameObject:"o_bandit_goon_club",table:"barrelsSpecial",tiers:newtiers[]{{tier:4,table:"goon3"},{id:7,table:"goon4"}},ids:newids[]{{id:2334,table:"goon"},{id:2335,table:"goon2"}});
Arguments
Type
Name
Description
String
nameObject
The name of the gameobject to assign to a loot table.
String
table
The name of the loot table to assign the gameobject to.
Dict<int, string>
ids
Overrides for specific ids.
Dict<int, string>
tiers
Overrides for specific tiers.
Returns
Type
Description
N/A
N/A
AddReferenceTableForMultipleObjects method
Summary
Assigns multiple gameobjects to a loot table.
This means that any and all instances of these gameobjects will drop items from the specified loot table.
Example
// Assigns all instances of `o_bandit_goon_club` and `o_bandit_goon_cleaver` to the `barrelsSpecial` loot table.Msl.AddReferenceTableForMultipleObjects(table:"barrelsSpecial","o_bandit_goon_club","o_bandit_goon_cleaver");
Arguments
Type
Name
Description
String
table
The name of the loot table to assign the gameobjects to.
String[]
nameObjects
The names of the gameobjects to assign to the loot table.
Returns
Type
Description
N/A
N/A
Rooms
GetRoom method
Summary
Gets a room from the game files by name.
Example
Msl.GetRoom("r_myRoom")
Arguments
Type
Name
Description
String
name
The name of the room to get.
Returns
Type
Description
UndertaleRoom
The room if found.
GetRooms method
Summary
Gets a list of all the rooms in the game.
Example
Msl.GetRooms()
Returns
Type
Description
IEnumerable<UndertaleRoom>
An iterable of all the rooms in the game.
AddRoom method
Summary
Adds a room to the game.
Examples
// Example 1 : Adds a room named 'r_myRoom'Msl.AddRoom("r_myRoom")// Example 2 : Adds a room named 'r_myRoom' with a width of 5 and a height of 10Msl.AddRoom("r_myRoom",5,10)
Arguments
Type
Name
Description
String
name
The name of the room to create.
int
width
The width of the room.
int
height
The height of the room.
Returns
Type
Description
UndertaleRoom
The room created.
GetLayer method
Summary
Gets a layer from a room.
Example
// Example : Gets the tiles layer named 'myLayer' from the room 'r_myRoom'varlayer=Msl.GetRoom("r_someRoom").GetLayer(UndertaleRoom.LayerType.Tiles,"myLayer")
Arguments
Type
Name
Description
UndertaleRoom
room
The room to get the layer from.
UndertaleRoom.LayerType
type
The type of the layer to get.
String
name
The name of the layer to get.
Returns
Type
Description
UndertaleLayer
The layer found.
AddLayer method
Summary
Adds a layer to a room.
Example
// Example : Adds a layer named 'myLayer' to the room 'r_myRoom'varroom=Msl.AddRoom("r_myRoom")room.AddLayer(UndertaleRoom.LayerType.Tiles,"myLayer")
Arguments
Type
Name
Description
UndertaleRoom
room
The name of the room to add the layer to.
UndertaleRoom.LayerType
type
The name of the layer to create.
String
name
The name of the layer to create.
Returns
Type
Description
UndertaleLayer
The layer created.
AddGameObject method
Summary
Adds a gameobject to a room.
Layer and Object name can be supplied as objects or strings.
Example
// Example : Adds a gameobject named 'o_myObject' to the room 'r_myRoom'// with a creation code at position (5, 10) on the layer 'instanceLayer'varcreationCode=Msl.GetUMTCodeFromFile("someScriptFromTheGame")varroom=Msl.GetRoom("r_someRoom")room.AddGameObject(layerName:"instanceLayer",obName:"o_myObject",creationCode:creationCode,x:5,y:10)
GetGameObject method
Summary
Gets a gameobject from a room.
Example
// Example : Gets the gameobject named 'o_myObject' in the layer 'instanceLayerName' from the room 'r_myRoom'varroom=Msl.GetRoom("r_someRoom")room.GetGameObject("instanceLayerName","o_myObject")
Arguments
Type
Name
Description
String
layerName
The name of the layer to get the gameobject from.
String
obName
The name of the gameobject to get.
Returns
Type
Description
UndertaleGameObject
The gameobject found.
Patching
Stage 1 (Loading)
The 'Loading' stage is used to get the GML or assembly from the game's files.
LoadGML method
Summary
The first step to inject GML.
Loads an existing code from the game files and returns it.
The name of the code to get the assembly from in the game files.
Returns
Type
Description
FileEnumerable<string>
A class containing the assembly for the loaded code, used in Stage 2 methods.
Stage 2 (Matching)
The 'Matching' stage is used to select a line, or multiple lines that we're going to act upon in stage 3.
It is done by providing code to find in the file, or matching every line.
MatchFrom method
Summary
The second step to inject GML or Assembly.
Finds the code in the previously opened file and selects every matching line.
Signatures
This method has multiple signatures.
This documentation only covers the FileEnumerable + String signature (see Example 1).
// Example 1 : Selecting a matching String in a GML fileMsl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("if (!instance_exists(o_music_controller))")// Example 2 : Selecting the matching content of a file in a GML fileMsl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom(ModFiles,"my_matching_file.gml")// Example 3 : Selecting a matching assembly instruction String in an assembly fileMsl.LoadAssemblyAsString("gml_GlobalScript_scr_sessionDataInit").MatchFrom("pushi.e 1")
Arguments
Type
Name
Description
FileEnumerable<string>
fe
The previously opened file
String
other
The code to find and match with the file
Returns
Type
Description
FileEnumerable<(Match, string)>
A class that contains the loaded code with selected parts defined, ready for Stage 3.
MatchBelow method
Summary
The second step to inject GML or Assembly.
Finds the passed string/file in the previously opened file and selects the N lines below the matching part.
Signatures
This method has multiple signatures.
This documentation only covers the FileEnumerable + String signature (see Example 1).
// Example 1 : Selecting 1 line below a matching String in a GML fileMsl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchBelow("if (!instance_exists(o_music_controller))",1)// Example 2 : Selecting the 4 lines below a matching file in a GML fileMsl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchBelow(ModFiles,"my_matching_file.gml",4)// Example 3 : Selecting 1 line below a matching assembly instruction String in an assembly fileMsl.LoadAssemblyAsString("gml_GlobalScript_scr_sessionDataInit").MatchBelow("pushi.e 1",1)
Arguments
Type
Name
Description
FileEnumerable<string>
fe
The previously opened file
String
other
The code to match with the file
Int
len
The amount of lines below the match to select.
Returns
Type
Description
FileEnumerable<(Match, string)>
A class that contains the loaded code with selected parts defined, ready for Stage 3.
MatchAll method
Summary
The second step to inject GML or Assembly.
Selects all lines in the previously opened file.
Signatures
This method has multiple signatures.
This documentation only covers the FileEnumerable signature.
// Example 1 : Selecting all lines from the line containing "scr_locationPositionInit()" until the line containing "if (!instance_exists(o_music_controller))".Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFromUntil("scr_locationPositionInit()","if (!instance_exists(o_music_controller))")// Example 2 : Selecting all lines from the line contained in "firstMatchingLine.gml" until the line contained in "otherMatchingLine.gml".Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom(ModFiles,"firstMatchingLine.gml","otherMatchingLine.gml")
Arguments
Type
Name
Description
FileEnumerable<string>
fe
The previously opened file.
String
otherfrom
The beginning of the code to match
String
otheruntil
The end of the code to match
Returns
Type
Description
FileEnumerable<(Match, string)>
A class that contains the loaded code with selected parts defined, ready for Stage 3.
Stage 3 (Acting)
The 'Acting' stage is used to perform an action on the selected lines.
This can be inserting, replacing, deleting or others, which lead to modification of the original file.
Remove method
Summary
The third step to inject GML / assembly.
Removes previously selected lines from opened file.
Example
// Example 1 : Remove all lines from script gml_GlobalScript_scr_sessionDataInitMsl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchAll().Remove()// Example 2 : Remove the `pushi.e 1` instruction from gml_Object_c_bed_sleep_crafted_Alarm_0's assemblyMsl.LoadAssemblyString("gml_Object_c_bed_sleep_crafted_Alarm_0").MatchFrom("pushi.e 1").Remove()
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
Returns
Type
Description
FileEnumerable<string>
The file with the result of the action.
KeepOnly method
Summary
The third step to inject GML / assembly.
Removes all non-selected lines from opened file.
Example
// Example 1 : Remove all lines from script gml_GlobalScript_scr_sessionDataInit except the line where 'global.HP = -1' appears.Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").KeepOnly()// Example 2 : Remove all instructions from gml_Object_c_bed_sleep_crafted_Alarm_0's assembly except `pushi.e 1`Msl.LoadAssemblyString("gml_Object_c_bed_sleep_crafted_Alarm_0").MatchFrom("pushi.e 1").KeepOnly()
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
Returns
Type
Description
FileEnumerable<string>
The file with the result of the action.
InsertAbove method
Summary
The third step to inject GML / assembly.
Inserts a string/file content above the selected line.
Example
// Example 1 : Adds 'global.myVar = 14' above the line containing 'global.HP = -1'Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").InsertAbove("global.myVar = 14")// Example 2 : Adds the content of my_gml_code.gml above the line containing 'global.HP = -1Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").InsertAbove(ModFiles,"my_gml_code.gml")// Example 3 : Adds the instruction 'popz.v' above the line containing the instruction 'pushi.e 1'Msl.LoadAssemblyString("gml_Object_c_bed_sleep_crafted_Alarm_0").MatchFrom("pushi.e 1").InsertAbove("popz.v")
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
'String'
inserting
The code to insert above the selected line.
Returns
Type
Description
FileEnumerable<string>
The file with the result of the action.
InsertBelow method
Summary
The third step to inject GML / assembly.
Inserts a string/file content below the selected line.
Example
// Example 1 : Adds 'global.myVar = 14' below the line containing 'global.HP = -1'Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").InsertBelow("global.myVar = 14")// Example 2 : Adds the content of my_gml_code.gml below the line containing 'global.HP = -1Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").InsertBelow(ModFiles,"my_gml_code.gml")// Example 3 : Adds the instruction 'popz.v' below the line containing the instruction 'pushi.e 1'Msl.LoadAssemblyString("gml_Object_c_bed_sleep_crafted_Alarm_0").MatchFrom("pushi.e 1").InsertBelow("popz.v")
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
'String'
inserting
The code to insert below the selected line.
Returns
Type
Description
FileEnumerable<string>
The file with the result of the action.
ReplaceBy method
Summary
The third step to inject GML / assembly.
Replaces the selected line with a string/file content.
Example
// Example 1 : Replaces the line containing 'global.HP = -1' with 'global.HP = 50'Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").ReplaceBy("global.HP = 50")// Example 2 : Replaces the line containing 'global.HP = -1 with the content of 'my_gml_code.gml'Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").ReplaceBy(ModFiles,"my_gml_code.gml")// Example 3 : Replaces the line containing the instruction 'pushi.e 1' with the instruction 'popz.v'Msl.LoadAssemblyString("gml_Object_c_bed_sleep_crafted_Alarm_0").MatchFrom("pushi.e 1").ReplaceBy("popz.v")
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
'String'
inserting
The code to replace the selected line with.
Returns
Type
Description
FileEnumerable<string>
The file with the result of the action.
FilterMatch method
Summary
The third step to inject GML / assembly.
TODO
Example
TODO
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
Returns
Type
Description
FileEnumerable<string>
The file with the result of the action.
Stage 4 (Saving)
The 'Saving' stage saves the patched difference into the original file.
Failing to add this at the end of your chain of calls will render it useless.
Save method
Summary
The final step to inject GML / assembly.
Saves the modified content to the original file.
Example
// Example : Loads a script, selects the line containing 'global.HP = -1', replaces it with 'global.HP = 50' and saves it.Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").MatchFrom("global.HP = -1").ReplaceBy("global.HP = 50").Save()
Arguments
Type
Name
Description
FileEnumerable<(Match, string)>
fe
The previously opened file.
Returns
Type
Description
ModSummary
The file with the result of the action.
Utility
Utility functions can be called at any time and don't impact the file in any way.
They are mostly used to print information or debug.
Peek method
Summary
Can be used at any stage before saving to print a log in MSL's console containing the current state of the file.
This method doesn't modify the input at all, simply prints it and passes it forward to the next method.
It can also be used multiple times in a single chain of calls.
Example
// Example : Prints the state of the file before and after replacing.Msl.LoadGML("gml_GlobalScript_scr_sessionDataInit").Peek().MatchFrom("global.HP = -1").ReplaceBy("global.HP = 50").Peek().Save()
Arguments
Type
Name
Description
FileEnumerable<T>
fe
The previously opened file.
Returns
Type
Description
FileEnumerable<T>
The file, exactly as it was when passed as an argument.