• 🏆 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!

How to get string from a text file?

Status
Not open for further replies.
Level 1
Joined
May 3, 2014
Messages
1
I want to create an auto-load system in a RPG map, is there a possible way to get string from a text file so it can be used in the load function?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The linked thread is about saving, not loading.

You can read information via the Preloader native, that is, if you have localfiles enabled, so you can access the files on the hard disk. The file loaded by Preloader is to be executed as a jass script and should have the right format of a preload file. Output such a file via PreloadGenEnd as described in the linked thread. A few jass natives besides normal preload lines can be inserted and those are used to add the information, one of that being SetPlayerName.

http://www.thehelper.net/threads/preloader-based-save-load-system-sync-local-data-system.141988/

Take a look at the code in this thread.

However, if your map is multiplayer, of course other players won't have the same data on their drive. So reading will yield async results first. They have to be broadcasted to the other players, which can be done via the game cache sync natives for example. Syncing requires time, you have to pause the game/wait until you can use the won information. If you have 12 players and everyone transmits multiple stuff, this can take quite long.

edit: http://www.hiveworkshop.com/forums/world-editor-help-zone-98/loading-data-preload-natives-248509/
 
Last edited:
Status
Not open for further replies.
Top