Community Forum

Get current Map filename

Forum Overview >> Farming Simulator 2011

CategoryFarming Simulator 2011
Created06.04.2011 22:43


Heady Planet-ls (Headshot XXL) 06.04.2011 22:49
Hello,

how can get the filename / path of the current (mod) map?

my script is a extrasourcefile from a mod.

Heady Planet-ls (Headshot XXL) 07.04.2011 21:22
i have found a solution:

function EventListener:loadMap(name)

local pathToModMap, n = string.gsub(name, "/map01.i3d", "");
print("pathToModMap ", pathToModMap)

end;

Stefan Geiger - GIANTS Software 24.06.2011 09:15
There are two variables:

g_currentModDirectory and g_currentModName. Containing the path to the mod and the name of the mod.
Eg. "C:/...My Games/FarmingSimulator2011/mods/TestMod" and "TestMod".

These variables are only valid during the initialization of the mod. So you should not use them within some functions.

However you can store the contents of these values at the beginning of the lua and then use these:

local modName = g_currentModName;
local modDir = g_currentModDirectory;

function myFunction()
print("the dir: "..modDir);
end;


Note: Log in to post. Create a new account here.