• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Saving and loading

Status
Not open for further replies.
Level 13
Joined
Jun 3, 2011
Messages
1,058
Hi guys i want to ask where can i get a save and load system that saves the code in my war3 directory thanks how and not the save and load with snippets i duno how to use it thanks :)
 
In order to get save/load with snippets working, you need to cnp the libraries that you are going to use.

At the top of the demo is a list of resources that it uses (library names). You have to go to the various triggers that contain those libraries and cnp them into the target map.

I believe, if I organized it correctly, that most, if not all of the required resources are in 1 folder. The optional ones (some of them used by the demo) are in a separate folder.

Once you get that down, you are set =).

However, given that you are having a difficult time porting it over, I believe that you are going to find catalog design very, very difficult >.<.

Rather than give up and have people give you AceHart's with a SaveHDD function, you should ask what resources are required for the demo, and then ask about catalog design and so on. No, I wasn't willing to go through and list out all of the resources required, that woulda been a waste of my time >.<.

You also need to be experienced in vJASS to use it. The only super user friendly GUI systems atm is Acehart's. One that is very GUI friendly in use but not in installation is the codeless save/load one :\.

What are you going to get in Acehart's save/load system?

Saved values will be split up, making the code longer and less secure
Code will have no hash, any hash will be split off and will be weak (code data validation)
Code will have no encryption (code mix up)
Code will have no CRC (code length validation)
Code will not be player unique unless the player's name is stored in the code, which makes it longer

save/load with snippets features
knuth checksum hash (1 in x codes valid)
scrambler encryption (player unique, splices digits into random fractions and mixes them together)
constant crc (1 added to beginning of code)
merging values (minimal code)

codeless save/load features
MD5 cryptographic hash (player unique)
AES 128-bit encryption (player unique, layered with bounds protection)
bitwise (fast, values at bit level, not perfectly merged though so slight bloat)
 
Level 13
Joined
Jun 3, 2011
Messages
1,058
In order to get save/load with snippets working, you need to cnp the libraries that you are going to use.

At the top of the demo is a list of resources that it uses (library names). You have to go to the various triggers that contain those libraries and cnp them into the target map.

I believe, if I organized it correctly, that most, if not all of the required resources are in 1 folder. The optional ones (some of them used by the demo) are in a separate folder.

Once you get that down, you are set =).

However, given that you are having a difficult time porting it over, I believe that you are going to find catalog design very, very difficult >.<.

Rather than give up and have people give you AceHart's with a SaveHDD function, you should ask what resources are required for the demo, and then ask about catalog design and so on. No, I wasn't willing to go through and list out all of the resources required, that woulda been a waste of my time >.<.

You also need to be experienced in vJASS to use it. The only super user friendly GUI systems atm is Acehart's. One that is very GUI friendly in use but not in installation is the codeless save/load one :\.

What are you going to get in Acehart's save/load system?

Saved values will be split up, making the code longer and less secure
Code will have no hash, any hash will be split off and will be weak (code data validation)
Code will have no encryption (code mix up)
Code will have no CRC (code length validation)
Code will not be player unique unless the player's name is stored in the code, which makes it longer

save/load with snippets features
knuth checksum hash
scrambler encryption (player unique)
constant crc
merging values

codeless save/load features
MD5 (player unique)
AES (player unique, layered with bounds protection)
bitwise (fast, values at bit level, not perfectly merged though so slight bloat)

uhmmm okay, but first where can i find the system that creates the folder in war3 directory?
 
The SaveCodeToHD thing is just a function. Save/Load With Snippets is not a system, it is a collection of systems and functions that make save/load easier. SaveCodeToHD is one such function. I think it just takes a string, but it might take a BigInt.

But yea, File IO is the full blown system for reading/writing files.

edit
You want full blown File IO or a simple write function? Save/Load With Snippets, like I said, is just a collection of functions to aid in save/load : |. The demo uses a lot of those functions, it is not a system >.<.

This is one such library from the map.

function SaveCodeToHD takes string mapname, string mapver, integer playerId, string filename, string saveCode returns nothing

JASS:
library SaveCodeToHD
    globals
        private string array playerName
        private boolean isGameOnline
    endglobals
    private function WriteLine takes string line returns nothing
        call Preload("\")\r\n\t\t"+ line +"\r\n\t//(\"")
    endfunction
    constant function GetSaveGameFolder takes nothing returns string
        return "Savegames"
    endfunction
    function SaveCodeToHD takes string mapname, string mapver, integer playerId, string filename, string saveCode returns nothing
        local string onlineFolder = ""
        if (isGameOnline) then
            set onlineFolder = "Online"
        else
            set onlineFolder = "Offline"
        endif
        
        call PreloadGenClear()
        call PreloadGenStart()
        call WriteLine("-load "+saveCode)
        call PreloadGenEnd(GetSaveGameFolder()+"\\"+mapname+"\\v"+mapver+"\\"+playerName[playerId]+"\\"+onlineFolder+"\\"+filename+".txt")
    endfunction
    private module Init
        private static method onInit takes nothing returns nothing
            local integer i = 11
            loop
                set playerName[i] = GetPlayerName(Player(i))
                exitwhen 0 == i
                set i = i - 1
            endloop
            
            set isGameOnline = not ReloadGameCachesFromDisk()
        endmethod
    endmodule
    private struct InitS extends array
        implement Init
    endstruct
