• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Loading Data with Preload Natives

Status
Not open for further replies.
There are many threads on here that show how you can save data to a text file using PreloadGenStart,Preload, andPreloadGenEnd. However, there are no threads showing how to retrieve any of the saved data. How can you load data from a text file with these natives? Any resources relating to this have been removed, oddly enough.

Edit: I've figured out a way to save and load data. The only downside is I have no clue how multiplayer friendly it is.
JASS:
function SaveFile takes string Msg returns nothing
    call PreloadGenClear()
    call PreloadGenStart()
    call Preload("\" )\ncall SetPlayerName(Player(0),\""+Msg+"\") //")
    call PreloadGenEnd("Saves\\Test Save.txt")
endfunction


function LoadFile takes nothing returns string
    local string PN=GetPlayerName(Player(0))
    local string Str
    call Preloader("Saves\\Test Save.txt")
    set Str=GetPlayerName(Player(0))
    if PN==Str then
        return ""
    endif
    call SetPlayerName(Player(0),PN)
    return Str
endfunction
 
Last edited:
Status
Not open for further replies.
Top