Thread Tools Display Modes
04-16-07, 04:48 PM   #1
Johan1923
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 10
saving data

ok, while working on my project theres really one thing thats preventing it from being "complete" and thats making it so that the Edit Boxes keep the text thats typed into them between game sessions.

so my question would be how would u set it up so that the data gets marked/flagged for saving?

ive looked on wowwiki, and i have like the beginnings of an idea but im still not sure how to do it. anyone able to give me like some example code based around an editbox? or a better explination of how to mark it to be saved.
  Reply With Quote
04-16-07, 04:53 PM   #2
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
In your TOC file, you need a line that goes:

Code:
## SavedVariables: <var>
## SavedVariablesPerCharacter: <var>
where <var> is some variable you want to be saved. You don't need both of these -- if you use the former, it will use the same variable for all characters, and if you do the latter, it will use a separate file to store the variable for each character.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
04-16-07, 09:02 PM   #3
Johan1923
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 10
well ive got

## SavedVariables: <var>

in my TOC, the thing is how do u write to it, how do u flag things to write to it?
  Reply With Quote
04-17-07, 09:15 AM   #4
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Originally Posted by Johan1923
well ive got

## SavedVariables: <var>

in my TOC, the thing is how do u write to it, how do u flag things to write to it?
Assuming you've replaced <var> with whatever variable you want to write, that's all you do. During a normal shutdown, those variables will be written to a save file, and then loaded at next startup (the variables will not be available immediately upon load, but are guaranteed to be loaded before the VARIABLES_LOADED event fires).
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
04-17-07, 10:16 AM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Just make sure that variable you have in your .toc is defined in your code.
__________________
"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

WoWInterface » Developer Discussions » Lua/XML Help » saving data


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