Codeless Save and Load (Multiplayer) - v3.0.1

This bundle is marked as approved. It works and satisfies the submission rules.
Information

If you've ever wanted to transfer progress between multiplayer maps, you probably needed to type in a long code.

That is no longer needed with this system. This will allow you to read save data from your WC3 folder and sync it to all other players in the map.

The demo map features:
  1. Load without typing anything
  2. Save Hero
    • Level/XP
    • Items
    • Abilities
    • Hero Name

  3. 5 Save Slots
* Everything is customizable and you can make the system save & load anything you want.

* This system is intended for GUI users.

Installation

To import the system, all you have to do is copy the trigger folders over to your map and save it.

Screenshots


untitled5-png.241496

untitled3-png.241494

untitled4-png.241495

113935-913340d9135dcfb50a7ac3b3dff3e424.png



Credits

Pipedream (optimal save system)
Previews
Contents

Codeless Save & Load v1.3.9 (Map)

Codeless Save & Load v3.0.1 (Map)

Reviews
Awaiting further review
Level 17
Joined
Jun 26, 2020
Messages
1,370
Hello I have a question, this system has problem with multi-instance W3? because I wanted to test map that use this system in multiplayer, but I can't play with others so I opted with myself, but it didn't work properly, so I wanna know if it was my fault or the system is not made for that, and my system is too complex to check it out.
 
Level 3
Joined
Sep 28, 2018
Messages
28
spent nearly a days worth of time trying to get this working in a simple test environment. our intention is to use the -save/-load or rather the write/read to add a nice update an old old rpg. we're able to get the save working but can't (burning with pure frustration, hard to type rn) for goodness sakes cannot simply get the loaded code to spit out. Call Save/Call Load are trigs we were toiling in. trust me i know it looks like almost nothing was done and also trust me that tons of code was added/cut/commented/etc/etc/etc/etc/etc. needless to say dying trying to reinvent the wheel. someone anyone please help. many thanks in advance
 

Attachments

  • thisIsATest.w3x
    169.1 KB · Views: 3
Level 17
Joined
Jun 26, 2020
Messages
1,370
spent nearly a days worth of time trying to get this working in a simple test environment. our intention is to use the -save/-load or rather the write/read to add a nice update an old old rpg. we're able to get the save working but can't (burning with pure frustration, hard to type rn) for goodness sakes cannot simply get the loaded code to spit out. Call Save/Call Load are trigs we were toiling in. trust me i know it looks like almost nothing was done and also trust me that tons of code was added/cut/commented/etc/etc/etc/etc/etc. needless to say dying trying to reinvent the wheel. someone anyone please help. many thanks in advance
What are you trying to do? Because your message is a bit confusing.
 
Level 3
Joined
Sep 28, 2018
Messages
28
What are you trying to do? Because your message is a bit confusing.
read in the saved code as a string. Save is working. Dont need load to do anything more then read a saved code from the file that save is able to successfully create so we can access the saved code as a string.
 
Level 17
Joined
Jun 26, 2020
Messages
1,370
read in the saved code as a string. Save is working. Dont need load to do anything more then read a saved code from the file that save is able to successfully create so we can access the saved code as a string.
  • Custom script: set udg_SaveTempInt = Savecode.create()
  • For each (Integer A) from 0 to SaveCount, do (Actions)
    • Loop - Actions
      • Custom script: call Savecode(udg_SaveTempInt).Encode(udg_SaveValue[bj_forLoopAIndex], udg_SaveMaxValue[bj_forLoopAIndex])
  • Set VariableSet SaveTempString = <Empty String>
  • Custom script: set udg_SaveTempString = Savecode(udg_SaveTempInt).Save(GetTriggerPlayer(), 1)
  • Custom script: call SaveFile.create(GetTriggerPlayer(), SaveHelper.GetUnitTitle(udg_SaveTempUnit), -1, udg_SaveTempString)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SaveShowCode Equal to True
    • Then - Actions
      • Custom script: set udg_SaveCodeColored = Savecode_colorize(udg_SaveTempString)
      • Game - Display to (All players) the text: SaveCodeColored
    • Else - Actions
I have understood the code is obtained with the function Savecode.Save and then is saved with the function SaveFile.create
 
Level 3
Joined
Sep 28, 2018
Messages
28
  • Custom script: set udg_SaveTempInt = Savecode.create()
  • For each (Integer A) from 0 to SaveCount, do (Actions)
    • Loop - Actions
      • Custom script: call Savecode(udg_SaveTempInt).Encode(udg_SaveValue[bj_forLoopAIndex], udg_SaveMaxValue[bj_forLoopAIndex])
  • Set VariableSet SaveTempString = <Empty String>
  • Custom script: set udg_SaveTempString = Savecode(udg_SaveTempInt).Save(GetTriggerPlayer(), 1)
  • Custom script: call SaveFile.create(GetTriggerPlayer(), SaveHelper.GetUnitTitle(udg_SaveTempUnit), -1, udg_SaveTempString)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SaveShowCode Equal to True
    • Then - Actions
      • Custom script: set udg_SaveCodeColored = Savecode_colorize(udg_SaveTempString)
      • Game - Display to (All players) the text: SaveCodeColored
    • Else - Actions
I have understood the code is obtained with the function Savecode.Save and then is saved with the function SaveFile.create

We tried .save and it's returning something vastly different then what's in the save file. Please see sample and type -save and then -load to view the stored cored (you'll see a lengthy code [path- CustomMapData/CodelessDemo]). When using -load (which utilizes the .save method) we are receiving back "g%" not the code stored in the save file. Also thank you for your swift responses. Much appreciated.
 

Attachments

  • thisIsATest.w3x
    169.2 KB · Views: 0
Last edited:
Level 17
Joined
Jun 26, 2020
Messages
1,370
We tried .save and it's returning something vastly different then what's in the save file. Please see sample and type -save and then -load to view the stored cored (you'll see a lengthy code [path- CustomMapData/CodelessDemo]). When using -load (which utilizes the .save method) we are receiving back "g%" not the code stored in the save file. Also thank you for your swift responses. Much appreciated.
The main problem is you messed up a bit the configuration.
For example here:
  • Call Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as An exact match
    • Conditions
    • Actions
      • -------- ------------------- --------
      • -------- Validate --------
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempInt = integer(Savecode.create())
      • Custom script: if not (Savecode(udg_SaveTempInt).Load(udg_SaveLoadEvent_Player, udg_SaveLoadEvent_Code, 1)) then
      • Game - Display to (Player group(SaveLoadEvent_Player)) the text: Invalid load code (...
      • Skip remaining actions
      • Custom script: endif
      • Custom script: call DisplayTextToForce( GetPlayersAll(), Savecode(udg_SaveTempInt).ToString() )
      • Custom script: call DisplayTextToForce( GetPlayersAll(), SaveCode_ReadSlot(GetTriggerPlayer(),-1) )
      • Custom script: call DisplayTextToForce( GetPlayersAll(), ReadSaveSlot(GetTriggerPlayer(),1))
The SaveLoadEvent_Code is only obtainable with the "SaveLoadEvent equals to 1.00" if you look in the SaveHelper
vJASS:
private function LoadSaveSlot_OnLoad takes nothing returns nothing
    local player p = GetTriggerPlayer()
    local string prefix = BlzGetTriggerSyncPrefix()
    local string data = BlzGetTriggerSyncData()
    local User user = User[p]
    
    call SaveHelper.SetUserLoading(user, false)
    
    if (udg_SaveUseGUI) then
        set udg_SaveLoadEvent_Code = data
        set udg_SaveLoadEvent_Player = p
        set udg_SaveLoadEvent = 1.
        set udg_SaveLoadEvent = -1
    endif
endfunction
My recommendation is redoing everything.
 
Level 3
Joined
Sep 28, 2018
Messages
28
The main problem is you messed up a bit the configuration.

...

My recommendation is redoing everything.

Tried setting all those flags. In fact in the Codeless Save and Load folder there's a file named 'Save Init' which has been setting all the flags for us already.

If you'll allow us to start from the beginning perhaps we may be able to describe what we are trying to do better.

  • Call Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- ------------------- --------
      • -------- Save to disk --------
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempString = "auiri0ouk9qtvulenxsvoehydiuo4cvsdaiwystx2rgffbdssb"
      • Custom script: call SaveFile.create(GetTriggerPlayer(), "-load ", 1, udg_SaveTempString)
      • // params: Player, string title, integer slot, string save code

A few short lines of code is all that's needed to successfully write a players save code to CustomMapData.

We aren't using TriggerHappy's system to generate a code. The old map we are seeking to update already has a code generation system implemented. No code generation/encoding/decoding/obfuscating required on our part.

What we would like to do is simply add the File.IO used in this library into an old map to act as a middle man. Successfully doing this effectively allows anyone to add automatic saving & loading into any rpg with pre-existing code generation, we believe.

Thus to summarize our current goal is simply to figure out how to read in the save code from the file that the above save trigger is writing to CustomMapData.

*edit: Perhaps foolish in assuming this yet it's still hard to imagine what we're trying to accomplish (reading a simple string in from users disk) is more difficult then writing the save code string to disk.
 
Level 3
Joined
Sep 28, 2018
Messages
28
I was dealing with this system a lot, so maybe I could grant that tutorial.
That'd be helpful! Messaged TriggerHappy themselves regarding a reduced/simplified library which doesn't include any code generation aspects rather simply just the read/write functionality with simple parameters to enable less experienced devs the ability to add codeless saving/loading into older maps that already have a code generation system in place (i.e. fldrName to save to, fileName to save file as, saveCode string to be saved, integer slot [optional param] for maps that would benefit from multiple save files).
 
Last edited:
Top