FileIO v1.1.0 fixed

Zorrot

Hosted Project: QM
Level 6
Joined
May 16, 2010
Messages
51
In reforged there are issues when using TriggerHappy's fileIO system. if you found error, try to replace method readpreload with following, Bold font is the modify:

call Preloader(this.filename)
call TriggerSleepAction(2)


Code:
private method readPreload takes nothing returns string
            local integer i = 0
            local integer lev = 0
            local string array original
            local string chunk = ""
            local string output = ""
     
            loop
                exitwhen i == .AbilityCount
                set original = BlzGetAbilityTooltip(.AbilityList, 0)
            //call BJDebugMsg("original" + original)
                set i = i + 1
            endloop
     
            // Execute the preload file
            call Preloader(this.filename)
            call TriggerSleepAction(2)
            // Read the output
            set i = 0
            loop
                exitwhen i == .AbilityCount
         
                set lev = 0
         
                // Read from ability index 1 instead of 0 if
                // backwards compatability is enabled
                static if (BACKWARDS_COMPATABILITY) then
                    if (i == 0) then
                        set lev = 1
                    endif
                endif
         
                // Make sure the tooltip has changed
                set chunk = BlzGetAbilityTooltip(.AbilityList, 0)
                if (chunk == original) then
                    if (i == 0 and output == "") then
                        return null // empty file
                    endif
                    return output
                endif
         
                // Check if the file is an empty string or null
                static if not (BACKWARDS_COMPATABILITY) then
                    if (i == 0) then
                        if (SubString(chunk, 0, 1) != "-") then
                            return null // empty file
                        endif
                        set chunk = SubString(chunk, 1, StringLength(chunk))
                    endif
                endif
         
                // Remove the prefix
                if (i > 0) then
                    set chunk = SubString(chunk, 1, StringLength(chunk))
                endif
         
                // Restore the tooltip and append the chunk
                call BlzSetAbilityTooltip(.AbilityList, original, lev)
         
                set output = output + chunk
         
                set i = i + 1
            endloop
     
            return output
        endmethod

and when you tried to make files, use "xxx.pld" to make sure it works.
 
Last edited:

Zorrot

Hosted Project: QM
Level 6
Joined
May 16, 2010
Messages
51
Code:
// Execute the preload file
            call Preloader(this.filename)
            call TriggerSleepAction(2)
            // Read the output

a small change but in case someone dont know how to use vj, i stiill post the whole method.
reforged preload takes about a second to run the function. beside triggersleepaction, a timer should work properly.
 
Top