• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

FileIO v1.1.0 fixed

Status
Not open for further replies.

Zorrot

Hosted Project: QM
Level 16
Joined
May 16, 2010
Messages
158
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 16
Joined
May 16, 2010
Messages
158
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.
 
Status
Not open for further replies.
Top