HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

One of those WTF problems..?

08-18-2007, 02:45 AM#1
Artemis101
Well i am in the process of trying to integrate a Save/Load system into my map.. and i cant seem to find any real cause to this serious problem that is occurring..
Description:
One aspect of the Save/Load code is to save a integer equal to a set of heroes levels. When i go into the game to test the Save/Load part, the unused heroes that are placed elsewhere in the map keep reseting their levels to 1 (even if i change them to something else) when i type in -save (which triggers the save trigger). Nothing in the trigger, or the Save system uses a SetHeroLevel function. This is what I have done so far to try and isolate the problem..
Created a game display function after each time the system saves a variable to the 'end' code, and when it was set up somthing like this...

Set Variable1 = Hero Level of Hero 1
call SaveInteger (Variable 1, save part 1, code 1)
Set Variable1 = Hero Level of Hero 2
call SaveInteger (Variable 1, savepart 2, code 1)

and so on for all heroes
What it did was display the FIRST hero level as the correct integer, but the rest were 1 (even though the hero was not level 1)
I then assumed it was the call SaveInteger function (Yes i created it, dont tell me stuff like it doesnt exist). To check that i did the following thing..
Set IntVariable 1 = Hero Level of Hero 1
Set IntVariable 2 = Hero Level of Hero 2
(so on for all heroes)
Set Variable1 = IntVariable 1
call SaveInteger (Variable 1, save part 1, code 1)
Set Variable1 = IntVariable 2
call SaveInteger (Variable1, save part 1, code 1)

That saves the hero levels to variables before running the SaveInteger function.. and behold it actually saved the correct values placed, but to my dismay, the hero levels were set to 1.

I know you will most likely need to see the script and what not, all the triggers used and that crap, if so, just post that you need to and ill make sure you attain a copy. Although i would prefer if someone could figure it out without having to see the script.
08-18-2007, 12:17 PM#2
Vexorian
post the whole trigger
08-18-2007, 05:38 PM#3
botanic
yes pleases post the trigger. One thing tho make shure that you dont have a problem with numbers under 10 ie you might have to set 9 = 09 as a sting
08-18-2007, 08:42 PM#4
Artemis101
Meh.. i sent Vex a PM with the script and triggers.. but w/e, heres the stuff..

The system that the Save/Load is based off of..
Collapse JASS:
//_______//
//  Init //
//_______//

function ASLinit takes nothing returns nothing
    local integer a = 1
    local integer b = 1
    local string c = ""
    // SETTINGS Start
    // MaxSaves - How many saves you can save to a single code.
        set udg_SL_MaxSaves = 100
    // CharSet - All the characters used in the codes are derived from this set.
        set udg_SL_CharSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz$#"     
        // Note : You can't use % in the CharSet. The CharSet must be at least 32 chars long.
        // Default : ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz$#
    // CharSpec - Special characters. I'm reserving this for planned features.
        set udg_SL_CharSpec = "@?&! _"
        // Note : You can't use % in the CharSpec. The CharSpec is not used at the moment.
        // Default : @?&! _
    // COLORS - Enter the Color Code and then the character which this color starts at. Unlimited amount.
    set udg_SL_Color[1] = "16D116" // Default : 00E700 (green)
    set udg_SL_ColorStart[1] = "A"
    set udg_SL_Color[2] = "E6E700" // Default : E6E700 (yellow)
    set udg_SL_ColorStart[2] = "1"
    set udg_SL_Color[3] = "C8C8C8" // Default : C8C8C8 (gray)
    set udg_SL_ColorStart[3] = "a"
    set udg_SL_Color[4] = "0068DE" // Default : 0068DE (light blue)
    set udg_SL_ColorStart[4] = "$"
    // Security
    set udg_SL_Random[1] = 0
    set udg_SL_Random[2] = 0
    set udg_SL_Random[3] = 0
    set udg_SL_Random[4] = 0
    set udg_SL_Random[5] = 0
    set udg_SL_Random[6] = 0
    set udg_SL_Random[7] = 0
    set udg_SL_Random[8] = 0
    set udg_SL_Random[9] = 0
    set udg_SL_Random[10] = 0
    // SETTINGS End
    // Important Stuff, don't touch. Really, dont mess with this stuff.
    set udg_SL_Use_BooStuffer = true
    set udg_SL_Use_Pimper = true
    set udg_SL_Base = 32
    set udg_SL_Base2 = 64
    set udg_SL_BinSet = "111110111001000101001101011000001111"
    set udg_SL_Q = "This map makes use of Apple's Save/Load                                                                               "
    set udg_SL_Q = udg_SL_Q + "|c0000E700HTTP://WWW.POLLAMA.COM|r"
        //set udg_SL_BinSet = "111110110011010100100010111000001111"
    set udg_SL_Chars = StringLength(udg_SL_CharSet)
    // Create Color Map
    loop
        if ( SubString(udg_SL_CharSet, a-1, a) == udg_SL_ColorStart[b] ) then
            if udg_SL_Color[b] != "" then
            set c = ("|c00" + udg_SL_Color[b])
            else
            set c = ""
            endif
            set b = b + 1
        endif
        set udg_SL_ColorChar[a] = c
        exitwhen a >= udg_SL_Chars
        set a = a + 1
    endloop
    // Powers
    set udg_SL_Max = 31
    set udg_SL_Powers[1] = 1
    set udg_SL_Powers[2] = 2
    set udg_SL_Powers[3] = 4
    set udg_SL_Powers[4] = 8
    set udg_SL_Powers[5] = 16
    set udg_SL_Powers[6] = 32
    set udg_SL_Powers[7] = 64
    set udg_SL_Powers[8] = 128
    set udg_SL_Powers[9] = 256
    set udg_SL_Powers[10] = 512
    set udg_SL_Powers[11] = 1024
    set udg_SL_Powers[12] = 2048
    set udg_SL_Powers[13] = 4096
    set udg_SL_Powers[14] = 8192
    set udg_SL_Powers[15] = 16384
    set udg_SL_Powers[16] = 32768
    set udg_SL_Powers[17] = 65536
    set udg_SL_Powers[18] = 131072
    set udg_SL_Powers[19] = 262144
    set udg_SL_Powers[20] = 524288
    set udg_SL_Powers[21] = 1048576
    set udg_SL_Powers[22] = 2097152
    set udg_SL_Powers[23] = 4194304
    set udg_SL_Powers[24] = 8388608
    set udg_SL_Powers[25] = 16777216
    set udg_SL_Powers[26] = 33554432
    set udg_SL_Powers[27] = 67108864
    set udg_SL_Powers[28] = 134217728
    set udg_SL_Powers[29] = 268435456
    set udg_SL_Powers[30] = 536870912
    set udg_SL_Powers[31] = 1000000000
