In-LUA file navigation

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Jaspo
Command Sergeant Major
Command Sergeant Major
Posts: 282
Joined: Sun Mar 01, 2009 4:34 am
Projects :: AotC DoW+++Boonta Eve Classic
Games I'm Playing :: WoT MBWBVC Robocraft
xbox live or psn: No gamertag set
Contact:

In-LUA file navigation

Post by Jaspo »

Ok, so we're all familiar with the line found in the Mission scripts that goes like so:

ReadDataFile("dc:HFV\\HFV.lvl", "HFV_conquest")

but I'm wondering, how would you change this to get it to reference the script in a different folder in the addon folder? Such as loading
MJE\\MJE.lvl, "MJE_conquest" from this script? It's possible to load the stock missions from an addon script in this manner; that's how I made the lazer tag mod. That of course is achieved by removing the "dc:" part. But how would you navigate backward to the addon folder and then forward to the desired mod map folder within addon, using LUA code?

...I think I've already tried /, //, ..\, *\, **\, and none of those work for backward file navigation)

calling all LUA programmers...
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: In-LUA file navigation

Post by Maveritchell »

http://www.gametoast.com/forums/viewtop ... 74&t=18253

That's not directly a tutorial for what you're referring to, but I mention it a couple times in there:

Code: Select all

ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\dtshell.lvl")
You were on the right track, but directories have to be separated by the double backslash and not just a single. Moving up a directory is "..".
Jaspo
Command Sergeant Major
Command Sergeant Major
Posts: 282
Joined: Sun Mar 01, 2009 4:34 am
Projects :: AotC DoW+++Boonta Eve Classic
Games I'm Playing :: WoT MBWBVC Robocraft
xbox live or psn: No gamertag set
Contact:

Re: In-LUA file navigation

Post by Jaspo »

ah, ok, so you just skip the dc: altogether. Brilliant! Thanks a lot!
Post Reply