Thread Tools Display Modes
09-27-14, 03:55 AM   #1
ProgrammaXx
A Murloc Raider
Join Date: Sep 2014
Posts: 4
Smile import external text file and vise versa

Hello guise, im new here, but not new to programming.

Anyway, my question is what the title says, is it possible with an home-made addon to import files for readonly? i never found a documentation for wow LUA api.


psudo example of what im going to do:

1. my local JSon file is changed
2. "Lua magic"
3. the data from the JSon file is loaded


i am working with Skype4COM (Google it!), and i thought it would be fun to try "implement" skype


Cheers /pX
  Reply With Quote
09-27-14, 03:57 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
You cant. There is no automated way to get data into the sandbox of wow-lua. All you can do is stop the client and reload a certain file on startup.

http://wowpedia.org/World_of_Warcraft_API
http://wowprogramming.com/docs/api
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
09-27-14, 04:03 AM   #3
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Reloading the UI will write to the config file then read from it. It might be possible to do some magic there. :P

But it's not a very user friendly way to communicate outside the lua environment.
__________________
Profile: Curse | Wowhead
  Reply With Quote
09-27-14, 04:04 AM   #4
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
In addition to what Rilgamon said, you can avoid restarting the entire client (and get away with a /reload command), if the file you want to write to exists in the addon at load time. So you'd have some file data.lua that your external app writes to, and after a /reload in-game, the data would be available.
  Reply With Quote
09-27-14, 04:22 AM   #5
ProgrammaXx
A Murloc Raider
Join Date: Sep 2014
Posts: 4
hmm okay, so its not possible to refresh the addon without using /reload, thats sad for me


@Vlad im not sure what you are saying?



I will take a look at these links Rilgamon, thanks

/pX


edit: the /reload function must go through some steps, isnt it possible to only run the needed /reload functions so u dont get that loading screen?

Last edited by ProgrammaXx : 09-27-14 at 04:25 AM.
  Reply With Quote
09-27-14, 04:42 AM   #6
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
I don't know the specifics of the UI reloading process, but I think it's pretty safe to say that the internal functions to reload files are not available to us.
  Reply With Quote
09-27-14, 05:12 AM   #7
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
If you find a way to (re)load external files this is a breach of security. Those limitations are here for a reason.
So you should not look into ways to pass by this functions.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
09-27-14, 05:58 AM   #8
ProgrammaXx
A Murloc Raider
Join Date: Sep 2014
Posts: 4
Well 2 bad, anyway, thanks for the answers


cheers pX
  Reply With Quote
09-27-14, 06:33 AM   #9
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
There are actually a few ways you can read in data without a reload, load-on-demand addons get parsed at load time, so can be changed while the game is running but before the addon is loaded, however once loaded they can't be reloaded, obviously you can get around it by making & updating multiple separate addons and loading them when you want an update, but that is hardly an acceptable solution, because the reloads are finite and makes a mess of the addon folder.

A slightly cleaner but harder to implement solution is texture size scanning, texture files are purged from memory when they are no longer being used, and as such can be reloaded live, unfortunately the only information provided by the client about a texture are its dimensions.
But in theory you can have an external application feeding data into the client by constantly resizing the texture file, the bit-rate for communication will be quite restricted, as it depends on the maximum texture size that can be loaded in game, wow requires a power of 2 for texture resolution, assuming a limit of 65536x65536 (2^16, dunno real limit) it gives you 16 possible height values and 16 possible width values, for a payload of 1 byte.
  Reply With Quote
09-27-14, 08:36 AM   #10
ProgrammaXx
A Murloc Raider
Join Date: Sep 2014
Posts: 4
Originally Posted by elcius View Post
There are actually a few ways you can read in data without a reload, load-on-demand addons get parsed at load time, so can be changed while the game is running but before the addon is loaded, however once loaded they can't be reloaded, obviously you can get around it by making & updating multiple separate addons and loading them when you want an update, but that is hardly an acceptable solution, because the reloads are finite and makes a mess of the addon folder.

A slightly cleaner but harder to implement solution is texture size scanning, texture files are purged from memory when they are no longer being used, and as such can be reloaded live, unfortunately the only information provided by the client about a texture are its dimensions.
But in theory you can have an external application feeding data into the client by constantly resizing the texture file, the bit-rate for communication will be quite restricted, as it depends on the maximum texture size that can be loaded in game, wow requires a power of 2 for texture resolution, assuming a limit of 65536x65536 (2^16, dunno real limit) it gives you 16 possible height values and 16 possible width values, for a payload of 1 byte.
hahah, i like the idea but as you said, hardly a solution for 1 byte.

/pX
  Reply With Quote
09-27-14, 12:05 PM   #11
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by elcius View Post
But in theory you can have an external application feeding data into the client by constantly resizing the texture file,
If an external application messes with anything in the client while it's running, that's against the TOU.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-27-14, 12:11 PM   #12
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
so the curse client is against the tou if i use it to update an addon while logged in?
  Reply With Quote
09-27-14, 12:40 PM   #13
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Once addons are loaded, they're not re-read until the next login so Curse technically can't mess with anything while the client is "running".
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-27-14, 12:49 PM   #14
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
The curse client just dumps the new files into the addon directory, a /reload would load the newly downloaded addons, redrawing any textures would show the newly downloaded version, even before a reload, same with sound files and fonts.
If you're saying modifying addon files while the game is running is against the TOS, then it's against the TOS to update your addons while the game is running.
  Reply With Quote
09-27-14, 01:00 PM   #15
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
The Curse Client (or our Minion) isn't altering anything in the client. It's altering the addon files. The new contents of the files aren't *in the client* until you reload your UI.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-27-14, 01:28 PM   #16
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
Except for texture files, which can be updated without a reload, IE exactly what i said.
  Reply With Quote
09-29-14, 01:00 PM   #17
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Manipulating game and/or addon data for the sole purpose of bypassing the sandbox feature of the addon system is against the ToU. Addon clients like Curse and Minion don't attempt any exploit to achieve this and are therefore allowed. As hacks and exploits are illegal and WoWI is an official Blizzard community site, any further discussion of this is dangerously close to violating the rules of this forum as well.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » import external text file and vise versa

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