Tip for mod authors:
Use the following code to get the folder that your mod is in: (to support mod folder renaming. Path is relative to Game.exe. e.g: For CMF it returns
Replace
Note:
P.S:
Proof of concept:
Use the following code to get the folder that your mod is in: (to support mod folder renaming. Path is relative to Game.exe. e.g: For CMF it returns
ModScripts/_Mods/Cheats Mod
with the default mod folder name)
Code:
$test_ScriptPath = "#{File.dirname(__FILE__)}"
$test_ScriptPath
without whatever variable you would actually be using.Note:
This is used in the WIP v1.0rc7 update to Cheat Menu Framework as part of the change to the soft-dependency on UMM instead a hard-dependency.
P.S:
Make sure this is only in the initial script for the mod as it will return a different path for scripts in a subfolder. E.g: In CMF, if this was in
<Cheats Mod>/scripts/Utils.rb
the path returned would be ModScripts/_Mods/Cheats Mod/scripts
This is because it returns the path to the current script.
Proof of concept:
Extract the attached zipped script to any folder that is imported via a script loader, run the game, open the F10 console and type:
prp $test_ScriptPath
List of folders where scripts are loaded from:
- via the Loader script in Scripts.rvdata2:
- Data/Scripts/
- via FileGetter:
- Data/Scripts/Editables/
- Data/Scripts/Frames/
- Data/Scripts/Frames/*/
- ModScripts/
- via ModLoader:
- ModScripts/_Mods/*/
- [If installed] via Cheat Menu Framework:
- ModScripts/_Mods/Cheats Mod/addons/
- ModScripts/_Mods/Cheats Mod/scripts/lib/
- ModScripts/_Mods/Cheats Mod/othermods/
Last edited: