Results 1 to 9 of 9

Thread: States, types or perhaps action IDs?

  1. #1
    Join Date
    Mar 2011
    Location
    MT
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default States, types or perhaps action IDs?

    Hey guys, I'm working on a couple of personal scripts for RS3. My main project is to achieve increased artificial intelligence in a high-alching bot. The issues I'm having are that with color picking, bitmaps and DTMs there's really only a finite amount of flawlessness offered. I'm use SMART w/ openGL instead of the browser so I guess I'm just hoping that there's a better way to detect/check if the user is in what state. <-- Also a question.
    Bazzy

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Sure, take a look at this tutorial:
    FSM style Mainloop

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Mar 2011
    Location
    MT
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Yes! Thank you very much

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Bazcrown View Post
    Yes! Thank you very much
    FSM is great for short scripts but be aware, for longer script it may null out and fail

  5. #5
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    FSM is great for short scripts but be aware, for longer script it may null out and fail
    Monkfishies 2.0, which I'm using as my random-trigger script, uses a FSM-style loop and it runs through 5 cycles, I've never had any problems so far. Could you explain in what instance a a longer, complicated script might "null out" as a result of using FSM?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  6. #6
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Monkfishies 2.0, which I'm using as my random-trigger script, uses a FSM-style loop and it runs through 5 cycles, I've never had any problems so far. Could you explain in what instance a a longer, complicated script might "null out" as a result of using FSM?
    If a boolean ins't checked properly (such as like.. checking if at a mine is left out)

  7. #7
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    If a boolean ins't checked properly (such as like.. checking if at a mine is left out)
    Sorry I guess I don't follow what you mean. Could you provide an example script with a FSM loop that would 'null out'? Perhaps I could point out what the problem is.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  8. #8
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Sorry I guess I don't follow what you mean. Could you provide an example script with a FSM loop that would 'null out'? Perhaps I could point out what the problem is.
    It's not the FSM itself, it's in longer scripts where it could get more and more confusing


  9. #9
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    The warning he was giving there is that using a FSM style loop could just become difficult/complicated, but there's no issues from using this style of loop/architecture. Luckily we have Lape which makes such methods, like determining the script's current cycle, much easier. Here's an example:

    PS:
    Simba Code:
    Function getState(): State;
    begin
      if not isLoggedIn() then
        Exit;

      if Me.inCombat() then
        result := BANKWALK;

      if result <> 0 then
        Exit;

      if insideBank() then
      begin
        if (isInvFull() or (not hasEquipment)) then
          result := BANKING;
        if result <> 0 then
          Exit;
        result := SPOTWALK;
      end;
    end;

    Lape:
    Simba Code:
    Function getState(): State;
    begin
      if not isLoggedIn() then
        Exit;

      if Me.inCombat() then
        Exit(BANKWALK);

      if insideBank() then
      begin
        if (isInvFull() or (not hasEquipment)) then
          Exit(BANKING);
        result := SPOTWALK;
      end;
    end;

    With Lape we could exit and pass along the result of a function at the same time, so there won't ever be more than one result.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


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
  •