Easy save.....

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Easy save.....

Post  Kesa_ on Tue Apr 29, 2014 6:01 pm

I added some lines to the save code function. So when you enter "-SLNG" the save code will be saved in Warcraft III directory. But there is a problem, the save code will be saved in every one Warcraft III directory if you play in multiplayer. To keep your code is only for you, the last 7 characters of the code will be cencored, so you still need to remember that last 7 characters ( but it easier right? ).

if you wanna try, here is the link:
http://www.epicwar.com/maps/242304/

I hope this system will be official in the next version. And sorry for messing up the code without permission,  tongue
avatar
Kesa_

Posts : 23
Join date : 2014-03-29

Back to top Go down

Re: Easy save.....

Post  Zergling_man on Fri Jun 06, 2014 10:17 am

Thumbs-up! I like this a fair bit. Although I have to wonder... Will the files overwrite each other? I don't know JASS very well, but I hope there can be a solution where it only saves for you. That'd be the best way...
avatar
Zergling_man

Posts : 341
Join date : 2011-09-11
Age : 25
Location : Wandering somewhere through cyberspace, probably

Back to top Go down

Re: Easy save.....

Post  psxlover on Fri Jun 06, 2014 10:43 am

Since he uses the code as the name of the file, no they wont overwrite each other.
No idea why he stores the saves from everyone... preload functions don't generate network traffic so you can check if it's the local player saving before storing to the disk.
On the next version it will save using the total level as filename so it will overwrite if you don't level up between saves (which may cause problems if you have maxed everyone).
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Kesa_ on Fri Jun 06, 2014 6:36 pm

well im still new with jass, that's great if you found how to preload locally.
Another idea from me, when any value like item carried or level of the hero is changed the game will be saved automatically, so no need to type -save or -slng anymore.

and the save code filename, here is my suggestion:
<playername><totallevel><itemIDslot1....itemIDslot6>.txt
ex:
norris1980AA01BB02CC03DD04EE05FF06.txt

but what wrong with using the save code as the filename?  Razz
avatar
Kesa_

Posts : 23
Join date : 2014-03-29

Back to top Go down

Re: Easy save.....

Post  psxlover on Fri Jun 06, 2014 7:37 pm

Generating the code is resource heavy, so doing it everytime the code changes is a really bad idea. Perhaps it could be done periodically (every few minutes) but that would create a lot of save files, so I'm just going to leave it as is.

Another thing I plan to do is save it as a .bat instead of .txt that will copy the code to the clipboard when run, so you will only need to run it and then press ctrl+v in warcraft.

Using the save code as a filename would make it hard to find which save you are looking for (unless if you sort by Creation Date, but still searching for an older save would be hard).
I wanted to use the date on the filename but since there is no way in warcraft to get the date I'm using the total level. Using the item codes along with the rest sounds a good idea, but since there are 18 items, it seems like 18 more characters would make the filename too big.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Kesa_ on Sat Jun 07, 2014 8:44 am

wow thats great. But using .bat as the save file, how if someone replace the save code with...i don't know...maybe some virus code?
avatar
Kesa_

Posts : 23
Join date : 2014-03-29

Back to top Go down

Re: Easy save.....

Post  Zergling_man on Sun Jun 08, 2014 10:46 am

Except he outlined that the user would have to run it, then paste the result into WC3. Couple of things to note: Some enviroments may not allow (or support) .bat. I put forward MacOS as an example. Secondly, we don't avert the message length issue...
avatar
Zergling_man

Posts : 341
Join date : 2011-09-11
Age : 25
Location : Wandering somewhere through cyberspace, probably

Back to top Go down

Re: Easy save.....

Post  psxlover on Sun Jun 08, 2014 7:42 pm

Kesa_ wrote:wow thats great. But using .bat as the save file, how if someone replace the save code with...i don't know...maybe some virus code?
Don't run it unless you downloaded the map from here...

Zergling_man wrote:Except he outlined that the user would have to run it, then paste the result into WC3. Couple of things to note: Some enviroments may not allow (or support) .bat. I put forward MacOS as an example. Secondly, we don't avert the message length issue...
If you are playing on MacOs or Linux simply open the file and read it. Batch files are simple text files. Perhaps I'll add a line to copy it clipboard for those systems too but I dunno how sh reacts to files filled with garbage.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Zergling_man on Mon Jun 09, 2014 6:08 am

So, why use a batch file at all? Why not just write to a text file that you then copy in? The effort saved isn't worth doing something so strange, especially since it's not gonna work for some people.
avatar
Zergling_man

Posts : 341
Join date : 2011-09-11
Age : 25
Location : Wandering somewhere through cyberspace, probably

Back to top Go down

Re: Easy save.....

Post  psxlover on Mon Jun 09, 2014 11:40 am

Cause I prefer running a batch file instead of opening a txt file filled with gibberish. Also the fact that some people may use macs does not mean that it shouldn't be included. You are free to use a text editor to read it.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Sworddragon on Wed Aug 27, 2014 11:32 pm

From vague remembering of the another thread: What is with the idea to use simple commands like "-save filename" and "-load filename"? It would solve the filename/overwriting issue and even be easier to handle for the user than to run a batch file. Or does the game not allow to read the saved files?

Sworddragon

Posts : 30
Join date : 2012-08-15

Back to top Go down

Re: Easy save.....

Post  psxlover on Thu Aug 28, 2014 6:30 pm

Sworddragon wrote:From vague remembering of the another thread: What is with the idea to use simple commands like "-save filename" and "-load filename"? It would solve the filename/overwriting issue and even be easier to handle for the user than to run a batch file. Or does the game not allow to read the saved files?
The game does not even allow saving, it's only thanks to a bug that we can have access to the disk. Loading would cause a desync since the other players wouldn't have the save file on their PC's.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Sworddragon on Thu Aug 28, 2014 6:51 pm

psxlover wrote:The game does not even allow saving, it's only thanks to a bug that we can have access to the disk.

I remember this from the other thread too and that there was even the fear that this could be patched in the future. But there is already so many time gone since the last patch that I would assume Waecraft 3 has already passed its EOL (end of life) and that we will not see a patch anymore.


psxlover wrote:Loading would cause a desync since the other players wouldn't have the save file on their PC's.

So if a player loads this will be done on the other clients too? Is there no way to avoid this somehow?

Sworddragon

Posts : 30
Join date : 2012-08-15

Back to top Go down

Re: Easy save.....

Post  psxlover on Thu Aug 28, 2014 7:11 pm

Sworddragon wrote:
psxlover wrote:Loading would cause a desync since the other players wouldn't have the save file on their PC's.

So if a player loads this will be done on the other clients too? Is there no way to avoid this somehow?
Not exactly. If a player load the same SHOULD be done on the other clients, else the player gets desynced (in his game he is a lvl 80 archer while the other clients still see a lvl 1 chemist). Since there is no reliable way to send the other players the save code there is no way to load directly from a file on multiplayer.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Sworddragon on Fri Aug 29, 2014 6:28 am

Ah, this means if on a current version of the map a player loads his code on the chat the other clents will be internally notified about the code to calculate the changes on the player? I'm not trusted with the map editor but is it possible to automatically send over the chat? Maybe the "-load filename" could than simply wrap to the current loading command. Well, even if this would not be possible too I would not be surprised if there would be some way to achieve a working "-load filename" command.

Sworddragon

Posts : 30
Join date : 2012-08-15

Back to top Go down

Re: Easy save.....

Post  psxlover on Fri Aug 29, 2014 12:36 pm

Sworddragon wrote:Ah, this means if on a current version of the map a player loads his code on the chat the other clents will be internally notified about the code to calculate the changes on the player? I'm not trusted with the map editor but is it possible to automatically send over the chat? Maybe the "-load filename" could than simply wrap to the current loading command. Well, even if this would not be possible too I would not be surprised if there would be some way to achieve a working "-load filename" command.
The chat message goes to all the clients so each one of them has the load code and executes the load function at the same time.
Unfortunately like I said there is no reliable way to send data from one client to another. There was an effort on a library that could send data but the speed was really slow requiring several minutes for small data to synchronize and having other problems too.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Sworddragon on Fri Aug 29, 2014 6:26 pm

Ok, so the current state is:


  • -SLNG will save to a file.
  • If fixed it will only be saved for the player who requested the command.
  • The filename will be a minimum of the level of all characters.
  • Loading must still be done more or less manually (but even with manually copying to clipboard its more or less simple).


Or am I wrong with something? if not I would enhance this a little if possible:


  • Maybe a new command should be used for saving to keep backward compatibility with -SLNG and to not annoy users who don't want to have things saved due to a bug.
  • Can commands easily take arguments? if yes maybe there could be an optional argument given which allows the user to choose a filename.
  • With such a saving system the precision of the saves could maybe be enhanced (things you couldn't save because it wouldn't lenghten the code more and more. But this isn't so important anymore with this system (except copying too long texts to the chat doesn't work too)).
  • If possible (and not already done) the saving system could check if a file could be successfully written and show a warning if not.

Sworddragon

Posts : 30
Join date : 2012-08-15

Back to top Go down

Re: Easy save.....

Post  psxlover on Fri Aug 29, 2014 6:53 pm

Sworddragon wrote:Ok, so the current state is:

  • Maybe a new command should be used for saving to keep backward compatibility with -SLNG and to not annoy users who don't want to have things saved due to a bug.
  • Can commands easily take arguments? if yes maybe there could be an optional argument given which allows the user to choose a filename.
  • With such a saving system the precision of the saves could maybe be enhanced (things you couldn't save because it wouldn't lenghten the code more and more. But this isn't so important anymore with this system (except copying too long texts to the chat doesn't work too)).
  • If possible (and not already done) the saving system could check if a file could be successfully written and show a warning if not.


  • No need for a new command, plus -SLNG is going to be removed anyway. "to not annoy users who don't want to have things saved due to a bug" what do you mean by that?
  • Yes it's possible.
  • Yes.
  • Like I said warcraft doesn't even let you save on a file, let alone inform you if saving was successful or not, so it's not possible.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Sworddragon on Fri Aug 29, 2014 11:19 pm

psxlover wrote:"to not annoy users who don't want to have things saved due to a bug" what do you mean by that?

Just the thought that some people maybe don't like that a map can only save with storing something to their disk due to a bug.

Sworddragon

Posts : 30
Join date : 2012-08-15

Back to top Go down

Re: Easy save.....

Post  shadowvzs on Sat Sep 06, 2014 10:28 pm

Sworddragon wrote:
psxlover wrote:Loading would cause a desync since the other players wouldn't have the save file on their PC's.

So if a player loads this will be done on the other clients too? Is there no way to avoid this somehow?

loading the file could desync but saveing code locally into file is safe, according hiveworkshop.
(for expert vjassers also was figured out how to avoid the desync and use autoload but that very complicated Very Happy)

if GetLocalPlayer() == GetTriggerPlayer() then
call PreloadGenClear()
call PreloadGenStart()
call Preload("Code: -Load " + CODE + "\r\n\n\t\t ")
call PreloadGenEnd("SaveLoadTestForORPG\\" + GetUnitName(u) + " - " + I2S(LEVEL) + ".txt")
endif

shadowvzs

Posts : 27
Join date : 2011-10-16

Back to top Go down

Re: Easy save.....

Post  psxlover on Sat Sep 06, 2014 10:32 pm

Actually syncing the save is not that hard if you know what to do. I made a test map during the summer and it seems to sync the code just fine over the lan. Dunno if going through the internet could cause any problems though.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Sworddragon on Thu Sep 25, 2014 1:07 am

Probably this should be tested then.

Sworddragon

Posts : 30
Join date : 2012-08-15

Back to top Go down

Re: Easy save.....

Post  shadowvzs on Tue Sep 30, 2014 5:54 am

Sworddragon wrote:Probably this should be tested then.
you can test if u got somebody

http://www.hiveworkshop.com/forums/spells-569/save-load-codes-1-24-a-257261/?prev=search%3Dsaveload%26d%3Dlist%26r%3D20

shadowvzs

Posts : 27
Join date : 2011-10-16

Back to top Go down

Re: Easy save.....

Post  psxlover on Tue Sep 30, 2014 12:38 pm

We are talking about loading directly from the disk.
avatar
psxlover

Posts : 217
Join date : 2011-09-09
Age : 29
Location : Greece

Back to top Go down

Re: Easy save.....

Post  Kesa_ on Sat Oct 11, 2014 6:54 pm


Not exactly. If a player load the same SHOULD be done on the other clients, else the player gets desynced (in his game he is a lvl 80 archer while the other clients still see a lvl 1 chemist). Since there is no reliable way to send the other players the save code there is no way to load directly from a file on multiplayer.

this is just base on my current understanding of this problem
1-get the save code from the file and store it into a string parameter let say temp.
2-preload this string for every player so they'll have the temp.txt on their drive.
3-proceed the automatic load using this temp.txt
4-now preload blank string save it into temp.txt too, so other players can't see that save code.

(edit) that's it we can't do load automatically
avatar
Kesa_

Posts : 23
Join date : 2014-03-29

Back to top Go down

Re: Easy save.....

Post  Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum