Results 1 to 13 of 13

Thread: Saving to file

  1. #1
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Saving to file

    I want my script to save data like how many hours used, how many messages send,... to a file. And every time i use the program it counts the hours last time + the new hours. Can anyone tell me how to do this? I tried it with "WriteFileString", but it doesn't safe it to a real file, so that you can open it like wordpad,...? Any help with this???

    Thank you
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  2. #2
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Procedure SaveCurrentTime;
    begin
      MyTotalTimer:= GetTimeRunning+StrToInt(ReadIni('Timer','TimeFromLast','.\TimeIni.ini')
      WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini')
    end;

    Procedure TotalTime;
    begin
      Writeln('Has run for: '+IntToStr(GetTimeRunning+ReadIni('Timer','TimeFromLast','.\TimeIni.ini'))
    end;

    Try that.

    -Knives

  3. #3
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    okj thanks ill try it out
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  4. #4
    Join Date
    Sep 2007
    Posts
    45
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    jus put it in notepad or screenprint it or something

  5. #5
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I get this error

    SCAR Code:
    Line 9: [Error] (9:1): comma (',') expected in script...

    This is line 9:
    SCAR Code:
    WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini');
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  6. #6
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nvm i found the error
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  7. #7
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program New;
    var
    MyTotalTimer: integer;


    Procedure SaveCurrentTime;
    begin
      MyTotalTimer:= GetTimeRunning + StrToInt(ReadIni('Timer','TimeFromLast','.\TimeIni.ini'));
      WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini');
    end;

    Procedure TotalTime;
    begin
      Writeln('Has run for: ' + IntToStr(GetTimeRunning) + ReadIni('Timer','TimeFromLast','.\TimeIni.ini'));
    end;


    begin
    SaveCurrentTime;
    TotalTime;
    end.

    SCAR Code:
    [Runtime Error] : Exception: '' is not a valid integer value in line 8 in script

    Anyone sees the error??? I can't find it.
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  8. #8
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Knives is wrong I think, he wants to save it knives
    I took this from the Quest Runner by Zephyr:

    SCAR Code:
    procedure SaveDebugToFile;
    var
      DebugFile: Integer;
      DebugText: string;
    begin
      DebugFile := RewriteFile(ScriptPath + 'Zephyr'+#39+'s Rune Mysteries Quest Runner Progress Report' + '.txt', False);
      DebugText := GetDebugText;
      WriteFileString(DebugFile, DebugText);
      Writeln('Saved debug to file: ' + ScriptPath + 'Zephyr' + #39 + 's Rune Mysteries Quest Runner Progress Report' + '.txt');
      CloseFile(DebugFile);
    end;
    He takes the stuff that's written in the Debug Box( DebugText := GetDebugText) and saves it to a file path (ScriptPath=current script path).

    Watch the .txt (extension) and the closefile
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

  9. #9
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm not very keen on the Ini, and saving-file things. I just learned how Ini's work yesterday... And the procedures I gave him save to a file, and brings that back in, I should mean... I haven't tried it, it was just my best idea at that time.

    -Knives

  10. #10
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I had it working, but now it doesn't work anymore
    Wish me luck that i find the error fast again.
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  11. #11
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by rivon View Post
    I had it working, but now it doesn't work anymore
    Wish me luck that i find the error fast again.
    auwww, that aint great
    however, if you need help, feel free to post
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

  12. #12
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok i found the problem, it is in the file. If the file doesn't exist yet, then add use this.
    SCAR Code:
    program SaveTimerToFile;
    var
    MyTotalTimer,a: integer;
    TimeFromLast: string;


    Procedure SaveCurrentTime;
    begin
      WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini';
      TimeFromLast:= ReadIni('Timer','TimeFromLast','.\TimeIni.ini');
      MyTotalTimer:= GetTimeRunning + StrToInt(TimeFromLast);
      WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini');
    end;

    Procedure TotalTime;
    begin
      Writeln('Has run for: ' + IntToStr(MyTotalTimer) + ' Miliseconds');
    end;


    begin
    SaveCurrentTime;
    TotalTime;
    end.

    It has to make the file first before it can get data from it, so make sure it has something to make the file first.
    Something like this (took out of first box):

    SCAR Code:
    WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini';

    As this will create the file the first time.

    I hope this is helpfull to all of you too. I learnt from it, maybe you can too.
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

  13. #13
    Join Date
    Jul 2007
    Location
    Belgium
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey The Scar Noob, hoe hebt je dat venster van L1 ice giant gemaakt en die in dat kader daarbij???

    Alvast bedankt
    Don't do what can't be undone!!! If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.
    http://www.xcanadamanx.phpnet.us/sta...sigs.php/5.pnghttp://www.stats.srl-forums.com/sigs/3931.png

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 10-11-2008, 03:48 AM
  2. File Saving Help??
    By Timer in forum OSR Help
    Replies: 4
    Last Post: 01-08-2008, 12:58 PM
  3. Saving chat to log file?
    By Maninblack144 in forum OSR Help
    Replies: 9
    Last Post: 12-29-2007, 02:06 AM
  4. Saving something to a file
    By Maninblack144 in forum OSR Help
    Replies: 14
    Last Post: 12-17-2007, 08:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •