Results 1 to 8 of 8

Thread: Reset Script

  1. #1
    Join Date
    Aug 2017
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default Reset Script

    Hi, is there a line of code that'll just restart the script from the beginning? Not a repeat until false command. But a line that'll interrupt any procedure and reset the whole script.
    Thanks.

  2. #2
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    The "break" command can break out of any loop as far as I'm aware.
    You can also call a function/procedure that is placed above the current one you are in.

    What you are referring to is a goto, or jump, which I'm not sure Lape supports.
    But I'm sure there would be a way to avoid it, as most cases, i'ts bad programming practice anyways.
    Can I see a snippet of your script?

  3. #3
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by Aspect View Post
    The "break" command can break out of any loop as far as I'm aware.
    You can also call a function/procedure that is placed above the current one you are in.

    What you are referring to is a goto, or jump, which I'm not sure Lape supports.
    But I'm sure there would be a way to avoid it, as most cases, i'ts bad programming practice anyways.
    Can I see a snippet of your script?
    They exist: http://wiki.freepascal.org/Goto and http://wiki.freepascal.org/Label (same in Lape IME)
    But As you said, they're generally considered bad practice. I agree that @OP can, and should, accomplish what he wants with standard loops.

  4. #4
    Join Date
    Aug 2017
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by Aspect View Post
    The "break" command can break out of any loop as far as I'm aware.
    You can also call a function/procedure that is placed above the current one you are in.

    What you are referring to is a goto, or jump, which I'm not sure Lape supports.
    But I'm sure there would be a way to avoid it, as most cases, i'ts bad programming practice anyways.
    Can I see a snippet of your script?
    I've tried this. Here's examples;
    This here is part of my main procedure I'm running.

    Code:
    if FindColorTolerance (X, Y, 1282019, 103, 49, 438, 235, 5) then
            movemouse(608, 365);
            wait(200);
            clickmouse(608, 365,1);
            wait(200);
            Loot();
            wait(1800);
    As you can see, I've got a loot Procedure. This is part of my loot Procedure(so far)
    Code:
    Procedure Loot
    var
      x,y:Integer;
    begin
      if FindColorTolerance(x, y, 6133430, 16, 10, 508, 360, 5) then
      begin
      wait(500);
      KeyDown(38);
      wait(1000);
      KeyUp(38);
      movemouse(266,202);
      wait(200);
      clickmouse(266,202,1);
    What I'm currently doing is inserting Loot(); throughout my main procedure; for when the chosen colour I want appears on screen.
    I would like it so that once it's checked loot and loot is TRUE(colour found) , The script restarts Mainloop(or just my end part), rather than continue on the main procedure as it's doing now. This is the end of my script;

    Code:
    Procedure MainLoop;
    begin
        SettingUp;
        GettingToBoat;
        Zulrah;
    end;
    
    
    
    begin
      MainLoop
    end;
    I cant put MainLoop in Loot unless I put it above it. But if I do that, Zulrah will be below MainLoop, and It won't run either way
    Thanks for the reply too.

  5. #5
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by hash1mate View Post
    ...
    I'd strongly recommend you read and understand this tutorial before continuing: https://villavu.com/forum/showthread.php?t=58935
    Anyway, here's a rough skeleton script that might help you understand how you can accomplish what you're describing:
    Simba Code:
    program ZulrahKiller;

    procedure KillZulrah();
    begin
      //kill snek
    end;

    function Loot(): Boolean;
    begin
      //get loot
    end;

    procedure Mainloop();
    begin
      //other stuff
      KillZulrah();
      if Loot() then Exit;
      //other stuff
    end;

    begin
      while True do Mainloop();
    end.

  6. #6
    Join Date
    Aug 2017
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Thanks for the example. I'll give that post a read over.

  7. #7
    Join Date
    Aug 2017
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Sorry to come back to this. Just having some problems still. I've tried the skeleton you've given, @Citrus. I've got different issues now. Let me give you as much info on my script as possible.
    - It's a zulrah killing script for a private server. I've coded it nearly perfectly up until the looting part. Because Its an RSPS and aerolib isn't 100% on rsps's i'm trying to figure out different ways to solve stuff. On this rsps, a zulrah teleport spawns on the floor next to my character when zulrah dies, and the loot then appears where my character is standing. What I've coded is I'm constantly checking my loot function to see if the colours on the teleport are on the screen.
    Here's an example from my main procedure
    Code:
    Loot();
        wait(50);
        clickmouse(X,Y,1);
      ....... 
        wait(50);
        movemouse(621,288);
        wait(50);
        Loot();
    As you can see I'm constantly calling upon loot which is;
    Code:
    function Loot(): Boolean;
    var
      x,y:Integer;
    begin
      if FindColorTolerance(x, y, 6133430, 16, 10, 508, 360, 5) then
      begin
      wait(500);
      KeyDown(38);
      wait(1000);
      KeyUp(38);
      movemouse(266,202);
      wait(200);
      clickmouse(266,202,1);
      wait(1000);
      clickmouse(266,202,1);
    
    
    end;
    end;
    And i've used your skeleton at the end of the script;
    Code:
    Procedure MainLoop();
    begin
        SettingUp();
        GettingToBoat();
        Zulrah();
        if Loot() then Exit;
    end;
    
    
    
    begin
      while True do MainLoop();
    end;
    I've read the thread you linked a few times over. I'm still struggling.
    With the CURRENT script i've shown, it DOES loot but as you can see i'm constantly checking loot because it kills zulrah at so many different points in the script so it loops for as many loot calls I write. Could you help me find a much easier way of doing this? The zulrah teleport is always on the floor till i leave, so it keeps on activating the loot function. I COULD put teleport out code in the loot function, but the script would still run as if i was still killing zulrah because It thinks looting is done. This is why I wanted the script to literally restart from the beginning once loot is done. And the if loot then Exit just continues from the main procedure, which is not what I want.
    Thankyou very much.

  8. #8
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by OP View Post
    ...
    Some suggestions to get better help:
    1: Clean up your code with proper indentation and capitalization. As is, it's barely readable. Also, use [SIMBA]//code[/SIMBA] tags instead of CODE tags.
    2: Post the whole script. These bits and pieces you're posting don't make sense.
    3: Explain what you want the script to do in clear, plain language. A 5-year-old with no knowledge of RuneScape should be able to understand it.
    4: For (maybe) quicker responses, ask on Discord: https://discord.gg/RSXyB8E
    Last edited by Citrus; 05-01-2018 at 02:18 AM.

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
  •