Thread Tools Display Modes
10/21/18, 01:44 PM   #1
TheIvoryKitty
Join Date: Feb 2017
Posts: 6
Create a File at Login

Hey guys. I've never written an add-on before. I am trying to find out whether I can write a file out (externally) on character login. I tried to do something like this:

function MyAddon:Initialize()
file = nil
file = io.open("../test.txt", "w")
file:write("test me!")
file:close()
end

But I receive a nil error, so, apparently something about that is not correct. I code in Java for a living; don't really know anything about LUA. Any help would be appreciated!
  Reply With Quote
10/21/18, 01:57 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
The game doesn't allow direct filesystem access for obvious security reasons and also because ZOS doesn't want addons to communicate with external services in real time.
  Reply With Quote
10/21/18, 02:37 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
You are only able to use ZO_SavedVars to write to a predefined SV file in the Elder Scrolls Online/live/SsavedVariables folder.
This file will be written upon /reloadui, /logout ingame.
So again: There is no real-time update possible.

Check the esoui wiki for SavedVariables:
https://wiki.esoui.com/Circonians_Sa...ables_Tutorial

Or the forums, e.g. this thread:
https://www.esoui.com/forums/showthr...t=ZO_SavedVars
  Reply With Quote
10/21/18, 05:43 PM   #4
TheIvoryKitty
Join Date: Feb 2017
Posts: 6
Originally Posted by Baertram View Post
You are only able to use ZO_SavedVars to write to a predefined SV file in the Elder Scrolls Online/live/SsavedVariables folder.
This file will be written upon /reloadui, /logout ingame.
So again: There is no real-time update possible.

Check the esoui wiki for SavedVariables:
https://wiki.esoui.com/Circonians_Sa...ables_Tutorial

Or the forums, e.g. this thread:
https://www.esoui.com/forums/showthr...t=ZO_SavedVars
Hey, that seems useful! I really just want to know if ESO is logged in in general, so, that would probably do the trick.
  Reply With Quote
10/22/18, 01:12 AM   #5
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Not sure I understand your use-case, but wouldn't it be enough to check if eso64.exe is running? Most of the time that would be equal to being logged in, wouldn't it?
  Reply With Quote

ESOUI » AddOns » AddOn Search/Requests » Create a File at Login

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off