Lua - Get Directory xxx.lua
I am creating an addon and I'm stuck on one thing, when I use the following line in the Lua
local dir = debug.getinfo(1).sourceit returns me the following result @game:/EsoUI/lang/br_pregame.luaand what I need to know and exactly the way it is "@game:" by chance would have the game function something that could help me? |
Do you need to know the value "behind" @game (the directory of the game, like c:\programs\elder scrolls online\game), or do you just need the string @game: separated from the total string @game:/EsoUI/lang/br_pregame.lua
? |
I need this path
C:\Users\<<User Name>>\Documents\Elder Scrolls Online\live\AddOnsbut it returns me just that damn @game: if it be fixed would be no problem but the user can change the default folder for documents elsewhere, which is why I'm behind a solution covering the maximum possible scenarios. |
Ok. it looks for me that @game: is used internally the elder scrolls online as a "constant" for the correct game path.
Aren't you able to just use this @game: value too in your addon then? Other question: What do you need the path for? As far as I know the ESO lua codes do not support any I/O part of normal lua so I don't think there is any possibility to get the correct file path. I'm not at my gaming pc at the moment so I cannot check this: Maybe the path is saved somewhere in the C:\Users\<<User Name>>\Documents\Elder Scrolls Online\live<eu>\UserSettings.txt" file as a full string? Did you look into this file already? There you would be able to read the settings information then to parse the string. Check this thread how to read the settings: http://www.esoui.com/forums/showthre...light=settings EDIT: Just found an example of usersettings.txt online and it seems it is using the same game:/ value there.... Code:
SET LanguageDirectory.2 "game:/EsoUI" But I still think you could just use the same constant "game:/" in your addon too then. Question: What do you want to achieve? Maybe there is a nother way to do this by using your addons base path and using ../../ to go up some folders etc. ? |
Okay let by XD
1 Agree with you on the part of "@game:" being a constant and used internally and has tried to use only "@game:," and it did not work! 2. Support for I/O is partially right, I found that if you run Lua codes while the game loads you fully supports the Lua commands, my intention and create a kind of eastereag in the game where you will see a splash screen with the name of the translator for PT-BR version (original game splash will be kept) 3. I checked for UserSettings.txt could be something to help me, but unfortunately found nothing! 4. I tried using the "@game:" direct or checking through various existing functions in ESO to return me something but all in vain! 5 I wanted to create a splash screen to show the employees to translate just about everything already iss ready so lacking copy the .bik video Addon folder for "The Elder Scrolls Online\depot\Video" discover what is ready below Lua Code:
Just missing the place that is the video that will be placed in the variable "dir_MidiaBR" to put the full path
|
because to use playVideo is required is within the video "The Elder Scrolls Online/depot/Video" already tried running other folders simply does not.
|
Oh, ok.
I think I can't help you here then as I don#t know any function or method to get the correct ESO game directory... But another point: EVENT_ADD_ON_LOADED is called for EVERY addon that a user got installed and activated! So your source code in function PTBR_LoadMedia(event, name) will be currently executed for EACH addon :( You need to check the addon name at the beginning of the addon so it will only be called for YOUR addon. YOUR addon is the name of the addon in the manifest TXT file. I think it is "TraducaoPortuguesBR" for your addon? Lua Code:
|
Here it is a little different because it is an addon ESO that uses this .lua so I did a workaround to avoid this error, not only posted the code to workaround to become clean but below is the complete code.
Lua Code:
Still thank all the help :D |
If you want to play your video, just remove one of zos bik files by yours.
http://wiki.esoui.com/API Standard Lua libraries Included basic library (only functions listed above) string math Please note that the following libraries are NOT included : Coroutine Manipulation Input and Output (io) Operating System (OS) Debug Lua Code:
|
Quote:
The patching system will most likely detect a wrong CRC then and will update/download the .bik video file again then :-( |
Portuguese / Russian / Spanish / etc are accustomed to not using patcher. they only launch them tuesday , when patches goes live.
|
All times are GMT -6. The time now is 10:12 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI