Results 1 to 9 of 9

Thread: ScriptTerminate;

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default ScriptTerminate;

    To start, my script terminate function:

    SCAR Code:
    procedure ScriptTerminate;
    var
    MT : Array of String;
    MessageF, PlayerString, EmailF : String;
    TP, I, W : Integer;
    begin
       Debug('Final Proggy');
       Proggy;
       TP := (ProfitB * BSmith);
       {W := HowManyPlayers - 1;
       repeat
         MT[i] := IntToStr(i) + ': ' + Players[i].Nick + ' | ' + Left(BoolToStr(Players[i].active), 1) + ' | ' + IntToStr(Players[i].Integers[1]) + ' Loads | ' + IntToStr(Players[i].Integers[2]) + ' Bars | ' + IntToStr(Players[i].Integers[3]) + ' Profit | ' + Players[i].Loc;
         Inc(i);
         if i >= W then break;
       until I >= W
       PlayerString := Implode(#13, MT); }

       Debug('Creating Message');
       if YourEmail = '' Then EmailF := 'Garrettsemail' else EmailF := YourEmail;
       MessageF := ' ' +
      '3Garrett3s Baby Melter ' + VersionN + ' Progress Report' + #13 +
      '*********************************************' + #13 +
      'Ran for: ' + TimeRunning + #13 +
      'Loads: ' + IntToStr(LD) + #13 +
      'Bars: ' + IntToStr(BSmith) + #13 +
      'Profit: ' + IntToStr(TP) + 'gp' + #13 +
      'Leveled: ' + IntToStr(Levels) + ' Times' + #13 +
      'Rested: ' + IntToStr(RAmount) + ' Times' + #13 +
      'Rested for: ' + MsToTime(RTTime, 0) + #13 +
      'Slept: ' + IntToStr(Sleeped) + ' Times' + #13 +
      'Slept for: ' + MsToTime(SleepT, 0) + #13 +
      '*********************************************' + #13 +
      //PlayerString + #13 +
      ' ';
      SendEmail('', '', MessageF, '', '', '');
      Debug('Sent Email');
    end;

    And yeah, I have the email thing set up right, I just removed all of my information until I release the script.

    Anyway. To the real problem. As you can see, parts of the script are commented out. IMO, the important part of the procedure is to tell me what the players did. This is the part that will not work.

    I have tried a simple For To Do loop, and also tried using this repeat loop, but the result is the same.

    If I comment out the parts that are commented, the script will terminate right and will send an email (minus the important parts) but when it is uncommented, the script will simply die after writing the progress report (first thing) and will not make it to creating the message and sending the email before it dies.

    The thing I would like to know is:

    - Can this be done somehow to stop the script from prematurely stopping?

    Edit: Wording might have been bad.

    "Can I rewrite this so that it doesn't stop the script before it reaches the end of the procedure, and why does it do that?"

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  2. #2
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    To add more detail to this:

    Here is a different approach:

    SCAR Code:
    begin
       Debug('Final Proggy');
       Proggy;
       TP := (ProfitB * BSmith);
       Debug('Loop Start');
       for i := 0 to HowManyPlayers - 1 do
        MT[i] := (IntToStr(i) + ': ' + Players[i].Nick + ' | ' + Left(BoolToStr(Players[i].active), 1) + ' | ' + IntToStr(Players[i].Integers[1]) + ' Loads | ' + IntToStr(Players[i].Integers[2]) + ' Bars | ' + IntToStr(Players[i].Integers[3]) + ' Profit | ' + Players[i].Loc);
       Debug('Loop End');
       PlayerString := Implode(#13, MT);
       Debug('Implode end');
    //And so on...

    So this uses a for to do loop, which works in my proggy.

    In my debug box, I get

    PHP Code:
    [21:55:36] Final Proggy
    [21:55:36Loop Start
    Successfully executed 
    So it doesn't make it through the loop before it ends. I have no idea why though.

    Edit: Sorry for the double post, but I figured it would get more attention if I added a post instead of editting.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  3. #3
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    This works fine for me.

    SCAR Code:
    Successfully compiled (4265 ms)
    Final Proggy
    Loop Start
    Loop End
    Implode end
    Successfully executed

    It must either be another piece of your code or your SRL/SCAR?

  4. #4
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm...
    So scar just die and it exits?, totally?
    I got that too when I was trying to write in a file in ScriptTerminate.
    I solved the problem by making another "script terminate". What will terminate/switch accounts but if just one player left(so the script will end) it makes the final proggy.
    And then I use that function everywhere the script can fail.
    The problem with that that when the user stops the script it won't give out the final thing

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by Derek- View Post
    This works fine for me.

    SCAR Code:
    Successfully compiled (4265 ms)
    Final Proggy
    Loop Start
    Loop End
    Implode end
    Successfully executed

    It must either be another piece of your code or your SRL/SCAR?
    You didnt use the very first code, uncommenting the commented part though. comment sendemail if you want. it will die before the end.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  6. #6
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Something wrong with ur player array? Did you set the number wrong or something?

    Only thing i could think of that would stop in the middle of the loop and just end.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Well there are two players, and howmanyplayers = 2... so no?

    I will pm you the script if you want? It's not ready for public release yet

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  8. #8
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    are your players listed as 1 and 2 or 0 and 1?


    also, baby melter? wtf? lol
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  9. #9
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by bionicle1800 View Post
    are your players listed as 1 and 2 or 0 and 1?


    also, baby melter? wtf? lol
    Wow. I didn't think anyone would help with this XD. It still isn't fixed. I'm pretty sure I just scrapped the idea.

    They are 0,1,2 and so on.

    Baby Melter- The name was given to me by Ian. I think he made the best choice.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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