Making a save code at the end of a game

LoveTD's

New Member
Reaction score
34
hey all, I'm having a big problem with aceharts save/load code... What I try to do is: create a save code when the game ends instead of having to type -save everytime to save your code... Now my problem is:
whenever I try to show a code without having to type -save the code is invalid for some reason... here is the trigger I used to create the save codes at the end of the game:

Trigger:
  • My game is ending
    • Events
      • My game ends <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" />
    • Conditions
    • Actions
      • Set Save[1] = Total_Score_of_player[1]
      • Set Save[2] = double_kills_player[1]
      • Set Save[3] = triple_kills_player[1]
      • Set Save[4] = overkills_player[1]
      • Set Save[5] = killtaculars_player[1]
      • Set Save[6] = killtrocitys_player[1]
      • Set Save[7] = killinmanjaros_player[1]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 1 (Red) for 60.00 seconds the text: Code
      • Set Save[1] = Total_Score_of_player[2]
      • Set Save[2] = double_kills_player[2]
      • Set Save[3] = triple_kills_player[2]
      • Set Save[4] = overkills_player[2]
      • Set Save[5] = killtaculars_player[2]
      • Set Save[6] = killtrocitys_player[2]
      • Set Save[7] = killinmanjaros_player[2]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 2 (Blue) for 60.00 seconds the text: Code
      • Set Save[1] = Total_Score_of_player[3]
      • Set Save[1] = Total_Score_of_player[3]
      • Set Save[2] = double_kills_player[3]
      • Set Save[3] = triple_kills_player[3]
      • Set Save[4] = overkills_player[3]
      • Set Save[5] = killtaculars_player[3]
      • Set Save[6] = killtrocitys_player[3]
      • Set Save[7] = killinmanjaros_player[3]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 3 (Teal) for 60.00 seconds the text: Code
      • Set Save[2] = double_kills_player[4]
      • Set Save[3] = triple_kills_player[4]
      • Set Save[4] = overkills_player[4]
      • Set Save[5] = killtaculars_player[4]
      • Set Save[6] = killtrocitys_player[4]
      • Set Save[7] = killinmanjaros_player[4]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 4 (Purple) for 60.00 seconds the text: Code
      • Set Save[2] = double_kills_player[5]
      • Set Save[3] = triple_kills_player[5]
      • Set Save[4] = overkills_player[5]
      • Set Save[5] = killtaculars_player[5]
      • Set Save[6] = killtrocitys_player[5]
      • Set Save[7] = killinmanjaros_player[5]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 5 (Yellow) for 60.00 seconds the text: Code
      • Set Save[1] = Total_Score_of_player[6]
      • Set Save[2] = double_kills_player[6]
      • Set Save[3] = triple_kills_player[6]
      • Set Save[4] = overkills_player[6]
      • Set Save[5] = killtaculars_player[6]
      • Set Save[6] = killtrocitys_player[6]
      • Set Save[7] = killinmanjaros_player[6]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 6 (Orange) for 60.00 seconds the text: Code
      • Set Save[1] = Total_Score_of_player[7]
      • Set Save[2] = double_kills_player[7]
      • Set Save[3] = triple_kills_player[7]
      • Set Save[4] = overkills_player[7]
      • Set Save[5] = killtaculars_player[7]
      • Set Save[6] = killtrocitys_player[7]
      • Set Save[7] = killinmanjaros_player[7]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 7 (Green) for 60.00 seconds the text: Code
      • Set Save[1] = Total_Score_of_player[8]
      • Set Save[1] = Total_Score_of_player[8]
      • Set Save[2] = double_kills_player[8]
      • Set Save[3] = triple_kills_player[8]
      • Set Save[4] = overkills_player[8]
      • Set Save[5] = killtaculars_player[8]
      • Set Save[6] = killtrocitys_player[8]
      • Set Save[7] = killinmanjaros_player[8]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 8 (Pink) for 60.00 seconds the text: Code
      • Set Save[2] = double_kills_player[9]
      • Set Save[3] = triple_kills_player[9]
      • Set Save[4] = overkills_player[9]
      • Set Save[5] = killtaculars_player[9]
      • Set Save[6] = killtrocitys_player[9]
      • Set Save[7] = killinmanjaros_player[9]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 9 (Gray) for 60.00 seconds the text: Code
      • Set Save[2] = double_kills_player[10]
      • Set Save[3] = triple_kills_player[10]
      • Set Save[4] = overkills_player[10]
      • Set Save[5] = killtaculars_player[10]
      • Set Save[6] = killtrocitys_player[10]
      • Set Save[7] = killinmanjaros_player[10]
      • Set SaveCount = 7
      • Custom script: set udg_Code = SaveLoad_Encode()
      • Game - Display to Player Group - Player 10 (Light Blue) for 60.00 seconds the text: Code


