SavedVariables forced write
I would like to save data in a file to be read externally. This is possible by assigning to a "SavedVariables" variable, but I cannot force it to write to the file on demand. Well I sort of can, by "/reload", but is there a programmatic way?
|
Quote:
|
/reload also causes saved variables to be eeerrrr... saved.
|
Therefore, if an addon wants to communicate using an external file, it can only be done with "/reload" and/or real reload?
|
The addon can't communicate but the only way for an external program to extract the latest information from an addons SavedVariables file(s) is after /reload or logout/exit.
|
The function you're looking for is C_UI.Reload() (previously ReloadUI()). This requires a hardware event like a button click or a keybind.
This restriction of real-time communication outside of WoW is by design to prevent botting. |
Quote:
I have also noticed many times that WoW loses character settings if you do not log out but crash out/lose connection, which also follows the same "save files on /reload" rule... |
Quote:
Think of writing the Great Novel then pressing alt-f4. Except that in WoW there is no periodic automatic save. |
Quote:
Or in the middle of writing your first game ... and the power goes before you save and that large 300 lines of code are gone in the wind ... *cries* |
Quote:
Yes, using reload in an addon ( via a button click ) or /reload command, will force an update of the saved variables. So that in the event of a crash out before the next reload you will have at least have up to the last save done. Unfortunately, any changes you make while you are still in the game will not be registered. You would have to log out ... update the file if needed ... log in. At that point it will load the updated file. Hopefully these 3 scenarios will highlight why what you want will only work as an autosave type thing ( with a button press or slash command ) or as an external reader/writer of the file while the game is not running. Log In > Saved Variables File Loaded into memory Reload > Saved Variables File Updated from memory and loaded into memory Crash .... > No change to Saved Variable File Log In > Saved Variables File Loaded into memory Reload > Saved Variables File Updated from memory and loaded into memory External Program > Saved Variables File adjusted via program Reload > Saved Variables File Updated from memory, replacing changes made by program, and then loaded into memory Log In > Saved Variables File Loaded into memory Log Out > Saved Variables File Updated from memory External Program > Saved Variables File adjusted via program Log In > Saved Variables File Loaded into memory including the changes mae by the program |
All times are GMT -6. The time now is 05:28 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI