ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: jcw on July 26, 2014, 08:45:45 PM

Title: save/loading
Post by: jcw on July 26, 2014, 08:45:45 PM
So I am trying to figure out how to load information from a saved file and just having all kinds of issues.

I can make this work but I want a file to look at and edit if need be.

Code: [Select]
sub save
    set *jc_disco_save %discolist
return

sub loadlist
    if *jc_disco_save = n/a
    {
    set %discolist %Peerless
    }
    else
    {
    set %discolist *jc_disco_save
    }
return

And what I was trying to do is load the information from a file.

Code: [Select]
sub save
   execute cmd.exe /c echo set , #spc , ! , discolistsave , #spc , %discolist > test.txt
return

sub loadlist
    call !test.txt
    if !discolistsave = N/A
    {
    set %discolist %Peerless
    }
    else
    {
    set %discolist !discolistsave
    }
return

I didn't think it would have been that easy. I tried looking around to find other scripts that loaded data from a file. The only ones I can find are in TM scripts and well yea. In all of them that save it seems to be a little different. 


Post Merge: July 26, 2014, 09:04:44 PM
Guess it might also help to post what the save file looks like.

Code: [Select]
set !discolistsave WM_ZM_SIB_aab_UM_JN_BD_WM_CD_UZ_Y_DB_DF_ME_AV_
Title: Re: save/loading
Post by: Crome969 on July 27, 2014, 03:53:43 AM
I would guess you could look into code from trailmyx or others scripts with reading and writing textfiles
Title: Re: save/loading
Post by: Endless Night on July 27, 2014, 07:35:02 AM
Please  see my code snippet here: http://www.scriptuo.com/index.php?topic=2454.msg88662#msg88662

this is an extract from my script library file: ENs-Subs-Standard.txt,  Located here: http://www.scriptuo.com/index.php?topic=10609.0


This code will save and load as many vars to file as you want.

Title: Re: save/loading
Post by: jcw on July 27, 2014, 05:31:45 PM
OOOO I love you so much I spent most of the night trying to get it to work. At one point I had it working then I broke it and called it a night.

PS. this made me really happy I was making a pvm healper script for my sampire and I needed to save a couple settings.  :)