How to save/load player stats?

Okay..this should be my last for a while. The last thing I need to know is how to be able to save/load player stats. I'm working on an RPG and need to know how to create a save file with the players hp, mp, lvl, weapons, and so on, and then be able to load it back later on in the game. Any help would be greatly appreciated.

Okay, if this helps any, in one of my JFrames, It
displays the following:JFrames have nothing to do with it. Try to separate your GUI from your data and "business logic," both in your mind and in your code. The data and logic are what they are, whether there's a GUI or not. The GUI just displays the data, takes input from the user, and kicks off this or that bit of the logic.
name, lvl, hp, mp, def, att, exp all stored as 'int's
with the exception being name since it's a string. You should define a class (Player or Character might be a good name) that encapsulates that data. That class should be Serializable, or you should use the XMLEncoder/Decoder. Either way, you can just write an instance of that class to a stream, and then later read it back from a stream. I guess you want that stream to go to a file, but that's independent of how you write/read it.
I
need those variables saved to a file (name doesn't
matter to me), then reloaded the next time the player
starts the game. I want to be able to have multiple
save files. Does the user pick the file name? What do you mean "multiple save files"? One for each user? Or any given user able to save multiple different games in progress?
In any case, saving and reloading many files is no different than one file. Either way you need a way to know or select the file name. But all the work you do is the same.
I guess this sounds a little hard, butNo, not at all. Just slightly unclear on certain details of the requirements and on what part in particular is hanging you up.

