Results 1 to 6 of 6

Thread: DTM dependent findWorlds function

  1. #1
    Join Date
    Oct 2008
    Posts
    196
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default DTM dependent findWorlds function

    Before I start, let me just say that this is not my best work. This code was whipped up 4 months ago as a response to the tesseract not working for me; actually more like me not knowing how to use it . A lot of the code is redundant and most of it, if not all, can be summarised in fewer lines. I haven't gone back to this draft for mainly 2 reasons: firstly because it works perfectly and secondly it scares me to have to go through rewriting and debugging such long code, haha!

    Without further ado, let me present my findWorld include (attachement). The include has been split into 2 files, findWorlds 1 and 2, due to size issues. Please merge both files and rename include to findWorld.

    And as a freebie , here's the code that I use in my scripts to interact with this include just to give you guys an idea on how it works (This contains functions found only in my include, so it redundent without them)

    Simba Code:
    function SwitchWorld: boolean;
    var
      T, i, WorldNumber, x, y: integer;
      P, PP: TPoint;
      D: boolean;
    label StartLabel, LobbyLabel, OpenWorldScreenLabel, PlayLabel, ScrollLabel, SelectWorldLabel, notLoadingLabel;
    begin
      i := -1;
      while (i = -1) or (lobbyWorlds.isOpen() and (findCurrentWorld = WorldNumber)) do
        begin
          i := randomrange(0, high(Worlds));
          WorldNumber := Worlds[i];
        end;
      PP := Point(757 + randomrange(-3, 3), 375 + randomrange(-125, 125));
      Stat := 'Switching to world ' + IntToStr(WorldNumber);
      Stats;
      StartLabel:
      antiBan;
      CurrentWorld := findCurrentWorld
      if isServerOfflineLobby then
        begin
          while isServerOfflineLobby2 do
            begin
              wait(500 + round(reflexFactor/2) + random(0, 100));
              typeB(27);
              wait(100 + round(reflexFactor/2) + random(0, 100));
            end;
          while (CurrentWorld = Worlds[i]) do
            begin
              i := randomrange(0, high(Worlds));
              WorldNumber := Worlds[i];
            end;
        end;
      if isLobbySixHour then
        sixHourFix();
      if not lobby.isOpen and (not isLobbySixHour) then goto LobbyLabel;
      if not lobbyWorlds.isOpen() and (not isLobbySixHour) then goto OpenWorldScreenLabel;
      if lobbyWorlds.isOpen() and (not FindColorTolerance(x, y, 1610968, IntToBox(751, 237, 762, 252), 40)) and (not isLobbySixHour) then goto notLoadingLabel;
      if lobbyWorlds.isOpen() and (CurrentWorld = WorldNumber) and (not isLobbySixHour) then goto PlayLabel;
      if not findWorlds(P, IntToStr(WorldNumber), D) and (not isLobbySixHour) then goto ScrollLabel;
      goto SelectWorldLabel;

      LobbyLabel:
      if (CurrentWorld = WorldNumber) then exit;
      if isLoggedIn then
        begin
          Stat := 'Player is logged in, logging out to lobby';
          Stats;
          LogoutLobby;
        end else
          begin
            Stat := 'Logging in to lobby';
            Stats;
            LogToLobby;
          end;
      goto StartLabel;

      OpenWorldScreenLabel:
      Stat := 'Opening world screen';
      Stats;
      CustomMouse(0, Point(200 + randomrange(-MouseRandomness, MouseRandomness), 125 + randomrange(-MouseRandomness, MouseRandomness)), Mouse_Left);
      wait(300 + round(reflexFactor/2) + random(0, 100));
      T := 0;
      goto StartLabel;

      notLoadingLabel:
      Stat := 'Waiting for world list to pop up';
      Stats;
      if lobbyWorlds.isOpen() and not (FindColorTolerance(x, y, 1610968, IntToBox(751, 237, 762, 252), 40)) then
        repeat
          inc(T);
          wait(1000 + round(reflexFactor/2) + random(0, 100));
          if FindColorTolerance(x, y, 1610968, IntToBox(751, 237, 762, 252), 40) then
            break;
          if isLoggedIn then exit;
        until(T > 100);
      if (T > 100) and not (FindColorTolerance(x, y, 1610968, IntToBox(751, 237, 762, 252), 40)) then
        SixHourFix;
      goto StartLabel;

      ScrollLabel:
      Stat := 'Scrollin to world ' + IntToStr(WorldNumber);
      Stats;
      if not D then mouseScroll(PP, 5)
        else mouseScroll(PP, 5, false);
      wait(round(reflexFactor/2) + random(0, 100));
      goto StartLabel;

      PlayLabel:
      Stat := 'Clicking on play - '  + IntToStr(WorldNumber);
      Stats;
      CurrentWorld := findCurrentWorld;
      CustomMouse(0, Point(400 + randomrange(-MouseRandomness*10, MouseRandomness*10), 550 + randomrange(-MouseRandomness*2, MouseRandomness*2)), Mouse_Left);
      wait(600 + round(reflexFactor/2) + random(0, 100));
      T := 0;
      Stat := 'Waiting for player to be ingame';
      Stats;
      while isLoading do
        wait(round(reflexFactor/2) + random(0, 100));
      if isLoggedIn then
        begin
          wait(2000 + round(reflexFactor/2) + random(0, 100));
          DealWithOptions;
          DealWithMap;
          DealWithPoll;
          minimap.clickCompass();
          TRSMainscreen.setAngle(MS_ANGLE_HIGH);
          CustomMouse(0, Point(688 + randomrange(-MouseRandomness, MouseRandomness), 106 + randomrange(-50, 50)), Mouse_Move);
          if (not isBank) and (not isBackPack) then
            tabBackpack.open();
          exit;
        end
      goto StartLabel;

      SelectWorldLabel:
      Stat := 'Selecting world '  + IntToStr(WorldNumber);
      Stats;
      CustomMouse(0, Point(P.x + randomrange(-MouseRandomness, MouseRandomness*2), P.y + randomRange(round(-MouseRandomness/2), round(MouseRandomness/2))), Mouse_Left);
      goto StartLabel;
    end;

    Explanation of variables and functions in SwitchWorld:
    * Stats is my debugging and progress function, it prints script status at each significent script activity. Preceded by Stat variable which is a string declaring current activity
    * Worlds is an array of integer for worlds to select. Declared at start of script
    * PP is point located in scroll bar in the world screen for scrolling purposes, avoids highlighting worlds which can offset result.
    * MouseRandomness is a random variable generated at start of script and uniqu teo each user, part of human antiban, provides different randomness when clicking.
    * CustomMouse is my modified mouse function with added antiban capabilities, such as multiclicking and target missing. Kudos to @Clarity on this one.
    * reflexFactor is a random variable generated at start of script and unique to each user, part of human antiban, provides different waiting times for users. Idea by @Clarity as well
    * isLoading checks client for loading scr
    * DealWithOptions closes options menu ingame
    * DealWithMap closes map
    * DealWithPoll closes polls
    all the others are self-explanatory, I hope.

    Explanation of variables and functions in findWorld include:
    I'm not going to go through all variables because that would take an eternity, I'll just outline the paramters and general function.
    * var outPoint returns a point in the world list which is the selected worlds' position on screen.
    * World is the world to find and return the outPoint of.
    * Direction is a boolean that determines which direction in the world list to scroll to. True could be to scroll up and false to scroll down or vice versa, can't remember exact designation, so sorry . The world list must be arranged according to number, asecending, world 1 comes first and world 141 last.

    The findWorld function starts by finding all Stars - on the left end - in the world screen. Each Star represents a possible world. Each Star is used to generate the data for variables B1 to B13. These variables are WorldPos records which store information about single lines in world screen with a fully visible Star. The record includes BB which is the TBox for the world line; TPoints, named N0 and N00 up to N9 and N99, each is for storing the position of numbers found in the BB; and finally, there is World which is a string that is calculated by arranging all N variables in the correct order, it is also used in the end of the function to determine if it is the script parameter, World.

    The N variables in WorldPos are all calculated using carefully made DTMS. N variables with single digit, i.e. N5, stores the TPoint for number 5 if it is found in BB. It also determines that the first character is going to be 5. N variables with double digit, i.e. N44, stores the TPoint for number 4 if it is found in BB. It determines the second character of the world, if there is one.
    Examples:
    * we have N6 not equaling null and also N88 not equaling null, so the result for this specific N variable (single line) would be world 68
    * N1 is not null and all N double values are null results in finding world 1
    and so on and so forth

    Sometimes, a third digit is found and this is determined by calculating X value of N variables. (Don't remeber exact mechanism)

    Since all of my scripts run exclusively on members' worlds, this function is viable only for rs members. The script reads most lines perfectly but it sometimes fails to read worlds 21 to 24 for an unknown reason. In addition, DTMs have been updated for safe mode (originally opengl) so it might not work as well on all modes.

    What do you guys think about this? Post your thoughts please! Curious to know if this has been attempted before...
    Attached Files Attached Files
    Last edited by HT BaaFly; 12-16-2014 at 11:39 AM.

  2. #2
    Join Date
    Oct 2008
    Posts
    196
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    Side note: I have several fully functional scripts like nature rune graahk crafter, and air runner and a bunch of other small time scripts like herb cleaners that I'm hoping to release some of. What do you I should release? The nature crafter has the potential to run for 48 hours straight on (tested by myself) but I need to work on it for a while to add a personalised playing style.

  3. #3
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by HT BaaFly View Post
    Side note: I have several fully functional scripts like nature rune graahk crafter, and air runner and a bunch of other small time scripts like herb cleaners that I'm hoping to release some of. What do you I should release? The nature crafter has the potential to run for 48 hours straight on (tested by myself) but I need to work on it for a while to add a personalised playing style.
    I have a nature graahk crafter too I know other people that have one too. It would be interesting to see how we all went about certain things(pouch fixing etc, etc).

  4. #4
    Join Date
    Oct 2008
    Posts
    196
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    Quote Originally Posted by John View Post
    I have a nature graahk crafter too I know other people that have one too. It would be interesting to see how we all went about certain things(pouch fixing etc, etc).
    that's sweet bro! add my skype if you wanna talk about our scripts

  5. #5
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

  6. #6
    Join Date
    Oct 2008
    Posts
    196
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    but can't you just go:

    Simba Code:
    players[currentPlayer].switchToWorld(10);
    I could have, but tesseract was not working for me at the time so I had to find an alternative

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
  •