the load trigger I used:

Trigger:
  • SaveLoad Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
      • Player - Player 9 (Gray) types a chat message containing -load as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -load as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
      • (Length of (Entered chat string)) Greater than 6
    • Actions
      • -------- Try to decode what was typed --------
      • Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
      • Custom script: set udg_Validate = SaveLoad_Decode( udg_Code )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Validate Equal to True
        • Then - Actions
          • For each (Integer A) from 1 to SaveCount, do (Actions)
            • Loop - Actions
              • Set Total_Score_of_player[(Integer A)] = Save[1]
              • Set double_kills_player[(Integer A)] = Save[2]
              • Set triple_kills_player[(Integer A)] = Save[3]
              • Set overkills_player[(Integer A)] = Save[4]
              • Set killtaculars_player[(Integer A)] = Save[5]
              • Set killtrocitys_player[(Integer A)] = Save[6]
              • Set killinmanjaros_player[(Integer A)] = Save[7]
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: Invalid Code!


So the problem is that whenever I want to load my code it shows that it is an invalid code....

Now whenever I used this trigger it worked perfectly:
Trigger:
  • SaveLoad Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
      • Player - Player 9 (Gray) types a chat message containing -save as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- Those values need saving --------
      • Set Save[1] = Total_Score_of_player[(Player number of (Triggering player))]
      • Set Save[2] = double_kills_player[(Player number of (Triggering player))]
      • Set Save[3] = triple_kills_player[(Player number of (Triggering player))]
      • Set Save[4] = overkills_player[(Player number of (Triggering player))]
      • Set Save[5] = killtaculars_player[(Player number of (Triggering player))]
      • Set Save[6] = killtrocitys_player[(Player number of (Triggering player))]
      • Set Save[7] = killinmanjaros_player[(Player number of (Triggering player))]
      • Set Save[8] = killtastrophes_player[(Player number of (Triggering player))]
      • Set Save[9] = killpocalypses_player[(Player number of (Triggering player))]
      • Set Save[10] = killionaires_player[(Player number of (Triggering player))]
      • -------- The number of values we have --------
      • Set SaveCount = 10
      • -------- Turn values into code --------
      • Custom script: set udg_Code = SaveLoad_Encode()
      • -------- Show code to player --------
      • Quest - Display to (Player group((Triggering player))) the Secret message: Your code:
      • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code


but thats not what i want to accomplish... If someone can help me out on this he/she definitly deserves my rep and gratitude!
 

Executor

I see you
Reaction score
57
Trigger:
  • SaveLoad Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
      • Player - Player 9 (Gray) types a chat message containing -load as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -load as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
      • (Length of (Entered chat string)) Greater than 6
    • Actions
      • -------- Try to decode what was typed --------
      • Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
      • Custom script: set udg_Validate = SaveLoad_Decode( udg_Code )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Validate Equal to True
        • Then - Actions
          • For each (Integer A) from 1 to SaveCount, do (Actions)
            • Loop - Actions
              • Set Total_Score_of_player[(Integer A)] = Save[1]
              • Set double_kills_player[(Integer A)] = Save[2]
              • Set triple_kills_player[(Integer A)] = Save[3]
              • Set overkills_player[(Integer A)] = Save[4]
              • Set killtaculars_player[(Integer A)] = Save[5]
              • Set killtrocitys_player[(Integer A)] = Save[6]
              • Set killinmanjaros_player[(Integer A)] = Save[7]
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: Invalid Code!


