- Joined
- Nov 25, 2008
- Messages
- 1,309
There are many threads on here that show how you can save data to a text file using
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.
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: