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.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top