//    set udg_SL_Powers[31] = 1073741824
    // Extras
    set udg_Save_Name[1] = null
    set udg_Code_Name[1] = null
endfunction

//______________//
// Core - ConV  //
//______________//


function Switch takes nothing returns nothing
    if ( udg_SL_Qb == false ) then
        call DisplayTimedTextToForce( GetPlayersAll(), 50.00, udg_SL_Q )
        set udg_SL_Qb = true
    endif
endfunction


//______________//
// Core - Save  //
//______________//


function SaveCode takes string c returns string
    local integer xi = 0
    local integer xi2 = 0
    local integer xi3 = 0
    local integer ci = 1
    local integer a = 1
    local integer a2 = 0
    local integer b = 0
    local integer b2 = 0
    local string result = ""
    local string xs = ""
    local string xs2 = ""
    set c = StringCase( c, false)
    loop
        if ( udg_Code_Name[ci] == c ) then
            exitwhen true
        else
            if ( udg_Code_Name[ci] == null ) then
                // Create Error, Code Doesn't Exist.
                return "nocode"
            else
                set ci = ci + 1
            endif
        endif
    endloop
    set a2 = udg_Code_Saves[ci]
    if ( a2 <= 0 ) then
        // No values saved for this code. Duh?
        set result = "nosaves"
        return result
    endif
    loop
        // Lets make it multi-demensional.
        set xi3 = ( a + ( udg_SL_MaxSaves * (ci - 1)))
        set xi = udg_Save_Val[xi3]
        set xi2 = udg_Save_Max[xi3]
        set b = udg_Save_Space[xi3]
        if ( udg_SL_Use_BooStuffer == true ) then

            // Start BooStuffer
            if ( xi2 <= ( udg_SL_Powers[b] - xi2 ) ) then
                if ( xs != "" ) then
                    if ( SubString( xs, 0, 1 ) == "1" ) then
                        set xi = ( xi + xi2 )
                    endif
                    set xs = SubString( xs, 1, StringLength(xs) )
                else
                    // Create opt error. xs = null.
                endif
            endif
            // End BooStuffer
        endif
        loop
            if ( xi >= udg_SL_Powers[b] ) then
                set xi = ( xi - udg_SL_Powers[b] )
                set xs = ( "1" + xs )
            else
                set xs = ( "0" + xs )
            endif
            exitwhen ( b <= 1 )
            set b = ( b - 1 )
        endloop
    exitwhen a == a2
    set a = ( a + 1 )
    endloop
    call Switch()
    set b = 1
    set xi3 = 0
    loop
        if ( StringLength(xs) < 5 ) then
            set xs2 = xs
            set xs = ""
            loop
                if ( StringLength(xs2) != 5 ) then
                    set xs2 = ( xs2 + "0" )
                    set xi3 = xi3 + 1
                else
                    exitwhen true
                endif
            endloop
        else
            set xs2 = SubString( xs, 0, 5)
            set xs = SubString( xs, 5, StringLength(xs) )        
        endif
        loop
            if ( xs2 == SubString( udg_SL_BinSet, b-1, (b+4)) ) then
                if ( udg_SL_Use_BooStuffer == true ) then
                    // Start BooStuffer
                    // If a value can be above 64, and is above 64, then extra is 1, else 0. Same goes for 32.
                    // Yes it makes sense, stop forgetting that.
                    if (b <= (udg_SL_Chars - udg_SL_Base)) then
                        if ( xs != "" ) then
                            if SubString( xs, 0, 1) == "1" then
                                set b = (b + udg_SL_Base)
                            endif
                            set xs = SubString( xs, 1, StringLength(xs))
                            if (b <= (udg_SL_Chars - udg_SL_Base2)) then
                                if ( xs != "" ) then
                                    if SubString( xs, 0, 1) == "1" then
                                        set b = (b + udg_SL_Base2)
                                    endif
                                    set xs = SubString( xs, 1, StringLength(xs))
                                else
                                    // Create Opt Error. xs was = null.
                                endif
                            endif
                        else
                            // Create Opt Error. xs was = null.
                        endif
                    endif
                    // End BooStuffer
                endif
                // Pimp My Code?
                if ( udg_SL_Use_Pimper == true ) then
                    set result = ( result + ( udg_SL_ColorChar[b] + ( SubString( udg_SL_CharSet, b-1, b ) + "|r" )) )
                else
                    set result = ( result + SubString( udg_SL_CharSet, b-1, b ) )                
                endif
                exitwhen true
            endif
            set b = ( b + 1 )
        endloop
        exitwhen ( xs == "" )
        set b = 1
        set xs2 = ""
    endloop
    if ( xi3 > 0 ) then
        // Create Opt. Error. Extra space went unused.
    endif
    return result
endfunction


//_______________________//
//      End - Save       //
//_______________________//


//______________//
// Core - Load  //
//______________//


function LoadCode takes string c, string result returns nothing
    local integer xi = 0
    local integer xi2 = 0
    local integer xi3 = 0
    local integer ci = 1
    local integer a = 1
    local integer a2 = StringLength(result)
    local integer b = 1
    local integer b2 = StringLength(udg_SL_CharSet)
    local string xs = ""
    local string xs2 = ""
    local string extra = ""
    set c = StringCase( c, false)
    loop
        if ( udg_Code_Name[ci] == c ) then
            exitwhen true
        else
            if ( udg_Code_Name[ci] == null ) then
                // Create Error, Code Doesn't Exist.
                return
            else
                set ci = ci + 1
            endif
        endif
    endloop
    if ( udg_Code_Saves[ci] <= 0 ) then
        return
    endif
    loop
        set xs2 = SubString( result, a-1, a)
        // Recreate the binary string.
        loop
            if ( xs2 == SubString( udg_SL_CharSet, b-1, b) ) then
                if ( udg_SL_Use_BooStuffer == true ) then
                    // Start BooStuffer
                    if ( udg_SL_Chars > udg_SL_Base2 ) then
                        if ( b > udg_SL_Base2 ) then
                            set extra = extra + "1"
                            set b = ( b - udg_SL_Base2 )
                        else
                            if ( b <= (udg_SL_Chars - udg_SL_Base2) ) then
                                set extra = extra + "0"
                            endif
                        endif
                    endif
                    if ( udg_SL_Chars > udg_SL_Base ) then        
                        if ( b > udg_SL_Base ) then
                            set extra = "1" + extra
                            set b = ( b - udg_SL_Base )
                        else
                            if ( b <= (udg_SL_Chars - udg_SL_Base) ) then
                                set extra = "0" + extra
                            endif
                        endif        
                    endif
                    // End BooStuffer
                endif
                set xs = ( xs + SubString( udg_SL_BinSet, b-1, (b+4)) )
                if ( extra != "" ) then
                    set xs = xs + extra
                    set extra = ""
                endif
                exitwhen true
            endif
            set b = ( b + 1 )
        endloop        
        exitwhen ( a >= a2 )
        set b = 1
        set a = a + 1
        if ( b > b2 ) then
            // Create Error. Given Character not in CharSet.
            exitwhen true
        endif
    endloop
    set a = udg_Code_Saves[ci]
    loop
        set xi3 = ( a + ( udg_SL_MaxSaves * (ci - 1)))
        set xs2 = SubString( xs, 0, udg_Save_Space[xi3] )
        set xs = SubString( xs, udg_Save_Space[xi3], StringLength(xs) )
        set xi2 = udg_Save_Max[xi3]
        set xi = 0
        set b = 1
        set b2 = StringLength(xs2)
        loop
            if SubString( xs2, b-1, b) == "1" then
                set xi = xi + udg_SL_Powers[b]
            endif
            exitwhen b >= b2
            set b = b + 1
        endloop
        if ( udg_SL_Use_BooStuffer == true ) then
            // Start BooStuffer
            if ( xi > xi2 ) then
                set xs = "1" + xs
                set xi = xi - udg_SL_Powers[b]
            else
                if ( xi <= ( udg_SL_Powers[b] - xi2 ) ) then
                    set xs = "0" + xs
                endif
            endif
            // End BooStuffer
        endif
        set udg_Load_Val[xi3] = xi - ( 1 - udg_Save_Min[xi3] )
        set udg_Load_Max[xi3] = xi2 - ( 1 - udg_Save_Min[xi3] )
        exitwhen a <= 1
        set a = a - 1
    endloop
    // Remaining xs is extra. Use it for security.
    // Security - Coming Soon