I don't know the system and I don't now how to use it I just able to conclude:

SaveLoad_Decode( udg_Code ) stores the loaded values in the array "Save".
These loaded values belong to the "Triggering Player". So I think you must delete this loop and only transfer the values from "Save" in the array of the "Triggering Player".

In my opinion "SaveCount" specifies the upper bound of the save array and not sth. like PlayerCount.
You should also check in your load condition whether SaveCount equals the number of values u stored.
 

LoveTD's

New Member
Reaction score
34
as I said before, the save and load trigger works fine, the problem is:
I cant seem to show a text message with the save code without having someone to type -save...

as you can see this is exactly the same:

Trigger:
  • Set Save[1] = Total_Score_of_player[1]
    • Set Save[2] = double_kills_player[1]
    • Set Save[3] = triple_kills_player[1]
    • Set Save[4] = overkills_player[1]
    • Set Save[5] = killtaculars_player[1]
    • Set Save[6] = killtrocitys_player[1]
    • Set Save[7] = killinmanjaros_player[1]
    • Set SaveCount = 7
    • Custom script: set udg_Code = SaveLoad_Encode()
    • Game - Display to Player Group - Player 1 (Red) for 60.00 seconds the text: Code


as this (but for some reason only this works...):
Trigger:
  • Set Save[1] = Total_Score_of_player[(Player number of (Triggering player))]
    • Set Save[2] = double_kills_player[(Player number of (Triggering player))]
    • Set Save[3] = triple_kills_player[(Player number of (Triggering player))]
    • Set Save[4] = overkills_player[(Player number of (Triggering player))]
    • Set Save[5] = killtaculars_player[(Player number of (Triggering player))]
    • Set Save[6] = killtrocitys_player[(Player number of (Triggering player))]
    • Set Save[7] = killinmanjaros_player[(Player number of (Triggering player))]
    • Set SaveCount = 7
    • Custom script: set udg_Code = SaveLoad_Encode()
    • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code


edit: also... As you can see I made a lot of mistakes in the end game trigger... But that doesn't matter since I was just testing if it worked for player 1...

Hmmm... I think I found the solution... In the jass script made by acehart he has a part that is like this:

JASS:
function SaveLoad_EncodeVerify takes string buffer returns integer
    local integer i = 0
    local integer j = 0
    local string name = GetPlayerName(GetTriggerPlayer())
    if udg_SaveLoad_UsePlayername == true then
        loop
            set j = j + SaveLoad_EncodeChar(SubString(name,i,i + 1))
            set i = i + 1
            exitwhen i &gt;= StringLength(name)
        endloop
    endif
    set i = 0
    loop
        set j = j + SaveLoad_EncodeChar(SubString(buffer,i,i + 1))
        set i = i + 1
        exitwhen i &gt;= StringLength(buffer)
    endloop
    return j
endfunction


maybe this part has to do something with validating the code ;)
local string name = GetPlayerName(GetTriggerPlayer())
it searches for a triggering player ><....
anyone knows how to change this in jass ^^?
should I use GetLocalPlayer? and if so, how do I make it so that it recognizes the name for all players?

EDIT: tryed it and fixed it :D
script:
JASS:
function SaveLoad_EncodeVerify takes string buffer returns integer
    local integer i = 0
    local integer j = 0
    local string name = GetPlayerName(GetLocalPlayer())
    if udg_SaveLoad_UsePlayername == true then
        loop
            set j = j + SaveLoad_EncodeChar(SubString(name,i,i + 1))
            set i = i + 1
            exitwhen i &gt;= StringLength(name)
        endloop
    endif
    set i = 0
    loop
        set j = j + SaveLoad_EncodeChar(SubString(buffer,i,i + 1))
        set i = i + 1
        exitwhen i &gt;= StringLength(buffer)
    endloop
    return j
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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