View Single Post
08/21/15, 02:44 PM   #18
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Originally Posted by Baertram View Post
Emails sometimes will not show until you logout and in again. And the email texts are only accessible as you open the email inbox "manually". Answer: No

Chat messages can be sent by the help of addons as far as I know. But sometimes you are only able to put the text into the chat edit box, and you'll manually have to press the RETURN key to send the message.
Answer: Maybe (but still ugly!!!! )

Instand messages are the same like chat messages.


About the synch:
An external tool needs to read the data from a website/database and must update the information to the SavedVariables file of your addon (which is displaying the messages ingame).

Problems:
If the ueser is currently doing a reloadui ingame as the external tool is trying to update the SavedVariables file there are 2 sources trying to access the SavedVariables file at the same time -> How do you detect this? (Maybe preHook the /reloadui function and set a variable to TRUE inside the SavedVariables of your addon, read this variable by help of the external tool and only if it is FALSE update the SavedVariables file from external sources. To reet the variable to FALSE just do it at the EVENT_PLAYER_ACTIVATED).
But the other way around it is not possible to detect from the addon ingame if the external tool is currently accessing the SavedVariables file

All updates from external will be overwritten again if you do a reloadui! The game will always take the internally used variables and data and store it into the SavedVariables. So basically there is no way to update it from external as long as the user is logged in :-(
Maybe if you work with 2 different SavedVariables files somehow.
Well, I figured that it would be damn hard if not impossible to do something like this, since it's a big security hole for the game. :P Thanks for the insight.

About the sync, yea that's an issue. On hindsight I see 1 possible solution and one workaround;

I noticed that my editor, Atom, could not read the the saved variables file while the game was changing it, MAYBE the game take control, the tool could detect this and delay the sync accordingly. But I feel that it'd be more difficult than that.

The workaround would be what you already mentioned; it'd befall on the add-on author to make an additional data-only add-on that could store like a version/last-modified timestamp and periodically check for update from the actual add-on.
  Reply With Quote