System The Shortest Save/Load Code Ever

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
> Kode produces, as far as I know of, the shortest codes for any save/load system.
> It wastes *zero* space when saving normal integers because they have an arbitrary maximum size.

That's open to debate.


> Other code systems, such as AceHart's system don't do this

You have some backup for that claim?
While I admit that I haven't read the source code for your code system, I have read the tutorial/manual for it which outlines its usage. The way it works gives the user the freedom of not specifying a maximum value for integers added to the code in their script but rather have it guessed automatically by the system, right? Because of that, the code that the player gets must contain information specifying the size of the integers in it as opposed to the save/load functions statically providing that data as in Kode. As I outlined before, I designed Kode to save integers in the minimum possible way short of compression. I have yet to find another system that operates in the same manner.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> the code that the player gets must contain information specifying the size of the integers

Not really.
A Hero level, for example, of 3 will need less than 1 character, whereas level 50 will need nearly 2.
There's not much of a point to artificial limits.
 
Reaction score
341
You never answered my question :(

if anyone can answer plz do

Ok , so i am trying to use this in my map and i get a couple errors.

First , Whenever i try 2 save 6 items my it loads none of em , but when i save 5 items it loads all of them

Second , whenever i get past lvl 11 it only loads up to level 11.

Third , when i save a hero and load it , it gives me an entire different hero (even though the saved hero is in the hero array )
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
You never answered my question :(

if anyone can answer plz do

I can only help you if you post your code. Without that information, it's impossible for me to show you what's wrong.

You might consider using AceHart's system, though, as it's quite a bit simpler to use than Kode.
 
Reaction score
341
I just download the map. dont modify it at ALL. i just downlload > open > test ..



Ive tried the JASS/GUI Versions of the latest versions
 
Reaction score
341
Bump


Anyone gotta answer to my question?

lol Korolean , acehart?



EDIT: ok... now im gettin more errors that make no sense . if i change one thing in the save code i get like 5 errors. heres my code

JASS:
function get_hero_type_index takes integer t returns integer

    local integer i = 0

    loop

        exitwhen i >= 4

        if udg_Demo_Hero_Types<i> == t then

            return i

        endif

        set i = i + 1

    endloop

    return -1

endfunction



function get_item_type_index takes integer t returns integer

    local integer i = 0

    loop

        exitwhen i &gt;= udg_Demo_Item_Types_Length

        if udg_Demo_Item_Types<i> == t then

            return i

        endif

        set i = i + 1

    endloop

    return -1

endfunction



function save_hero takes unit u returns nothing

    local integer i = 0

    local integer item_count = 0

    local item m

    local integer t = get_hero_type_index(GetUnitTypeId(u))

    

    call clear_bits()

    

    set i = 0

    loop

        exitwhen i &gt;= 6
        set m = udg_RealSavingItems[( ( GetConvertedPlayerId(GetTriggerPlayer()) * 50 ) + i )]  
    call DisplayTextToForce( GetPlayersAll(), GetItemName(udg_SavingItems[( ( GetConvertedPlayerId(GetTriggerPlayer()) * 20 ) + i )]) )      
        if m != null then

            call push_int(get_item_type_index(GetItemTypeId(m)), udg_Demo_Item_Types_Length)

            set item_count = item_count + 1

        endif

        set i = i + 1

    endloop

    call push_int(item_count, 6)

    

    set i = 0

    loop

        exitwhen i &gt;= 3

        call push_int(GetHeroStatBJ(i, u, false), 60)

        set i = i + 1

    endloop

    



function Trig_Save_Hero_Actions takes nothing returns nothing

    local group g = GetUnitsSelectedAll(Player(0))

    local unit u

    if CountUnitsInGroup(g) == 1 then

        set u = FirstOfGroup(g)

        if IsUnitType(u, UNIT_TYPE_HERO) then

            call save_hero(u)

            call RemoveUnit(u)

            call BJDebugMsg(format_code(create_code(GetTriggerPlayer(), 10), 4))

        endif

        set u = null

    endif

    call DestroyGroup(g)

    set g = null

endfunction



//===========================================================================

function InitTrig_Save_Hero takes nothing returns nothing

    set gg_trg_Save_Hero = CreateTrigger()

    call TriggerRegisterPlayerChatEvent(gg_trg_Save_Hero, Player(0), &quot;-savehero&quot;, true)

    call TriggerAddAction(gg_trg_Save_Hero, function Trig_Save_Hero_Actions)

endfunction



</i></i>
 

Bird

Ultra Cool Member
Reaction score
29
"Security is simple but effective. After the code has been generated, a customizable number of 0s are appended to the bits that make up the code. Then, the bits are is encrypted using the player's name as a key."

Does this mean that you have to be online using the same Blizzard acct name to keep using your character?

So, for someone to steal your Character, they would have to witness your code, and then go to a different Blizzard server, register your acct name, and load the code?

Is this accurate?
 
P

Psychopath

Guest
Hello.

Will this save/load system be able to save your account name? Then others wont be able to steal the code and use it.

And can you do something like: "-saveall" to save everything instead of "-savehero, -savenum, etc"?

Thanks in advance.
 

dannyboydude

Ultra Cool Member
Reaction score
33
i dont have much knoledge in jass but
if you dont have much knoledge just use AceHarts save/load
easy to add / change things
i added quite a few things and its gui friendly
 

cleeezzz

The Undead Ranger.
Reaction score
268
followed the example but its not even showing the code =/

JASS:
scope SaveStats initializer Init

private function Actions takes nothing returns nothing
    local string s
    local player p = GetTriggerPlayer()
    call clear_bits()
    call BJDebugMsg(&quot;hi&quot;)
    call push_progressive_int(TKills[GetPlayerId(p)], 10, 6)
    call BJDebugMsg(&quot;hi&quot;)
    call push_progressive_int(TDeaths[GetPlayerId(p)], 10, 6)
    call BJDebugMsg(&quot;hi&quot;)  //shows this HI and does not show any messages below this line
    set s = create_code(p,5)
     call BJDebugMsg(&quot;hi&quot;)
    set s = format_code(s, 3)
    call BJDebugMsg(&quot;hi&quot;)
    call BJDebugMsg(s)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( trig, Player(0), &quot;-save&quot;, true )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope


tkills and tdeaths are set to 50 and 60 for test purposes

(also, how do i "pop" these 2 integers out? i dont get it)
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
followed the example but its not even showing the code =/

JASS:
scope SaveStats initializer Init

private function Actions takes nothing returns nothing
    local string s
    local player p = GetTriggerPlayer()
    call clear_bits()
    call BJDebugMsg(&quot;hi&quot;)
    call push_progressive_int(TKills[GetPlayerId(p)], 10, 6)
    call BJDebugMsg(&quot;hi&quot;)
    call push_progressive_int(TDeaths[GetPlayerId(p)], 10, 6)
    call BJDebugMsg(&quot;hi&quot;)  //shows this HI and does not show any messages below this line
    set s = create_code(p,5)
     call BJDebugMsg(&quot;hi&quot;)
    set s = format_code(s, 3)
    call BJDebugMsg(&quot;hi&quot;)
    call BJDebugMsg(s)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( trig, Player(0), &quot;-save&quot;, true )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope


tkills and tdeaths are set to 50 and 60 for test purposes

(also, how do i "pop" these 2 integers out? i dont get it)

My guess is that you forgot to set Kode_Charmap and Kode_Security in the Variable Editor. When you copy the trigger out of the Kode distribution map, the WE doesn't copy the default values for the variables, just the variables themselves.

Aside from that, I'd have to get more information to see what's causing the thread to crash. A war3err report or a copy of your map and I'd be able to help you further :)
 
Reaction score
341
This save/load has bugs , i tried saving 5 items , and they all loaded , i tried saving *6* items and none of them loaded. Note this was in the demo map when i had modified nothing.
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
This save/load has bugs , i tried saving 5 items , and they all loaded , i tried saving *6* items and none of them loaded. Note this was in the demo map when i had modified nothing.

I'm very interested in any bugs you can find in Kode. This sounds like a bug in the demo map, but I'd be happy to take a look. Exactly what steps did you follow for this to happen? By the way, the demo only works with a couple of items so if you created anything else, it will most likely brake the code.
 

cleeezzz

The Undead Ranger.
Reaction score
268
ahh missed that instruction =/ sorry.

i dont understand how to pop the integer out though, what if the limit is both 10^6?

edit: nvm, doesn't matter, just pop it out reverse order. thanks

(btw imma use it in my map if you dont mind, ill give credits)
 

Prediter[BuB

Well-Known Member
Reaction score
35
Wait could I use this to make a campaign map and a hero and make a copy of that map and change terrain would the save system work between the two maps?
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
Wait could I use this to make a campaign map and a hero and make a copy of that map and change terrain would the save system work between the two maps?

A code is not specific to a map, but rather to a loading and saving procedure, which, of course, could be the same between multiple maps.
 

cleeezzz

The Undead Ranger.
Reaction score
268
hey i have a serious problem, it seems that your system somehow affects GetRandomInt. In one certain function, it always returns 5, but after deleting the kode system, it returns 1 through 6 randomly. have any idea why?
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
hey i have a serious problem, it seems that your system somehow affects GetRandomInt. In one certain function, it always returns 5, but after deleting the kode system, it returns 1 through 6 randomly. have any idea why?

Yeah... I guess a side effect of loading/saving a code is that the random number generator would always be set to a predictable value.

Just generate a random number before using a Kode function that seeds the generator, and after you're done with Kode, re-seed the generator with the original number you generated.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      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