Results 1 to 2 of 2

Thread: Calling Procedure Help

  1. #1
    Join Date
    Apr 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Question Calling Procedure Help

    Hi everyone. I just recently started learning Lape and wanted to get into scripting for RSPS' but I ran into a problem. I've everything working but I want to call a procedure that's defined later than another in order to "reset" the script and send it on an infinite loop. Is there any way to call procedure that's defined after the procedure that I'm calling it from?

    Any easier way to explain it is this:
    I want to call "withdrawOre" from my "depositGoldBars" procedure but it's defined above "withdrawOre". Is there any way to call it regardless?

    Thank you for any help that you're able to lend.
    Last edited by hrodkey; 04-23-2018 at 06:45 PM.

  2. #2
    Join Date
    Apr 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I ended up finding the solution as soon as I posted this. Here it is for anyone that comes across my thread in the future.

    Pascal/Lape require a forward declaration before any procedures if you want to call a procedure before it's defined, like so:

    Code:
    procedure testProcedure2; forward;
    
    procedure testProcedure
    begin
      WriteLn('Test1');
      testProcedure2
    end;
    
    procedure testProcedure2
    begin
      WriteLine('Test2');
    end;

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
  •