Save/Load Code, Yet Another

X

xflip04

Guest
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?
 

Steel

Software Engineer
Reaction score
109
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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
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
 
Reaction score
456
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?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> 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)
 
X

xflip04

Guest
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
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
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.
 
X

xflip04

Guest
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?
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
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>
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
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
 
X

xflip04

Guest
So that code will work even if someone adds computers in the empty slots to make it seem like theres more playing?
 
G

gormey

Guest
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?
 
G

gormey

Guest
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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
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.
 
K

Kyxoan.

Guest
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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> 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.
 
K

Kyxoan.

Guest
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:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top