1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest. The contest is optionally paired. Best of luck, people!
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

FileIO v1.1.0 fixed

Discussion in 'The Lab' started by Zorrot, Jan 6, 2020.

  1. Zorrot

    Zorrot

    Joined:
    May 16, 2010
    Messages:
    15
    Resources:
    0
    Resources:
    0
    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 (Text):

    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: Jan 7, 2020
  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    What did you change?
     
  3. Zorrot

    Zorrot

    Joined:
    May 16, 2010
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Code (Text):
    // 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.