Text string, supposed to be a file path to be preloaded. Max length: 259 characters (see Windows MAX_PATH).
The game only reads these files, does not load them. The reading is done in a separate thread and does not freeze the game. One file is not read twice, no matter how often you call Preload().
Trick: It does not escape double-quotes " on purpose (approved not a bug, it's a feature). It is possible to inject custom code in Preload files this way (Lua):
PreloadGenClear()
PreloadGenStart()
Preload(' ")\ncall otherFunction("123")\n//')
PreloadGenEnd("its-a-feature.txt")
Results in the following preload file code (Jass):
function PreloadFiles takes nothing returns nothing
call PreloadStart()
call Preload( " ")
call otherFunction("123")
//" )
call PreloadEnd( 754.6 )
endfunction
Game folder:
Reforged: Warcraft III\_retail_\somefile.txt
, instead of _retail_
there's also a _ptr_
game version currently.
Classic: ?
Mini tutorial:
What are Preload files?
Preload files instruct the game to pre-read a file/resources to avoid freezes/stutter during gameplay. It's done to move the file into OS cache. Blizzard used preload files to load all required files at map init. See blizzard.j or campaign maps.
Create a preload file (Lua)
PreloadGenClear()
PreloadGenStart()
-- call Preload("filename.ext") as often as you need, one call per file you add
Preload("Textures\\Knight.blp")
PreloadGenEnd("MyPreloadFile.txt")
How to run a preload file
This must be done manually:
Preloader("MyPreloadFile.txt")
Lua code in preload files?
It is possible although in a very hacky way, described here. You need to use "//! beginusercode" to start a section containing Lua code and end it using "//! endusercode". It works because the code is compiled on the fly with Jass2Lua.
See: PreloadEnd
, PreloadStart
, PreloadRefresh
, PreloadEndEx
, PreloadGenClear
, PreloadGenStart
, PreloadGenEnd
, Preloader
.
Also see the documentation for Preloader
for more info on the generated files.
Generated using TypeDoc
It does two things: