Save/Load Code, Yet Another

Arkan

Nobody rides for free
Reaction score
92
Yeah I thought the code would have to be alot longer before difficulties would appear.

Anyway, I'm not very good at compression and stuff, can you further elaborate what you mean with:

Code:
value5 * 10000 + value4 * 1ooo [COLOR="Red"](surely you mean 0's (zeroes)??)[/COLOR]+ value3 * 100 + value2 * 10 + value1

and how I would split it up into 5 different values again after loading?

let's say value1= 1
value2= 3
value3= 0
value4= 4
value5= 2

then (2*10000) + (4*1000) + (0*100) + (3*10) + 1 = 24031

save compressed integer 24031 (would save 2 letters right?)

load value1= ?
value2= ?
value3= ?
value4= ?
value5= ?

Your help is much appreciated.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Set TempInteger = 12345
Set Value4 = TempInteger / 10 // 1234
Set Value5 = TempInteger - 10 * Value4 // 5
Set Value3 = Value4 / 10 // 123
Set Value4 = Value4 - 10 * Value3 // 4
Set Value2 = Value3 / 10 // 12
Set Value 3 = Value3 - 10 * Value2 // 3
Set Value1 = Value2 / 10 // 1
Set Value2 = Value2 - 10 * Value1 // 2
 

Arkan

Nobody rides for free
Reaction score
92
Thanks.
Now I'm gotta compress the shit out my integers and then we'll see if I can squeesh the code length below critical length.
 

Arkan

Nobody rides for free
Reaction score
92
Gah, I thought I understood this, it worked for the 5 integers with values between 0 and 4, but how would I do it with 5 integers with values between 0 and 500?

It didn't work using the previous method.

Also, what you said:

Code:
> 2 integers (values between 0 and 300)

Same here.
value[COLOR="Red"]2[/COLOR] * 1000 + value1

That doesn't make any sense to me, I guess it's * 1000 instead of * 10 cause the value can hold 3 digits instead of 1, I suck at math :/
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> I guess it's * 1000 instead of * 10 cause the value can hold 3 digits

Good guess.

The "split" works just the same though, only with lots more 1000s than 10s.


Set TempInteger = 123456
Set Value2 = TempInteger / 1000 // 123
Set Value1 = TempInteger - 1000 * Value2 // 456


> 5 integers with values between 0 and 500?

That doesn't fit into just one integer... two will do though.

Set Value1 = 789 // example values to store
Set Value2 = 456
Set Value3 = 123

Set TempInteger = Value3 * 1000000 + Value2 * 1000 + Value1 // 123456789 (this will be saved)

Set Value2 = TempInteger / 1000 // 123456
Set Value1 = TempInteger - 1000 * Value2 // 789
Set Value3 = Value2 / 1000 // 123
Set Value2 = Value2 - 1000 * Value3 // 456
 

Arkan

Nobody rides for free
Reaction score
92
Alright, but it seems to me addition would save no space in this case:

Code:
Set TempInteger = Value3 * 1000000 + Value2 * 1000 + Value1 // 123456789 (this will be saved)
Wouldn't 123456789 take up 6 letters? (with base of 36, 36^6) So it would be pointless, or am I wrong here?

Also compressing 2 integer values (0-500) would result in a number around the 100000 digits, thus requiring 4 letters anyway (36*4).

The reason for not adding more than 3 (0-500) integers is because the wc3 engine can't handle that big numbers?

If I include lowercase letters, would the base increase to 62? Cause in that case the compression would work here as I can see it.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Wouldn't 123456789 take up 6 letters?

Asuming it does, it would easily beat 3 * 6.

Though, the code isn't generated number by number.
The entire Save array is being considered as one huge number in base 11 and converted to base 36.

With the exception of the first couple "digits" and the last, it's impossible to know what values ends up in what character position of the final code.


Example for easier "getting it": saving the values 123, 456 and 789.
The code is not 'encode("123") + encode("456") + encode("789")'.
Instead, the code is 'encode("123-456-789")', all in one go.
 

Nestharus

o-o
Reaction score
84
Acehart, just one question on like security.

So, what if someone were able to crack the code with the name checker and so forth. I've seen people do it, heh, with a name checker and many security variables because the code never changed for their tests ^)^

I'm just trying to prevent these "serious intense" cheaters from figuring it out, heh ^_^

So, when looking at the security features in that sense, would it be more secure to make it impossible to test out adding gold, removing gold, leveling and so forth? : )

Plus I added in another variable that will add the gold, lumber, level, and ability account of the player and divide it all by 10,000 then add the remainder. It'll save this value into the code under a savecount. When you load it up, it adds up all your stuff and gets the value of the load code you entered, then it checks it against the variable, so in the case that you did change something, meaning you are purposefully cheating, it'll corrupt your save code so that when you try to load it up later, it'll just kick you out.

So, I'm just trying to say

254,016 combinations for the exact same thing will make it impossible to do tests for those insane cheaters out there

A security variable for anti-cheats in case they manage to change a value like their level, their stats, and so forth will make it impossible for them to load up their code. It won't tell them they can't load it up until the second load, sort of a stealth anti-cheat system. Usually, people will delete their older codes, so in this way, they lose all of their information. It'll also tell the host that they are cheaters and will suggest to the host to add them to a banlist.

So, tell me your side of why it doesn't really add any more security. I've seen those intense cheaters that always have 1 mil gold and 1 mil lumber, maxed level, and so forth every time they load. They've been able to crack some crazy codes.

It only adds 4 extra characters, 1 for the sequence so that even if the encryption changes, they won't know what's what, 1 for the encryption for more confusion, and 1 for the anti cheat variable.

The sequencing is probably one of the most secure things you can do as they'll never figure out what characters represent the gold, what represents the lumber, and so forth, heh.

Give me your feed-back k, I just like to know why. When you just say, well, it doesn't really do much, it's already secure enuf with the name check, I mean, heh. I know it's secure with name check and so on, but according to how I've been looking at it, it'll be impossible for cheaters to crack secure.

Also, remember, I'm also working on a system to maximimze the encryption pool (array size) with all the different possibilities that way you don't have to type them all out. It'll do it for sequencing too.

But yea, just give me your feedback kk
 
C

cliffhan61

Guest
How to solve this prob

eerm i copied over the triggers and create the cariables myself. However they JASS code has some errors that occurred with almost every trigger. IT says eg. Line 162: Expected a name. How do you solve this? and i am bad with JASS. Thanks in advance.
 
B

basil

Guest
hmmm

:banghead: set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
keeps popping up every time i try to enable the save load codes
i edited them a little used my own custom spells and units and put all the things into varibles but when i try to enable them a message pops up saying this....

expected a name
and a couple more pop up like non arrays index i dont know what to do mabye you could help me.......:D
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
How to import:

Menu: File / Preferences,
check "auto-create unknown variables".

Open the save/load map, open the trigger editor:
Right-click the trigger category you want (the yellow titles), select "copy".

Open your own map (menu: file / open):
open the trigger editor if you aren't there already, and click the "paste" button (toolbar at the top).

Switch back to the save/load map (menu: Window):
Click the map's name at the very top of the trigger list.
See all of that weird text there?

Select it all, use "copy".

Switch maps one more time, and paste it in the same place on your map.

Done.
 
B

basil

Guest
i copied all that....

:confused: was there any varibles that were soposed to be arrays????

i added my own custom heros and abilities and items and it keeps bringing up this error


expected a name line 461: set r = r * 64 + udg_SaveLoad_Compress
and some other ones...

was i not sopposed to make the varribles myself? i think that messed up some things....

thanks for helping earlier it got me less problems to deal with:D
 
B

basil

Guest
I started over

I used your map made it the epic size because I messed up on some of the varibles on my map I will give credit for code. I deleted all the units and made it into a new map with your trigger thanks. Even though i will have to start over I will still benifit with a save code, and this time im gana make it better.
:D
It will now be known as the denied:resurection
and instead of having the hero arena type of chosing heros i have made a tavern. So thanks.
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
One question... so i added the lowercase alphabet

Code:
Set SaveLoad_Alphabet = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

but i noticed in warcraft the capital i and lowercase L look alike, and also that you color coded the numbers from the letters. Is there a way to color code the capitals and lowercase too?

I don't know any jass (well i can kind of know what's going on).

I think it has to do with this part

Code:
        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
        else
            set r = c + r
        endif
        exitwhen i <= 0
    endloop
    return r
endfunction
(since it has color codes) but i don't know what to edit...

Also, one more question. Do you know what causes "code wipes"?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
If you added lower-case letters, you also remembered to set the "case sensitive" flag to true?
If you didn't, it won't decode correctly.

Actually, do you really need that?
IIRC, you "only" want to save a single value...


For the color coding, replace
JASS:
else
    set r = c + r
endif

with
JASS:
elseif StringCase(c,false) == c then
    set r = &quot;|cffffdead&quot; + c + &quot;|r&quot; + r
else
    set r = c + r
endif



> Do you know what causes "code wipes"?

Perhaps.
Though I'd first have to know what a code wipe is...
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
Yeah i did set the case sensitive to true.

And a code wipe is when people can't use codes from a previous map version.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> can't use codes from a previous map version

The simplest way to get that is to change the alphabet.
If "map 1" used "abc", have "map 2" use "bca" or so.
The decoder will fail...


If you wondered why a code wouldn't work from one version to the next... well, the IDs of units or items have probably changed.
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
Oh ok, thank you very much :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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