• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Save/Load System Error

Status
Not open for further replies.
Level 11
Joined
Mar 30, 2008
Messages
666
Cheers!
I have problems with save/load system.
When I want to save the map I had these errors:
  • set udg_keybuffer[GetForLoopIndexA()] = udg_keybuffer_default[GetForLoopIndexA()]
  • set udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)] = bxor( udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)], B642I(SubStringBJ(udg_s, GetForLoopIndexA() + 1, GetForLoopIndexA() + 1)), 6 )
  • set udg_buf[GetForLoopIndexA()] = bxor( udg_buf[GetForLoopIndexA()], udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)], 6 )
  • set udg_buf[GetForLoopIndexA()] = bxor( udg_buf[GetForLoopIndexA()], udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)], 6 )
  • SystemToolsCryptKeyInit
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 0 to (keybuffer_size - 1), do (Actions)
        • Loop - Actions
          • Set keybuffer[(Integer A)] = keybuffer_default[(Integer A)]
      • For each (Integer A) from 0 to ((Length of s) - 1), do (Actions)
        • Loop - Actions
          • Custom script: set udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)] = bxor( udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)], B642I(SubStringBJ(udg_s, GetForLoopIndexA() + 1, GetForLoopIndexA() + 1)), 6 )
  • SystemToolsCrypt
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 0 to (Size - 1), do (Actions)
        • Loop - Actions
          • Custom script: set udg_buf[GetForLoopIndexA()] = bxor( udg_buf[GetForLoopIndexA()], udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)], 6 )
  • SystemToolsDecrypt
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 0 to (Size - 1), do (Actions)
        • Loop - Actions
          • Custom script: set udg_buf[GetForLoopIndexA()] = bxor( udg_buf[GetForLoopIndexA()], udg_keybuffer[ModuloInteger(GetForLoopIndexA(), udg_keybuffer_size)], 6 )
I have following texts in Custom Script Code:
JASS:
function B642I takes string s returns integer
    local integer idx = StringLength(s)
    local integer val = 0
    local integer mul = 0
    local integer i
    local string ch
    loop
        exitwhen idx < 1
        set ch = SubStringBJ(s, idx, idx)
        set i = 0
        loop
            exitwhen (i > StringLength(udg_base) - 1)
            if ( ch == udg_basearr[i] ) then
                set val = val + i * R2I(Pow(I2R(StringLength(udg_base)), I2R(mul)))
                set mul = mul + 1
            else
            endif
            set i = i + 1
        endloop	
        set idx = idx - 1
    endloop
    return val
endfunction

function I2B64F takes integer i, integer digits returns string
    local integer val = 0
    local integer pass = 6
    local string str = ""
    local boolean start = false
    loop
        exitwhen pass < 0
        set val = i / R2I(Pow(I2R(StringLength(udg_base)), I2R(pass)))
		if (val>0 or start or pass<digits) then
		    set str = str + udg_basearr[val]
		    set i = i - val * R2I(Pow(I2R(StringLength(udg_base)), I2R(pass)))
		    set start = true
        else
		endif
        set pass = pass - 1
    endloop
    return str
endfunction

function I2B64 takes integer i returns string
    return I2B64F(i,0)
endfunction

function I2CB64 takes integer i returns string
    return udg_basearr[i]
endfunction

function CodeParseString takes string str returns nothing
    local integer idx = 1
    local integer i
    local string ch

    loop
        exitwhen idx > StringLength(str)
        set ch = SubStringBJ(str, idx, idx)
        set i = 0
        loop
            exitwhen ( ( i > StringLength(udg_base) - 1 ) or ( ch == udg_basearr[i] )  )
            set i = i + 1
        endloop
        set udg_buf[idx-1] = i
        set idx = idx + 1
    endloop
endfunction

function GetStringChecksum takes string str, integer size, integer key returns string
    local integer idx = 1
    local integer val = 0
    local integer tmp
    local integer pass
    local string s = ""
    local integer i
    local string ch

    loop
        exitwhen idx > StringLength(str)
        set ch = SubStringBJ(str, idx, idx)
        set i = 0
        loop
            exitwhen ( ( i > StringLength(udg_base) - 1 ) or ( ch == udg_basearr[i] )  )
            set i = i + 1
        endloop
        set val = ModuloInteger(val * StringLength(udg_base) + i, key)
        set idx = idx + 1
    endloop

    set pass = size - 1
    set idx = 0
    loop
        exitwhen pass < 0
        set tmp = udg_power2[6*pass]
        set s = s + I2CB64( udg_base_size - 1 - val / tmp )
	set val = val - val / tmp * tmp
        set idx = idx + 1
        set pass = pass - 1
    endloop

    return s
endfunction

function CodeAddChecksum takes integer size, integer crc_keysize, integer crc_key returns integer
    local integer val = 0
    local integer tmp = 0
    local integer idx = 1
    local integer pass = 0

    set idx = 0
    loop
        exitwhen idx == crc_keysize
        set udg_buf[size+idx] = udg_base_size-1
        set idx = idx + 1
    endloop

    set val = 0
    set idx = 0
    loop
        exitwhen idx >= size+crc_keysize
        set val = ModuloInteger(val * udg_base_size + udg_buf[idx], crc_key)
        set idx = idx + 1
    endloop

    set pass = crc_keysize - 1
    set idx = size
    loop
        exitwhen pass < 0
        set tmp = udg_power2[6*pass]
        set udg_buf[idx]= udg_buf[idx] - val / tmp
	set val = val - val / tmp * tmp
        set idx = idx + 1
        set pass = pass - 1
    endloop

    return crc_keysize
endfunction

function CodeGetChecksum takes integer size, integer crc_keysize, integer crc_key returns integer
    local integer val = 0
    local integer idx = 0

    loop
        exitwhen idx >= size
        set val = ModuloInteger(val * udg_base_size + udg_buf[idx], crc_key)
        set idx = idx + 1
    endloop

    return val
endfunction

function bnot takes integer val, integer bits returns integer
    local integer idx = bits - 1
    local integer res = 0

    loop
        exitwhen idx < 0

        if ( val / udg_power2[idx] == 0 ) then
            set res = res + udg_power2[idx]
        else
            set val = val - val / udg_power2[idx] * udg_power2[idx]
        endif        

        set idx = idx - 1
    endloop

    return res
endfunction

function bxor takes integer v1, integer v2, integer bits returns integer
    local integer idx = bits - 1
    local integer res = 0
    local integer a
    local integer b

    loop
        exitwhen idx < 0

        set a = v1 / udg_power2[idx]
        set b = v2 / udg_power2[idx]

        if ( a != b ) then
            set res = res + udg_power2[idx]
        else
        endif        
        set v1 = v1 - a * udg_power2[idx]
        set v2 = v2 - b * udg_power2[idx]

        set idx = idx - 1
     endloop

    return res
endfunction

function bor takes integer v1, integer v2, integer bits returns integer
    local integer idx = bits - 1
    local integer res = 0
    local integer a
    local integer b

    loop
        exitwhen idx < 0
        set a = v1 / udg_power2[idx]
        set b = v2 / udg_power2[idx]


        if ( a == 1  ) then
            set res = res + udg_power2[idx]
            set v1 = v1 - udg_power2[idx]
            set v2 = v2 - b * udg_power2[idx]
        else
            if ( b == 1  ) then
                set res = res + udg_power2[idx]
                set v2 = v2 - udg_power2[idx]
            else
            endif
        endif        


        set idx = idx - 1
     endloop

    return res
endfunction

function band takes integer v1, integer v2, integer bits returns integer
    local integer idx = bits - 1
    local integer res = 0
    local integer a
    local integer b

    loop
        exitwhen idx < 0
        set a = v1 / udg_power2[idx]
        set b = v2 / udg_power2[idx]


        if ( a == 1  ) then
            set v1 = v1 - udg_power2[idx]
            if ( b == 1  ) then
                set res = res + udg_power2[idx]
                set v2 = v2 - udg_power2[idx]
            else
            endif
        else
            set v2 = v2 - b * udg_power2[idx]
        endif        


        set idx = idx - 1
     endloop

    return res
endfunction

function bshl takes integer val, integer arg returns integer
    set val = val * udg_power2[arg]
    return val
endfunction

function bshr takes integer val, integer arg returns integer
    set val = val / udg_power2[arg]
    return val
endfunction
System can be found here Save/Load System
Can somebody help me?
 
Last edited:
Status
Not open for further replies.
Top