ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Coragin on January 25, 2010, 12:09:28 AM

Title: How to save variables to a text file?
Post by: Coragin on January 25, 2010, 12:09:28 AM
Lets say I want to save a container variable, so I dont have to re-click or run a setup every single time I run a script.  What would that sub look like?  Lets say we are saving the variable of a contain ID, just one single container.

Code: [Select]
Display OK Target your secure
  set #targcurs 1
  while #targcurs = 1
    wait 1
  set %secure #ltargetid

Now lets say I want to save the %secure variable to a text file, to be loaded next time the script is run, thus removing the need to re-run the above code.  What would that sub look like?  If someone can give me an example, I can do all my variables I got setup in a ton of scripts, mainly though you guessed it, this is for hort.
Title: Re: How to save variables to a text file?
Post by: Endless Night on January 25, 2010, 02:27:03 PM
Code: [Select]
Sub Ens_LogLine ; %1 filename  %2 Text
  Execute %Cmd /c Echo %1 >> %2
Return

I would call it with

Code: [Select]
set !Text  Set , #spc , % , Secure , #spc , #ltargetid
gosub ens_logLine C:myfile.txt !text

Note .. ive forgot how you include the percent sign in a line of text .. it might be %% or other look at the help files to find out.

Note2 .. %Cmd should either be Cmd.exe or command.com depending on your os version.
Title: Re: How to save variables to a text file?
Post by: manwinc on January 25, 2010, 03:53:30 PM
Take a look at ceo's Rail WRiter. it includes the %Symbol when it writes.