endlibrary

So you could literally do
call SaveCodeToHD("my map name", "version of map", playerId, "file name of file (hero name?)", "this-isac-ode")


Save/Load with Snippets is essentially a giant pack of snippets that can be used to make a save/load system, hence the name "Save/Load with Snippets" lol.
 
Level 13
Joined
Jun 3, 2011
Messages
1,058
The SaveCodeToHD thing is just a function. Save/Load With Snippets is not a system, it is a collection of systems and functions that make save/load easier. SaveCodeToHD is one such function. I think it just takes a string, but it might take a BigInt.

But yea, File IO is the full blown system for reading/writing files.

edit
You want full blown File IO or a simple write function? Save/Load With Snippets, like I said, is just a collection of functions to aid in save/load : |. The demo uses a lot of those functions, it is not a system >.<.

This is one such library from the map.

function SaveCodeToHD takes string mapname, string mapver, integer playerId, string filename, string saveCode returns nothing

JASS:
library SaveCodeToHD
    globals
        private string array playerName
        private boolean isGameOnline
    endglobals
    private function WriteLine takes string line returns nothing
        call Preload("\")\r\n\t\t"+ line +"\r\n\t//(\"")
    endfunction
    constant function GetSaveGameFolder takes nothing returns string
        return "Savegames"
    endfunction
    function SaveCodeToHD takes string mapname, string mapver, integer playerId, string filename, string saveCode returns nothing
        local string onlineFolder = ""
        if (isGameOnline) then
            set onlineFolder = "Online"
        else
            set onlineFolder = "Offline"
        endif
        
        call PreloadGenClear()
        call PreloadGenStart()
        call WriteLine("-load "+saveCode)
        call PreloadGenEnd(GetSaveGameFolder()+"\\"+mapname+"\\v"+mapver+"\\"+playerName[playerId]+"\\"+onlineFolder+"\\"+filename+".txt")
    endfunction
    private module Init
        private static method onInit takes nothing returns nothing
            local integer i = 11
            loop
                set playerName[i] = GetPlayerName(Player(i))
                exitwhen 0 == i
                set i = i - 1
            endloop
            
            set isGameOnline = not ReloadGameCachesFromDisk()
        endmethod
    endmodule
    private struct InitS extends array
        implement Init
    endstruct
endlibrary

So you could literally do
call SaveCodeToHD("my map name", "version of map", playerId, "file name of file (hero name?)", "this-isac-ode")


Save/Load with Snippets is essentially a giant pack of snippets that can be used to make a save/load system, hence the name "Save/Load with Snippets" lol.

i can change the savegames right?
 
Level 13
Joined
Jun 3, 2011
Messages
1,058
JASS:
function SaveCodeToHD takes string mapname, string mapver, integer playerId, string filename, string saveCode returns nothing
so i can change the one above with this?

JASS:
call SaveCodeToHD("my map name", "version of map", playerId, "file name of file (hero name?)", "this-isac-ode")
or should i add it somewhere else in the SaveCodeToHD
 
Lol, if you use this as is

call SaveCodeToHD("my map name", "version of map", playerId, "file name of file (hero name?)", "this-isac-ode")

It will not work : )

You have to change the values.

edit
You also need to put it into a local block

edit
Did you mean edit the SaveCodeToHD library to the above line? No, don't edit the library at all, don't touch it, lol.

I take it you don't know what a function is ; p
 
Level 13
Joined
Jun 3, 2011
Messages
1,058
JASS:
call SaveCodeToHD("Symphony ORPG", "v0.1", playerId, "wait a sec.... how can i like make this as the hero name or the player name?", "this-isac-ode what should i leave this?")
 
playerId is just the player that you are saving for. So if you are saving for red, u'd pass in 0.

For getting the hero name, GetUnitName

For code, you'd pass in the save code you made for the user. So you can output that save code and you can also pass it into that function.

output code
save code to hard drive

If you leave it as it is, then you are not saving the player's code, but rather the this-isac-ode thing :p.

edit
player id already makes it player unique, so don't use the player's name, unless u only want them to have a max of 1 hero.
 
nop, lol

You need to have experience with JASS to use this =)

Drop the v also in version, it's added inside of the function.

Right now you are saving a file called

(GetUnitName).txt

with code

saveCode

in folder

Symphony ORPG/vv0.1/undefined

that last one, undefined, meaning that ur map won't even save, because playerId isn't defined anywhere


Those are all literal values, not magically replaced with something.
 
Status
Not open for further replies.
Top