endfunction

//_______________________//
//      End - Load       //
//_______________________//

//_______________________//
// Sup - Save (Integer)  //
//_______________________//

function SaveInteger takes integer val, string name, integer min, integer max, string c returns nothing
    local integer a = 0
    local integer xi = 1
    local integer ci = 1
    set c = StringCase( c, false)
    set name = StringCase( name, false)
    loop
        if ( udg_Code_Name[ci] == c ) then
            exitwhen true
        else
            if ( udg_Code_Name[ci] == null ) then
                set udg_Code_Name[ci] = c
                exitwhen true
            else
                set ci = ci + 1
            endif
        endif
    endloop
    set a = ( 1 + (udg_SL_MaxSaves * (ci - 1)))
    if ( name == "" ) then
        // Create Error. No name was given.
        return
    endif
    loop
        if udg_Save_Name[a] == name then
            // Value already exists. Overwrite it.
            if ( max != udg_Save_Max[a] ) then
                // Create Error. Cannot save over previous max.
            endif
            if ( min != udg_Save_Min[a] ) then
                // Create Error. Cannot save over previous min.
            endif
            exitwhen true
        else
            if ( udg_Save_Name[a] == null ) then
                // Value does not exist. Lets create it.
                set udg_Save_Name[a] = name 
                set udg_Code_Saves[ci] = ModuloInteger( a, udg_SL_MaxSaves)
                // We will do the math for the max here since it can't be overwritten.
                set max = ( max + (1 - min))
                if ( max > udg_SL_Powers[udg_SL_Max] ) then
                    set max = udg_SL_Powers[udg_SL_Max]
                    // Create Error. Save was bigger then coded Max.
                else
                    if ( max < 2 ) then
                        set max = 2
                        // Create Error. Max is too small.
                    endif
                endif
                // Find Space Needed.
                loop
                exitwhen max < udg_SL_Powers[xi]
                set xi = ( xi + 1)
                if ( xi >= udg_SL_Max ) then
                    exitwhen true
                endif
                endloop
                // Save Space and Max.
                set udg_Save_Space[a] = ( xi - 1 )
                set udg_Save_Max[a] = max
                set udg_Save_Min[a] = min
                exitwhen true
            else
                // Keep looking...
                set a = a + 1        
            endif
        endif
    endloop
    if ( udg_SL_Type != 0 ) then
        set udg_Save_Type[a] = udg_SL_Type
        if ( udg_SL_Type == 2 ) then
            set udg_Save_Length[a] = udg_SL_Length
            // Sticky: Use else instead.
        endif
        set udg_SL_Type = 0
    endif
    // Do the math for the val.
    set val = ( val + (1 - min))
    set max = ( max + ( 1 - min))
    if ( val > max ) then
        set val = max
        // Create Error. Value was bigger then saved Max. May be caused by Max too big error.
    else
        if ( val < 1 ) then
            set val = 1
            // Create Error. Value was less than saved Min.
        endif
    endif
    // Save the value.
    set udg_Save_Val[a] = val
endfunction

//_______________________//
// Sup - Load (Integer)  //
//_______________________//

function LoadInteger takes string name, string c returns integer
    local integer a = 0
    local integer ci = 1
    set c = StringCase( c, false)
    set name = StringCase( name, false)
    loop
        if ( udg_Code_Name[ci] == c ) then
            exitwhen true
        else
            if ( udg_Code_Name[ci] == null ) then
                set udg_Code_Name[ci] = c
                exitwhen true
            else
                set ci = ci + 1
            endif
        endif
    endloop
    set a = ( 1 + (udg_SL_MaxSaves * (ci - 1)))
    loop
        if udg_Save_Name[a] == name then
            exitwhen true
        else
            if ( udg_Save_Name[a] == "" ) then
                    // Create Error. No such value was loaded.
                return -999
            endif
        endif
    set a = a + 1
    endloop
    if ( udg_Save_Type[a] != 0 ) then
        if ( udg_Save_Type[a] == 2 ) then
            set udg_SL_Length = udg_Save_Length[a]
            // Sticky: Use else instead.
        endif
    endif
    return udg_Load_Val[a]
endfunction

//_______________________//
// Sup - Save (Boolean)  //
//_______________________//

function SaveBoo takes boolean val, string name, string c returns nothing
    local integer x = 0
    if ( val == true ) then
        set x = 1
    endif
    call SaveInteger ( x, name, 0, 1, c )
endfunction

function LoadBoo takes string name, string c returns boolean
    local integer x = 0
    set x = LoadInteger(name, c)
    if ( x == 0 ) then
        return false
    else
        return true
    endif
endfunction
    

//_______________________//
//   Sup - Save (Real)   //
//_______________________//

function SaveReal takes real val, string name, real min, real max, integer length, string c returns nothing
    local real p = (Pow(10, length))
    set udg_SL_Type = 2
    if ( length < 1 ) then
        // Create Error. Length is too short.
    endif
    set udg_SL_Length = length
    call SaveInteger( R2I(val * p), name, R2I(min * p), R2I(max * p), c)
endfunction

function LoadReal takes string name, string c returns real
    local real r = 0.00
    local integer i = 0
    set i = LoadInteger(name, c)
    set r = i / Pow(10, udg_SL_Length)
    return r
endfunction
    

//________________________//
// Sup - Save (Unit-Type) //
//________________________//

function SaveType takes string name, string c returns nothing
    //	Requires a array of Unit-Types! Specific for Code?
endfunction

//_________________________//
// Sup - Save (Name-Check) //
//________________________//

function SaveName takes string name, string c returns nothing
    //	Saves a Name Check, not the actual name.
endfunction

Here is the save trigger...
Trigger:
NewSave
Collapse Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Player - Player 2 (Blue) types a chat message containing -save as An exact match
Player - Player 3 (Teal) types a chat message containing -save as An exact match
Player - Player 4 (Purple) types a chat message containing -save as An exact match
Player - Player 5 (Yellow) types a chat message containing -save as An exact match
Player - Player 6 (Orange) types a chat message containing -save as An exact match
Player - Player 7 (Green) types a chat message containing -save as An exact match
Player - Player 8 (Pink) types a chat message containing -save as An exact match
Conditions
Collapse Actions
Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: Generating a save c...
Set i = (Player number of (Triggering player))
Set SAVEINTEGERS[1] = (Hero level of Squire[i])
Set SAVEINTEGERS[2] = (Hero level of Knight[i])
Set SAVEINTEGERS[3] = (Hero level of Archer[i])
Set SAVEINTEGERS[4] = (Hero level of Monk[i])
Set SAVEINTEGERS[5] = (Hero level of Thief[i])
Set SAVEINTEGERS[6] = (Hero level of Lancer[i])
Set SAVEINTEGERS[7] = (Hero level of Geomancer[i])
Set SAVEINTEGERS[8] = (Hero level of Samurai[i])
Set SAVEINTEGERS[9] = (Hero level of Ninja[i])
Set SAVEINTEGERS[10] = (Hero level of HolySwordsman[i])
Set SAVEINTEGERS[11] = (Hero level of HeavenlyKnight[i])
Set SAVEINTEGERS[12] = (Hero level of Chemist[i])
Set SAVEINTEGERS[13] = (Hero level of Wizard[i])
Set SAVEINTEGERS[14] = (Hero level of Priest[i])
Set SAVEINTEGERS[15] = (Hero level of Summoner[i])
Set SAVEINTEGERS[16] = (Hero level of TimeMage[i])
Set SAVEINTEGERS[17] = (Hero level of Mediator[i])
Set SAVEINTEGERS[18] = (Hero level of Oracle[i])
Set SAVEINTEGERS[19] = (Hero level of Calculator[i])
Set SAVEINTEGERS[20] = (Hero level of Prophet[i])
Set SAVEINTEGERS[21] = (Hero level of Sorcerer[i])
Set SAVEINTEGERS[22] = (Hero level of ArchBishop[i])
Set xi = SAVEINTEGERS[1]
Custom script: call SaveInteger( udg_xi, "save1", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[2]
Custom script: call SaveInteger( udg_xi, "save2", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[3]
Custom script: call SaveInteger( udg_xi, "save3", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[4]
Custom script: call SaveInteger( udg_xi, "save4", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[5]
Custom script: call SaveInteger( udg_xi, "save5", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[6]
Custom script: call SaveInteger( udg_xi, "save6", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[7]
Custom script: call SaveInteger( udg_xi, "save7", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[8]
Custom script: call SaveInteger( udg_xi, "save8", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[9]
Custom script: call SaveInteger( udg_xi, "save9", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[10]
Custom script: call SaveInteger( udg_xi, "save10", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[11]
Custom script: call SaveInteger( udg_xi, "save11", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[12]
Custom script: call SaveInteger( udg_xi, "save12", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[13]
Custom script: call SaveInteger( udg_xi, "save13", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[14]
Custom script: call SaveInteger( udg_xi, "save14", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[15]
Custom script: call SaveInteger( udg_xi, "save15", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[16]
Custom script: call SaveInteger( udg_xi, "save16", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[17]
Custom script: call SaveInteger( udg_xi, "save17", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[18]
Custom script: call SaveInteger( udg_xi, "save18", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[19]
Custom script: call SaveInteger( udg_xi, "save19", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[20]
Custom script: call SaveInteger( udg_xi, "save20", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[21]
Custom script: call SaveInteger( udg_xi, "save21", 1, 120, "code1")
Wait 0.01 seconds
Set xi = SAVEINTEGERS[22]
Custom script: call SaveInteger( udg_xi, "save22", 1, 120, "code1")
Wait 0.01 seconds
Set temp_Integer8 = ((Triggering player) Current gold)
-------- CONVERTING UPGRADES TO GOLD --------
Collapse For each (Integer A) from 1 to (Current research level of Pickaxe for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((40 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Sword for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((65 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Bow for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((70 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Rod for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((125 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Staff for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((125 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Plate Armor for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((150 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Leather Armor for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((150 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Robe for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((150 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Axe for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((100 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Spear for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((100 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Katana for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((150 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Exotic Weapons for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((150 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Gun for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((125 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Knight Sword for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((200 x (Integer A)) x 1))
Collapse For each (Integer A) from 1 to (Current research level of Magic Sphere for (Triggering player)), do (Actions)
Collapse Loop - Actions
Set temp_Integer8 = (temp_Integer8 + ((200 x (Integer A)) x 1))
Set temp_Integer8 = (temp_Integer8 + (100 x (Current research level of Break Magic for (Triggering player))))
Set temp_Integer8 = (temp_Integer8 + (200 x (Current research level of Mana Transfer for (Triggering player))))
Set temp_Integer8 = (temp_Integer8 + (300 x (Current research level of Mega Heal for (Triggering player))))
Set temp_Integer8 = (temp_Integer8 + (500 x (Current research level of Mana Boost for (Triggering player))))
Set temp_Integer8 = (temp_Integer8 + (4500 x (Level of Damage [SoG, [1,1]] for SpiritOfGaya[(Player number of (Triggering player))])))
Set temp_Integer8 = (temp_Integer8 + (4500 x (Level of Attack Speed [SoG, [2,1]] for SpiritOfGaya[(Player number of (Triggering player))])))
Set temp_Integer8 = (temp_Integer8 + (4500 x (Level of Armor [SoG, [3,1]] for SpiritOfGaya[(Player number of (Triggering player))])))
-------- FINISHED UPGRADES TO GOLD --------
-------- CONVERTING ELEMENTAL STONES TO GOLD --------
Set temp_Integer8 = (temp_Integer8 + (1500 x ((Triggering player) Current lumber)))
-------- FINISHED ELEMENTAL STONES TO GOLD --------
If (temp_Integer8 Greater than or equal to 1000000) then do (Set temp_Integer8 = 999999) else do (Do nothing)
Set xi = temp_Integer8
Custom script: call SaveInteger( udg_xi, "save23", 0, 999999, "code1")
Wait 0.01 seconds
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Set temp_Integer6 = 0
If ((Item carried by CurrentHero[i] in slot (Integer A)) Equal to No item) then do (Set temp_Integer6 = 0) else do (Do nothing)
Collapse For each (Integer B) from 1 to Total_Items_to_Save, do (Actions)
Collapse Loop - Actions
If ((Item-type of (Item carried by CurrentHero[i] in slot (Integer A))) Equal to ItemsType_LoadCode[(Integer B)]) then do (Set temp_Integer6 = (Integer B)) else do (Do nothing)
Set PasswordParts[(23 + (Integer A))] = (String(temp_Integer6))
Set xi = (Integer(PasswordParts[24]))
Custom script: call SaveInteger( udg_xi, "save24", 1, 97, "code1")
Wait 0.01 seconds
Set xi = (Integer(PasswordParts[25]))
Custom script: call SaveInteger( udg_xi, "save25", 1, 97, "code1")
Wait 0.01 seconds
Set xi = (Integer(PasswordParts[26]))
Custom script: call SaveInteger( udg_xi, "save26", 1, 97, "code1")
Wait 0.01 seconds
Set xi = (Integer(PasswordParts[27]))
Custom script: call SaveInteger( udg_xi, "save27", 1, 97, "code1")
Wait 0.01 seconds
Set xi = (Integer(PasswordParts[28]))
Custom script: call SaveInteger( udg_xi, "save28", 1, 97, "code1")
Wait 0.01 seconds
Set xi = (Integer(PasswordParts[29]))
Custom script: call SaveInteger( udg_xi, "save29", 1, 97, "code1")
Wait 0.01 seconds
Custom script: set udg_xs = SaveCode("code1")
Game - Display to (Player group((Triggering player))) for 180.00 seconds the text: (Your loading code is: + xs)

Here is the load trigger...
Trigger:
Load
Collapse Events
Player - Player 1 (Red) types a chat message containing -load as A substring
Player - Player 2 (Blue) types a chat message containing -load as A substring
Player - Player 3 (Teal) types a chat message containing -load as A substring
Player - Player 4 (Purple) types a chat message containing -load as A substring
Player - Player 5 (Yellow) types a chat message containing -load as A substring
Player - Player 6 (Orange) types a chat message containing -load as A substring
Player - Player 7 (Green) types a chat message containing -load as A substring
Player - Player 8 (Pink) types a chat message containing -load as A substring
Conditions
Collapse Actions
Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: Your code is being ...
Set i = (Player number of (Triggering player))
Custom script: call LoadCode( "code1" , SubStringBJ(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString())))
Custom script: set udg_xi = LoadInteger("save1", "code1")
Hero - Set Squire[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save2", "code1")
Hero - Set Knight[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save3", "code1")
Hero - Set Archer[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save4", "code1")
Hero - Set Monk[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save5", "code1")
Hero - Set Thief[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save6", "code1")
Hero - Set Lancer[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save7", "code1")
Hero - Set Geomancer[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save8", "code1")
Hero - Set Samurai[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save9", "code1")
Hero - Set Ninja[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save10", "code1")
Hero - Set HolySwordsman[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save11", "code1")
Hero - Set HeavenlyKnight[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save12", "code1")
Hero - Set Chemist[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save13", "code1")
Hero - Set Wizard[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save14", "code1")
Hero - Set Priest[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save15", "code1")
Hero - Set Summoner[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save16", "code1")
Hero - Set TimeMage[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save17", "code1")
Hero - Set Mediator[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save18", "code1")
Hero - Set Oracle[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save19", "code1")
Hero - Set Calculator[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save20", "code1")
Hero - Set Prophet[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save21", "code1")
Hero - Set Sorcerer[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save22", "code1")
Hero - Set ArchBishop[i] Hero-level to xi, Hide level-up graphics
Custom script: set udg_xi = LoadInteger("save23", "code1")
Player - Set (Triggering player) Current gold to xi
Custom script: set udg_xi = LoadInteger("save24", "code1")
Hero - Create ItemsType_LoadCode[xi] and give it to CurrentHero[i]
Custom script: set udg_xi = LoadInteger("save25", "code1")
Hero - Create ItemsType_LoadCode[xi] and give it to CurrentHero[i]
Custom script: set udg_xi = LoadInteger("save26", "code1")
Hero - Create ItemsType_LoadCode[xi] and give it to CurrentHero[i]
Custom script: set udg_xi = LoadInteger("save27", "code1")
Hero - Create ItemsType_LoadCode[xi] and give it to CurrentHero[i]
Custom script: set udg_xi = LoadInteger("save28", "code1")
Hero - Create ItemsType_LoadCode[xi] and give it to CurrentHero[i]
Custom script: set udg_xi = LoadInteger("save29", "code1")
Hero - Create ItemsType_LoadCode[xi] and give it to CurrentHero[i]

Here is the init trigger that starts the save load system...

Trigger:
SAVES
Collapse Events
Map initialization
Conditions
Collapse Actions
Set SL_Random[1] = 0
Set SL_Random[2] = 0
Set SL_Random[3] = 0
Set SL_Random[4] = 0
Set SL_Random[5] = 0
Set SL_Random[6] = 0
Set SL_Random[7] = 0
Set SL_Random[8] = 0
Set SL_Random[9] = 0
Set SL_Random[10] = 0
Custom script: call ASLinit()
Custom script: call SaveInteger( 0, "save1", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save2", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save3", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save4", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save5", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save6", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save7", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save8", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save9", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save10", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save11", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save12", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save13", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save14", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save15", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save16", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save17", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save18", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save19", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save20", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save21", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save22", 1, 120, "code1")
Custom script: call SaveInteger( 0, "save23", 0, 999999, "code1")
Custom script: call SaveInteger( 0, "save24", 1, 97, "code1")
Custom script: call SaveInteger( 0, "save25", 1, 97, "code1")
Custom script: call SaveInteger( 0, "save26", 1, 97, "code1")
Custom script: call SaveInteger( 0, "save27", 1, 97, "code1")
Custom script: call SaveInteger( 0, "save28", 1, 97, "code1")
Custom script: call SaveInteger( 0, "save29", 1, 97, "code1")

The map, Final Fantasy Epic RPG.
08-19-2007, 03:01 PM#5
Artemis101
Anyone..?
08-19-2007, 03:10 PM#6
Earth-Fury
Yesterday, 04:42 PM
Today, 11:01 AM

http://wc3campaigns.net/faq.php?faq=..._wc3c_rules_03
Quote:
Originally Posted by The Rules
Double Posting & Bumping
Replying to your own thread is known as "double posting." This is not permitted at Wc3Campaigns - use the edit button to make additional content in your post.
You can, however, reply to your own post in order to return ("bump") the thread to the top of the list as long as there has been no reply in over 48 hours, and the thread is less than 1 week old.

As for you actual problem, I have no idea after this much lack of sleep... I'll try to remember to look back here after sleep.
08-20-2007, 03:23 AM#7
botanic
so what specificaly is the problem is it the hero levels because I dont see where you do that because

Set IntVariable 1 = Hero Level of Hero 1
Set IntVariable 2 = Hero Level of Hero 2
(so on for all heroes)
Set Variable1 = IntVariable 1
call SaveInteger (Variable 1, save part 1, code 1)
Set Variable1 = IntVariable 2
call SaveInteger (Variable1, save part 1, code 1)

why are you setting the

Set IntVariable 1 = Hero Level of Hero 1

just to

Set Variable1 = IntVariable 1

call SaveInteger (Variable 1, save part 1, code 1)

If you are trying to convert it to a string you need to convert the intiger and whatnot
08-20-2007, 08:17 PM#8
Artemis101
The problem IS.. when I start the -save trigger, all hero levels are set to 1.
Nothing in any part of the SAVE system or trigger use set hero level function..
08-20-2007, 08:56 PM#9
botanic
Well... i dunno a not so pretty workaround would be to

Add this at end of -save trigger
Trigger:
Set loadfix = xs
Run Loadfix

then make a new trigger that uses the loadfix variable in the load trigger to set the levels again

Also is the JASS in the custom script section of the map or is that in a trigger?

If you add a debug tigger that displays the value of xi and post the value here we might be able to isolate what exactly is happening


Also i dont know if this is the problem but do you need to do anything with this part?
Collapse JASS:
//________________________//
// Sup - Save (Unit-Type) //
//________________________//

function SaveType takes string name, string c returns nothing
    //	Requires a array of Unit-Types! Specific for Code?
endfunction

//_________________________//
// Sup - Save (Name-Check) //
//________________________//

function SaveName takes string name, string c returns nothing
    //	Saves a Name Check, not the actual name.
endfunction
08-20-2007, 10:41 PM#10
Artemis101
Its an unfinished part of the script.. i just posted the whole thing.
I only use the SaveInteger and LoadInteger functions.

Although running a load function after it so the hero levels are set to the variables entered.. it would take like a full 8-10 seconds to run the whole trigger.. it did give me another idea though, that should work.

I would still like to know what is exactly causing the problem though, and i will get back on if my idea does or doesnt work.
08-25-2007, 12:57 PM#11
Artemis101
Is it possible that the system is looping too fast?
08-25-2007, 03:45 PM#12
NightBreeze
How about adding some debug messages? It sounds like you have no clue what is going wrong.

Quote:
Originally Posted by Artemis101
Is it possible that the system is looping too fast?

How do you figure?

Quote:
The problem IS.. when I start the -save trigger, all hero levels are set to 1.
Nothing in any part of the SAVE system or trigger use set hero level function..

Perhaps that means that somewhere in your script, something is done with the heroes that forces the game to set the default value for the hero's level.

You said that it stored all the values correctly, but set the hero levels to 1. So what you're saying is that the entire storing and loading system is working, but it has a nasty side-effect. I don't even see a unit variable in the entire storage system.. Isn't it safe to conclude that the bug isn't caused from by the storage system?
08-26-2007, 02:14 AM#13
Artemis101
Ive talked with other people on problems with the system, and the only person that actually gave a logical answer said that the system was looping too fast. This is not my system, and i have brought the problem to the creator of the system.. but it remains a bug. I was wondering if my last post would help direct experienced pplz here to a conclusion as to what is happening. Every bit of script used is in the above post.