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.
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new
  • Ghan Ghan:
    Good stuff.
  • Ghan Ghan:
    Just make sure it is secure. :)
  • The Helper The Helper:
    It will only be on internal network

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top