Save/Load Code, Yet Another

TDestroyer

New Member
Reaction score
0
OK i figured it out, i was picking up items in a (integer A loop), and i had another (integer A loop) running when items where picked up. So they interfered with each other. All i had to do was make some of the loops B loops and now it works.
 

LoveTD's

New Member
Reaction score
34
I wanted to add collours to the lower case alphabetic characters and this is what I've came up with:

JASS:

function SaveLoad_Color takes string s returns string
    local integer i = StringLength(s)
    local string c
    local string r = ""

    loop
        set i = i - 1
        set c = SubString(s,i,i + 1)
        if c == "0" or c == "1" or c == "2" or c == "3" or c == "4" or c == "5" or c == "6" or c == "7" or c == "8" or c == "9" then
            set r = "|cffffcc00" + c + "|r" + r
        elseif c == "-" then
            set r = "|cffdddddd-|r" + r
        elseif c == "a" or c == "b" or c == "c" or c == "d" or c == "e" or c == "f" or c == "g" or c == "h" or c == "i" or c == "j" or c == "k" or c == "l" or c == "m" or c == "n" or c == "o" or c == "p" or c == "q" or c == "r" c == "s" or c == "t" or c == "u" or c == "v" or c == "w" or c == "x" or c == "y" or c == "z" then
            set r = "|c0000ff80" + c + "|r" + r
        else
            set r = c + r
        endif
        exitwhen i <= 0
    endloop
    return r
endfunction


the problem is: I get 3 compile errors:

Expected expression @:
JASS:
        elseif c == "a" or c == "b" or c == "c" or c == "d" or c == "e" or c == "f" or c == "g" or c == "h" or c == "i" or c == "j" or c == "k" or c == "l" or c == "m" or c == "n" or c == "o" or c == "p" or c == "q" or c == "r" c == "s" or c == "t" or c == "u" or c == "v" or c == "w" or c == "x" or c == "y" or c == "z" then


Expected 'endif" @:
JASS:
else


Expected 'endif" @:
JASS:
endif


can someone help me out on this?
 

No_exit

Regular User (What is Custom User Title?)
Reaction score
40
@ LoveTD's: You forgot an or between
c == "r" c == "s"
Fixed:
JASS:
elseif c == "a" or c == "b" or c == "c" or c == "d" or c == "e" or c == "f" or c == "g" or c == "h" or c == "i" or c == "j" or c == "k" or c == "l" or c == "m" or c == "n" or c == "o" or c == "p" or c == "q" or c == "r" or c == "s" or c == "t" or c == "u" or c == "v" or c == "w" or c == "x" or c == "y" or c == "z" then


That will probably fix all error messages.
 

Leazy

You can change this now in User CP.
Reaction score
50
This is the first time I take time to look into a save/load code, god damn smart way how you did it man, and it's mad easy to implement! GJ & +rep

Edit: I might have been a little too enthusiastic (not saying it's great though) but how do I add so it also saves ability levels? I understood everything but this line:

Code:
Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )

What should I replace that with if I'm storing ability levels?

Thanks in advance
 

Leazy

You can change this now in User CP.
Reaction score
50
Owe, that's what I tried first, I dunno why I changed it though... it's easier than I thought. Thanks!
 

LoveTD's

New Member
Reaction score
34
I have another question on this system:

is it possible to make a code whenever the game ends instead of typing
-save? There won't be a lot of leavers this way ;)

I tryed this:

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


but this didnt work... When I tryed loading this code it said that its an invalid code :(
(didn't loop it since I wanted to see if it works first.. And it didnt :()
 

Bitterstone

New Member
Reaction score
1
Gold & Lumber

I tried this out and i'm afraid this is way too advanced for me even though i've been programming and used the Warcraft Editor for many many years, though i've never ever created a single Custom Script so I don't get any of that. :banghead:

Well, my problem is, I can't seem to get Gold and Lumber to be saved and loaded properly in the "Save Load Hero with items" section. It's probably really easy once you get the hang of it but I just can't get it right.
 

xXGauntletXx

New Member
Reaction score
4
Even if he did, I'm sure there are others here that can help with it, like Romek or andrewgosu.

Anyway this code is working perfectly for me.
 

Lmfaocj

Active Member
Reaction score
1
Lol, Thank you for the code.... This is the first code that ever worked for me... And it's so easy to learn how to edit it to how you want it.
but the only thing that i am having trouble with is the abilities.
 

Lmfaocj

Active Member
Reaction score
1
Trigger:
  • Set AATempInteger = SaveCount
    • Set SaveCount = 1


Trigger:
  • Do Multiple ActionsFor each (Integer SaveCount) from (SaveCount + 1) to AATempInteger, do (Actions)
    • Loop - Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to Save[(SaveCount + 1)], do (Actions)
        • Loop - Actions
          • Custom script: call SelectHeroSkill( GetLastCreatedUnit(), udg_SaveLoad_Abilities[ udg_Save[ udg_SaveCount ] ] )
      • Set SaveCount = (SaveCount + 1)

How does that work?
 

tonton302

Member
Reaction score
0
When i tried to use this save system in my map i saved thn tried to load and it wuld only load the item in slot 1. tried to fix bout 3 times and it never worked...

does any1 no wats wrong?

thanks
 

Animoi666

New Member
Reaction score
0
When i tried to use this save system in my map i saved thn tried to load and it wuld only load the item in slot 1. tried to fix bout 3 times and it never worked...

does any1 no wats wrong?

thanks

-bump-


i got the Exact same problem, haven't managed to solve it yet.
Ace, could you help?
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
guys, seriously =.= stop posting help things here.
POST IN THE DAMN HELP SECTION!

When it's posted there We'll probably help. sorry for being so blunt.. but if you read the responses i wouldn't have had to post this :/

~And btw, ace is gone. has been :/ for a looong time. Though i think he still hangs out and watches from some random account as to whats going on >.>
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top