Results 1 to 6 of 6

Thread: Call a Procedure When Script Stops?

  1. #1
    Join Date
    Jun 2009
    Posts
    177
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Question [Solved] Call a Procedure When Script Stops?

    Is it possible to make Simba call a certain procedure when the user stops the script manually (i.e., they press the Stop icon or key-in the appropriate hotkeys)? It's like the onFinish method in RSBot. And, if it's not possible in Simba, is it possible in SCAR?
    Last edited by LolL; 02-07-2011 at 01:23 AM.

  2. #2
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    In SCAR, there is a procedure called ScriptTerminate. Just use it like a normal procedure, except you don't need to call it anywhere. It'll be called automatically when the script ends. I tried it in Simba before, and it didn't work, so I'm not so sure about Simba.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  3. #3
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Yup, it's called ScriptTerminate;


    Simba Code:
    Procedure ScriptTerminate;
      Begin
        //Code here;
      End;


    Edit : I was wrong and ninja'd haha

  4. #4
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    program new;

    procedure wat;
    begin
      writeln(':]');
    end;

    begin
    SetScriptProp(SP_OnTerminate, ['wat']);
    end.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  5. #5
    Join Date
    Jun 2009
    Posts
    177
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks dude, that works perfectly in Simba.

  6. #6
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Or
    Simba Code:
    AddOnTerminate('procedure/function');

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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