Similar Messages

  • How to save the session states for a tabular form WITHOUT using check boxs?

    Greeting guys,
    As you know that we can use collections to save the session states of a tabular forms, described in the how-to doc of manual tabular forms. However, what I am trying to do ( or have to do) is to provide a manual tabular form, and save the session states for validation, without using the check boxes. Because a user can put contents into some columns in a row without checking the corresponding checkbox, according to the requirements. So basically what I tried is to loop over all the rows and save Every entry into a collection. However, sometimes I got "no data found" error with unknown reasons.
    My current solution is to use the "dirty" Retry button that gets back the history, which IMO is not a good workabout. So, I'd appreciate if somebody can shed some light on a better solution, especially if it is close to the one in that how-to doc.
    Thanks in advance.
    Luc

    The following is the first collection solutin I've tried:
    htmldb_collection.create_or_truncate_collection('TEMP_TABLE');
    for i in 1..p_row_num loop -- Loop on the whole form rows
    if (htmldb_application.g_f01(i) is not null) or (htmldb_application.g_f05(i) <> 0)
    --If either of them has some input values, the row should be saved into the colleciton.
    then
    htmldb_collection.add_member(
    p_collection_name => 'TEMP_TABLE',
    p_c001 => htmldb_application.g_f01(i),
    p_c002 => htmldb_application.g_f03(i),
    p_c003 => htmldb_application.g_f04(i),
    p_c004 => htmldb_application.g_f05(i),
    p_c005 => htmldb_application.g_f06(i),
    p_c006 => htmldb_application.g_f08(i)
    end if;
    end loop;
    Some of columns have null values, but I don't think that's the reason. Because once I clicked all the check boxes, there would be no error no matter what values were in other columns.
    Another issue would be extract the values FROM the collection, which has been tried because I had problem to store the data into the collection. I used "decode" functions inside the SQL to build the tabular form. I am not sure whether it will be the same as a regular SQL for a tabular form, like the example in the How-to doc.
    Also I didn't use the checksum, for it is not an issue at the current stage. I am not sure whether that's the reason which caused the NO DATA FOUND error.

  • How to save & load in iOS

    Howdy again.  I didn't see this question asked anywhere, I mean I couldn't find a single question in the director forum asking about file operations in iOS.  'How to handle Save & Load events for Director iOS App' recommends doing save and load stuff in the event handlers 'onActivateApplication' and 'onDeactivateApplication'.  But how am I supposed to do the actual file read and write ... if none of the Xtras work on iOS then how do I write to files and read from files?

    I'll give it a try.  It seems a bit odd that the only way to write or read file data in Director on iOS would be named as preference API functions.

  • How to save/load JTextPane to/from file?

    One of the simplest questions re Swing.
    How to save a JTextField onto a file?
    And, how to read back it onto a newed JTextPane?
    Yes, I have searched, searched and searched on the net, in vain.

    Assuming he's wanting to do the reasonable thing, I'm trying to do it too.
    linuxoid, I suspect he (and I) are looking for a way to save the contents. After all, a control that you can't get the information out of is pretty useless.
    Styled text is often just a BLOB to the rest of the app. It is in my case, and it probably is in his.
    I'm having the same trouble he is.
    I want to make a JTextPane, let the user edit it, then get some reasonably portable representation of it's current contents that I can serialize. A string representation of XML sounds dandy. Incomprehensible binary is acceptable. A representation in some markup language that I can insert in some other document and have it act like I'm inserting text in the editor would make me more than happy.
    Ideally, what I, and probably he, are looking for is something like
    JTextPane myPainIsGreat = new JTextPane();
    ... life goes on...the user writes poetry and turns the words tacky colors...
    String thisICanDealWith = myPainIsGreat.getStyledTextRepresentation();
    knowing better I'd settle for
    myPainIsGreat.writeStyled(someWriter)
    sadly, JTextPane's write just returns unstyled text

  • How to save Real Player/Windows Media Player Files

    After watching a streamed news story (both in RP and WMP), I tried to save the file, but couldn't figure out how to do it. Can it be done?

    After watching a streamed news story (both in RP and
    WMP), I tried to save the file, but couldn't figure
    out how to do it. Can it be done?
    You will need a third party solution such as Snapz Pro X
    http://www.ambrosiasw.com/utilities/snapzprox/
    iFelix

  • How to save final states with simout

    The simout function description (html and manual) indicates that it is capable of saving initial or final states, however it does not say how to save the final states or indicate to the function how to do this. How do I indicate that I want the final states? (When I run simout, it acts like its assuming initial states).

    When you use the Simout function you are quirying the state of the model as it exists. If you did not immediately prior run a simulation then you will have the output as the initial conditions. If you want the final states then you will have to run a simulation.
    If you are doing this you may want to incorporate into your reportior the use of the resumeto and resumefrom keywords. See the following from the manual:
    Linearizing About a Final Operating Point
    To linearize a single-rate system at a certain operating point, you must first perform:
    y = sim(model,t,u)
    sys = lin(model,{resume});
    The resume keyword indicates that the linearization operating point will be the final operating point of the previous simulation. To save the operating point at th
    e end of the simulation specify the lin options resumeto=filename and resumefrom=filename.
    Alternatively, you can simulate the model until you reach the desired operating point:
    y = sim(model,t,u);
    Find the state at that operating point:
    [x] = simout(model);
    Linearize around the operating point:
    sys = lin(model,{u0=u(length(t),,x0=x})
    Now it sometimes becomes useful to obtain the operating point without running a simulation for this purpose there is a full featured trim function that is documented pretty well in the online manual... Search "trim"
    Garrett Thurston
    [email protected]
    Phone: 781.993.5540

  • How to save a game  and then load

    My final project of BSCS (Bachelor of Science in Computer Science) is a Multiplayer online Board game...Distributed Ludo...
    This project is in its final steps and I�m facing some difficulties.
    I do not know how to save the game and load it again. Can anybody guide me to the process?

    Saving a game is just persisting the data required for the game.
    Loading a game means reading the saved data and setting the attributes of the game (and player and ...) to start exactly the point where it was saved.
    So the steps to save are
    1. Identify the data necessary for retaining the same state when needed.
    2. Decide the data file format and structure.
    3. Get the snapshot of necessary attributes
    4. Save the data using APIs
    Steps to load are
    1. Read the data using APIs.
    2. Set the game attributes.
    3. Update the model and view accordingly.
    Hope this helps.

  • How to save toolbar state in browser plugin?

    How do I get the Reader browser plugin to save the toolbar state?
    I'm using Adobe Reader XI as a browser plugin in Firefox. I've set it to disable Read mode by default. I like to have several tools at my disposal, so I right click the toolbar and show all the page display tools that I like. When I quit and load a new PDF in the browser, the toolbar state is lost and I have to show all my favorite tools again. This gets annoying when done repeatedly throughout the day.
    The native Reader program saves toolbar state. Why not the plugin?

    Toolbar entries for the desktop and browser instances are different, so what you assign in one won't update the other. That's because a lot of things aren't allowed in the browser plugin. You can't directly manipulate the toolbar options in the browser instance of Adobe Reader XI, they're factory-defined.

  • How do I load an AU instrument (Garritan ARIA player) into Logic Pro X on a Mac Mini OSX 10.8.5

    how do I load an AU instrument (Garritan ARIA player) into Logic Pro X on a Mac Mini OSX 10.8.5 ?

    You install the player .component in the Library/Audio/Plug Ins/Components folder (though an installer probably does that for you) and install(er) the sample content wherever you want, then you start Logic (the new plug in will be validated during startup), open or create a project, create/use a software instrument track, instantiate the player in an Instrument slot, and in the player itself you choose the sound(s) you want to play and load those.

  • How do I load and save to my iMac a dvd purchased elsewhere?

    how do I load and save to my iMac a dvd purchased elsewhere?  Thank you.

    The mods here are adverse to mentioning software to duplicate commercial media, which is called "ripping." However, you can search outside of this forum for the software you need.

  • How to save an MP3 that shows up in a 'safari' player?

    If you pull up a URL that is directly to an MP3 file, say like this one here:
    http://dl.getdropbox.com/u/7042/Flow%20Dynamics%20-%20Barcelona320k.mp3
    It is a raw MP3 file, not an MP3 embedded into a flash player or anything. I can't for the life of me figure out how to save the file from within Safari. Sure I can copy the URL, paste it into an email, contextual click it and select to Download the Linked file - but it would be far easier to do this task from within Safari.
    Am I missing something? How do you save the file from Safari?
    Thanks.

    Oh. yes you can do that. But if you open or have a link open with the player you used to be able to right click to download the video/audio file but not any more with Safari 4x. Like I said there's more than one way to skin a cat and do this operation. I can think of three other way to do this. The way I showed is a sure fire way in doing this.
    One should know how to do this or anything else on their computer in more than one way. Just incase one way doesn't work. Thanks for sharing!

  • How to save html response when execute a siebel load test.

    First at all excusme for my english.
    I need help to manage html response. I use OpenScript Version: 9.3.1.0 Production.
    When i execute a siebel load test, some of the VU returns the error "12152 the server response could not be parsed". Mi boss asked me an image or html response to analize the error. But i dont now how to get it.
    I search in all logs but i didn´t find nothing usefull.
    Anyone know how to save the html response when execute a load test?
    Thanks.
    Gabriel.

    "First at all excusme for my english."
    => are you french? I am! So no problem of course ;-)
    Which ATS version do you use? Because starting with 12.1, you have a better VU Logging capabilities.
    From the OLT user guide:
    The virtual user logs window has the following toolbar options:
    Open - Opens an existing virtual user log.
    Save as CSV - Exports the current VU log to a comma-separated value file.
    Clear - Clears the virtual user logs.
    View Text - Displays the source HTML for pages accessed by the virtual user.
    Render HTML - Displays actual pages as accessed by the virtual user.
    Auto Display - Displays pages as they are received by the viewer.
    See if it can help.
    If not, maybe you could implement some logics in OpenScript, but i wouldn' advice that.
    JB

  • How to save the state of the changed visible layers in pdf, pre-designed in Indesign

    Hi,
    I have made an Indesign (CS 5.5) file with some textfields (no button), and interactive buttons. And saved it as Interactive PDF.
    I have made a fillable form out of the textfields in Adobe Acrobat Pro X, and the interactive buttons are working in PDF.
    When you open the PDF in Acrobat Reader or Pro, fill in text and change a state of the button and save the file: all the changes (text and state) are saved.
    When you open the PDF in Acrobat Reader or Pro, fill in text and save the file: the changes (text) are saved.
    When you open the PDF in Acrobat Reader or Pro, and only change a state of the button and save the file: the changes are NOT saved.
    What I mean with states of a button: SHOW/HIDE or ON/OFF etc.
    Does anyone know what I'm doing wrong. Or is it not possible to only save changes in states of a button?
    Thanks in advance for thinking with me.
    Josiane

    You would have to check your color management and things like overprint settings or the ink levels of the color components. Streaking is usually a sign of areas getting oversaturated and the automatic adjustments in the printer driver being unable to compensate. and then of course other factors may figure in like banding inherent in using gradients across large areas, out of gamut issues for certain colors and what have you. You'd have to be much more specific about all of that for anyone to even begin to advise specifically...
    Mylenium

  • I am unable to save a bank statement - a drop down box wants my "owner password" before it will save.  How do I find this?

    Recently, I have been unable to save my bank statements.  I now get a "drop down box" asking for my "owner password".  When I insert my password, it does not recognize it?  Any ideas?

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • How to save a reference to a class depending on a conditional statement...

    Hi!
    I'm rather new to Java, but I'm already in the process of creating a rather big application (big, from my point of view) :).
    I have a main class, in which I find out what OS the application is running on (utilizing System.getProperty("os.name")). If the string corresponds to Windows (I'm using regular expressions to match this), I create an instance of another class called WindowsPlatform.java. And vice versa for Unix.
    My problem is that I'm not really sure how to save a reference to the Unix or Windows platform class, as the program conditionally decides, depending on the platform, which class to invoke.
    The error Java's giving me is:
    MainClass.java:9 cannot find symbol
    symbol  : method sayHi()
    location: class Platform
            platform.sayHi();
                    ^
    1 errorWhat I want is to have the sayHi() method invoked from whatever class (UnixPlatform or WindowsPlatform) that was earlier in the program used as argument for the setPlatform() method in Initializer.java.
    This is the the code involved (class names have been changed to easier reflect their purpose):
    ### MainClass.java ###
    public class MainClass
        public static void main(String[] args) {
            SettingsClass settings = new SettingsClass();
         Initializer init = new Initializer(settings);
         Platform platform = settings.getPlatform();
         platform.sayHi();
    ### SettingsClass.java ###
    public class SettingsClass
        private Platform platform;
        public void setPlatform(Platform _platform) {
            platform = _platform;
        public Platform getPlatform() {
            return platform;
    ### Initializer.java ###
    public class Initializer
        private SettingsClass settings;
        private RegExpr re;
        private String os;
        public Initializer(SettingsClass _settings) {
            settings = _settings;
            re = new RegExpr();
         os = System.getProperty("os.name");
         if (re.find(".*win.*", os, true)) {
                settings.setPlatform(new WindowsPlatform());
         } else {
                settings.setPlatform(new UnixPlatform());
    ### Platform.java ###
    public class Platform
        /* Some generic functions applicable to
         * all platforms
    ### RegExpr.java ###
    import java.util.regex.*;
    public class RegExpr
        private String regExpr;
        private String str;
        private boolean iCase;
        public boolean find(String _regExpr, String _str, boolean _iCase) {
            this.regExpr = _regExpr;
            this.str = _str;
         this.iCase = _iCase;
            Pattern pat;
         Matcher matcher;
         if (iCase) {
                pat = Pattern.compile(regExpr, Pattern.CASE_INSENSITIVE);
         } else {
                pat = Pattern.compile(regExpr);
         matcher = pat.matcher(str);
         if (matcher.find()) {
             return true;
         } else {
                return false;
    ### UnixPlatform.java ###
    public class UnixPlatform extends Platform
        public void sayHi() {
         System.out.println("Hi, I'm Unix!");
    ### WindowsPlatform.java ###
    public class WindowsPlatform extends Platform
        public void sayHi() {
         System.out.println("Hi, I'm Windows!");
    }I would greatly appreciate any help I could get on this issue!
    Thanks for your time!
    Regards, ridgero

    Dear Ridgero, your method must exist in your Platform class. Now you can only call this method from UnixPlatform or WindowsPlatform. The two easiest ways to resolv this would be something like:
    abstract class Platform
        /* Some generic functions applicable to
         * all platforms
        abstract void sayHi();
    }or this:
    public class Platform
        /* Some generic functions applicable to
         * all platforms
        abstract void sayHi() {}
    }Good luck.

Maybe you are looking for