Preloader
- Parameters
-
filename string
The file to execute.
- comment
Runs the filename as a preload script, only if the filename has an extension. For Jass, the capabilities are very restricted.
Example (from blizzard.j):
if (doPreload) then call Preloader( "scripts\\HumanMelee.pld" ) endif
- note
There're no restrictions for Lua code if you add it to Preload files (which are supposed to be in Jass), that's only possible with dirty hacks or manual editing. If the map runs in Lua mode, the Jass code is compiled using Jass2Lua before execution.
- note
On pre-Reforged (version?) this only works if you have enabled the usage of local files in your registry. The registry key is
HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Allow Local Files\
- note
Here are some ways to get the data out of the preload file into your map: To store multiple integers you can use
SetPlayerTechMaxAllowed
to have a good 2d-array. Read viaGetPlayerTechMaxAllowed
.For strings
SetPlayerName
is suited. To read useGetPlayerName
.Inside the preload script you can also use
ExecuteFunc
to call your map-defined functions and interleave the preload script with your functions.- note
If you use
Preloader
to load some values into your map, these values are very likely to be different for each player (since the player might not even have local files enabled), so treat them as async values.- note
Also see the documentation of
Preload
to see how to properly get the data into the preload script.- bug
1.33.0 and above: Due to aggressive file caching by the game, the preload file is only loaded and read once. This means, updates to the saved preload file cannot be reloaded and old contents will be executed.
- note
See:
Preload
,PreloadEnd
,PreloadStart
,PreloadRefresh
,PreloadEndEx
,PreloadGenClear
,PreloadGenStart
,PreloadGenEnd
.- patch
1.00
- Source
- common.j
- return type
nothing
- Source code
native Preloader takes string filename returns nothing