Looking for definition of a function
Soul_Rider
Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
in Modding
Hey all,
Can anyone tell me where Shared.GetMatchingFileNames() is defined? I can't find it in the ns2 lua or the core lua files. By my reckoning, this has a fixed path definition to the ns2 directory. If it is not possible to amend that, would it work for me to create a new function which points to my mod folder in the players appdata folder and not use the pre-defined file?
I am looking specifically at adjusting the loading file to pick up my custom loading screens when running the mod from workshop.
Can anyone tell me where Shared.GetMatchingFileNames() is defined? I can't find it in the ns2 lua or the core lua files. By my reckoning, this has a fixed path definition to the ns2 directory. If it is not possible to amend that, would it work for me to create a new function which points to my mod folder in the players appdata folder and not use the pre-defined file?
I am looking specifically at adjusting the loading file to pick up my custom loading screens when running the mod from workshop.
Comments
I think. Look in Loadng.lua
Maybe it's set in the API? I'll check that out.
Here's the API entry, what does recursive mean in this context?
Now I dont know what each argument in your post is, but I am going to assume it is something like: stringPathWihoutFilename, boolRecursive and tableFilenamesToSearchFor
So if you specify the file path "file/path/", recursive true and filenames {"apa.bepa", "foo.bar"} then files in "file/path/[foo.bar||apa.bepa]" or "file/path/subfolder_0/[...]/subfolder_n/[foo.bar||aba.bepa]" will match the search, but not any files "file/[foo.bar||apa.bepa]".
With recursive false, only "file/path/[foo.bar||apa.bepa]" matches the search.
EDIT:
Reading the arguments samus suggests (although its one more), I would instead assume that the function only searches for one filename, putting the results in the table. But then I dont see how not using recursive would ever actually be useful, since there wont be matching filenames in the same folder. Or maybe it ignores file extensions so foo.txt and foo.exe are considered matching?
In Loading.lua in the
There is the line
As you can see, the path sent to the function is a sub-path of
What I need is a function that performs the GetMatchingFileName functionality, but enables me to specify a path which is not a sub path of ns2.
For example: When I run my test version of GorgeCraft on my local PC I see my loading screens. The mod is running from with a desktop shortcut -game gc.
When the mod is run from the workshop file, screens aren't in a sub-path of This means the loading screens are never displayed. I want to be able to specify a workshop path for the function to search in.
I hope that makes sense. I am not the best at explaining things sometimes
I think I would do better flying off to bed at this point before I confuse people even more, considering that I actually dont know the answer to the question you actually asked
But try looking at the source code for loading-screen mods, wouldnt they have had to solve this as well?
Even so, setting up by activating the mod first and playing still doesn't allow the workshop method to display the loading images.
Incidentally, I discovered that %appdata% is the ONLY folder you can write to. I tried saving to the mod folder in the ns2 directory, and documents and many other locations, and it was the only directory I was allowed to save in.
hmm, I should go back and look at that code and see how I got the save path working and go from there!!