Author Topic: save/loading  (Read 2404 times)

0 Members and 1 Guest are viewing this topic.

Offline jcwTopic starter

  • Jr. Member
  • **
  • Posts: 14
  • Activity:
    0%
  • Reputation Power: 1
  • jcw has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
save/loading
« on: July 26, 2014, 08:45:45 PM »
0
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_
« Last Edit: July 26, 2014, 09:04:44 PM by jcw »

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: save/loading
« Reply #1 on: July 27, 2014, 03:53:43 AM »
0
I would guess you could look into code from trailmyx or others scripts with reading and writing textfiles

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: save/loading
« Reply #2 on: July 27, 2014, 07:35:02 AM »
0
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.

Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline jcwTopic starter

  • Jr. Member
  • **
  • Posts: 14
  • Activity:
    0%
  • Reputation Power: 1
  • jcw has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: save/loading
« Reply #3 on: July 27, 2014, 05:31:45 PM »
0
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.  :)
« Last Edit: July 27, 2014, 06:21:11 PM by jcw »

Tags: