PDA

View Full Version : Writing gamedata to a file



zenga
12-23-2009, 11:14 PM
ola,

Does anybody knows a place where i can find some example code of how to write out game data to a file? The output format doesn't really matter. Maybe there is an addon who already does this (that i couldn't find).

The reason for this is that i want 2 things:
-write data to a database for detailed statistics I can work with outside the game (no clear idea on what and how yet)
-make my own assistant that runs outside the game (this app would read the data from this file and give me certain warnings, most likely audio). As far as i know this should not violate the blizzard policy; but any confirmation on this would be cool.

A simple example for the last one could be a cooldown for fire elemental totem: when the cooldown starts the info is written to a file, my app reads the file and does the math and plays a 'You can now use your fire totem again' song.

Another thing could be a note function for certain bosses: whenever i target a mob, the name of that mob is written to a file, my app pics it up and plays the notes i made last time.

Those are 2 things i find useful as we speak. I know there are addons that offer me the same functionality, but i like 1 assistant that i can change myself and that scales with my game progress. In this and 3 months i'll probably have other needs than i have right now. Not to mention that i haven't really thought out all the possibilities.

I don't have any desire to learn Lua in depth. But i'm familiar enough with other languages to achieve what i want provided I can find a simple way to write game data into a file.

Anyone some tips on examples?

cheers
z

Gorkette
12-24-2009, 12:05 AM
My knowledge on this is sketchy at best, but my understanding is that addon LUA files are only written too when you log out.

I could be completely wrong though :)

Freddie
12-24-2009, 02:06 PM
I don't think it's possible to do this with the WoW API because if such features existed, they could be used for automation, and Blizzard doesn't want that to happen.

HTeam
12-24-2009, 02:21 PM
My knowledge on this is sketchy at best, but my understanding is that addon LUA files are only written too when you log out.

I could be completely wrong though :)


This is correct. Further, you don't just write to files, you basically just dump the state of specified variables. This is a bit more limited than writing an arbitrary file but good enough if all you want is data.

Fizzler
12-24-2009, 08:51 PM
There are ways to do what you want in game. At least the example you give. Spell Alerts, Timers, there are a slew of addon's that track gold and item collection (wowhead, curse addons) As far as I know nothing real time to an external application. Opens up the game to automation in a big way.

Fursphere
12-24-2009, 08:53 PM
Look at the census mod from warcraftrealms.com

zenga
12-24-2009, 10:12 PM
Thanks for the replies.

I found that enabling /combatlog does what i want to a certain extend. It writes the combatlog to /Logs/WoWCombatLog.txt. It doesn't look like it's instant, but there were only a few seconds delay between starting a fight and when the log appeared in the file (output looks like this (http://pastebin.com/m75c64964)). I also came across this (http://code.google.com/p/stasiscl/) project, which could save me work at first sight writing the parser and could give me a bunch of extra 'possible' features.

Even if there is a short delay, that shouldn't be a big issue for the reminder function i want. The log contains timestamps which makes the math easy. For things with longer cooldowns like fire elementals it doesn't have to be on the second.

Gonna keep an eye on the delay when the data is written to the logfile and will post here.

Freddie
12-24-2009, 10:35 PM
Oh, I thought you wanted real time. I misunderstood you.

zenga
12-24-2009, 11:12 PM
Yeah that was my first idea. Seems like the delay when the combatlog file gets updated is varying. It updated almost right away when i got back from afk up to 5-6 minutes later on, which will only work for long cool down abilities. For other things i'll need to get used to existing mods/addons. For now i know what to do in my free time with the combat log :)