Save/Load Code, Yet Another

Wow I have been looking for an easy understanding save load code for ever this is awesome!

1 question though how can I add an account name specific code so someone cant take another persons code?
 
It is a wonderful system, but I must say it uses a lot of globals...I understand this is done because it wasn't written for the advanced mappers that understand the ins and outs of JASS, but rather those people who want a save / load system that can be easily changed and formatted to their liking in the GUI.

Flip, he has a variable SaveLoad_UsePlayerName. This is what you want.
 
The initialization trigger has a line that says: "Set SaveLoad_UsePlayername = True".
If that variable is true, and it is by default, the player's name will be part of the code.



> ... a lot of globals...
> ... can be easily changed and formatted to their liking in the GUI.

Well, :p
 
Great :D !

>(Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
>(Length of (Entered chat string)) Greater than 6

Does that really need both of them?
 
> Does that really need both of them?

Preferably, yes.


Imagine some in-game chat:

- hey, how do I use that save thing?
- easy, type -load and you're done (condition 1)
- K
- -load (condition 2)
- don't work, what now?
- well, you were supposed to add the code after "-load"... (condition 1)
 
Ok I see it now cool, if I were to add all lower case to the alphabet trigger as well, to make the code more random would that be hard? =P
 
Code generation is deterministic.
It doesn't get more random if you use more characters...

But, like said somehwere in post #1, if you add both lower and upper case characters:
- the code might be shorter
- you must "Set SaveLoad_CaseSensitive = True", in the initialization trigger; otherwise decoding won't work correctly


As for "is it hard?"... there's a ready to use variable, also in "initialization", called "SaveLoad_Alphabet".
Note: you must use the same "alphabet" for coding and for decoding.
 
Ok 1 more question, If someone were to put a save load code in their map your going to need some sort of trigger that detects single player mode to use cheats. How can I make it disable the save and load option when not being played in battlenet?
 
this is an easy one just do this:
Code:
Single Mode
Event
    Map initialization
Condition
    (Number of players in (All players controlled by a User player)) Equal to 1
Action
    Turn off Saving <gen>
 
Code:
SaveLoad NoSinglePlayer
    Events
        Map initialization
    Conditions
    Actions
        Custom script:   if bj_isSinglePlayer then
        Trigger - Turn off <Save trigger>
        Trigger - Turn off <Load trigger>
        Wait 5.00 seconds
        Game - Display to (All players) the text: "Single player: -save and -load have been disabled"
        Custom script:   endif
 
So that code will work even if someone adds computers in the empty slots to make it seem like theres more playing?
 
Putting in the trigger Unit - Remove (Triggering unit) from the game at the bottom of the trigger is not working how can I fix this?
 
What trigger? Your save load trigger on the bottom of the save trigger
Where exactly? The end before I put the trigger turn off this trigger
And what are you trying to do? Remove the hero from the game after saving to end the game.
 
Well, the "save" trigger uses a "pick every unit in ..." to loop through your single Hero...
Put "Unit - Remove (Picked unit)" as very last action inside that loop.
 
nice save load code but...

I found an interesting bug.... The code will not restore a hero if it is saved with 0 gold, Is there a reason why that happens?

At first i used your map as a base for my map to preserve all the triggers / jass but i ended up needing to redo the terrain and stuff so i copy / pasted it to a new map. I didnt carry over the initialization trigger that is in yours thinking that was just for testing as stated..

I then tried to do a save load test with my partial terrain and it saved but said "decoding" and didn't create a new hero. So i wanted to see if its a single player only save load like some of them are and it didnt work there eaither.

I then decided to test it with gold and lumber on me for some reason (no idea what prompted me to do so) and it worked. first i did 100 gold / lumber and then i did just 1 gold piece and it saved me and loaded me perfectly.

So just for anyone out there running into this issue that is the only problem i have found with this save load.

If you know of anyway to fix it, I would appreciate the help. If not i will add a simple if then else for gold being less than 1 to set gold to 1 and it should work fine.
 
> If you know of anyway to fix it

Indeed.

With "Save[1] = 0", the decoder will miss one character...
Interesting.

Congratulations.


I'll sleep a night over it or so.
Until then, don't save a potential 0 in Save[1]...


> I didn't carry over the initialization trigger

You should though.
At least for the alphabet. Actually, for any lines after "these three lines ...".
And the required global variables.
 
okay then=P

Also, Your tutorial makes it seem easy to add a new process by adding save[index] and telling it what to do, but i can't find anywhere to put a code to save str / agil / int or learned abilities. Do you have aim per chance? if so i am kproskater7 if not perhaps you could explain in detail to me what i need to do in PMs or on here =) thanks ace.

and, I carried the initialization Inside the save/load folder but not the one inside the initialization folder because that was just giving me ar andom level / gold. thats the one i ment.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/
  • The Helper The Helper:
    Happy Thursday!

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top