Results 1 to 20 of 20

Thread: [Color] Tutorial Island Runner

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

    Default [Color] Tutorial Island Runner

    All color
    You should be able to start it from almost any point in the tutorial.
    Just target the fixed window, check the settings, and press play.
    One potential issue: make sure you log in manually at least once on the client before starting the script.

    It's pretty hacky right now, but improvements should be easy to implement (e: for me). I might get around to some of them eventually, but in the meantime this should work.

    Simba Code:
    1. program Citrus_Tutorial_Island;
    2. {$LoadLib SimpleOCR}
    3.  
    4. const
    5. {settings begin}
    6.  
    7.   LOGIN = '';
    8.   PASSWORD = '';
    9.   RANDOMCHARACTER = True;
    10.   WORLDS = [301, 308, 316, 326, 335, 382, 383, 384, 393, 394];
    11.  
    12. {settings end}
    13.  
    14. type
    15.   TCTS2Settings = Record
    16.     Color, Tol: Int32; HueMod, SatMod: Extended;
    17.   end;
    18.  
    19.   TInventoryItem = Record
    20.     Length, Width, Height, ShadowLength, AverageColor: Int32; Text: TStringArray;
    21.   end;
    22.  
    23.   TTab = (CombatOptions, Stats, QuestList, Inventory, WornEquipment, Prayer, Magic, ClanChat, FriendsList, IgnoreList, Logout, Options, Emotes, MusicPlayer);
    24.  
    25.   TOption = Record
    26.     Text: String;
    27.     Bounds: TBox;
    28.   end;
    29.  
    30.   TOptionArray = Array of TOption;
    31.  
    32. const
    33.   MOUSE_MOVE = 3;
    34.  
    35.   FIXED_WIDTH = 765;
    36.   FIXED_HEIGHT = 503;
    37.  
    38.   OCR_RULES_UPTEXT: TCompareRules = [-1, 85, True, 55];
    39.   UPTEXT_BOX: TBox = [7, 7, 465, 25];
    40.  
    41.   MSX1 = 4;
    42.   MSY1 = 4;
    43.   MSX2 = 515;
    44.   MSY2 = 337;
    45.   MSCX = 259;
    46.   MSCY = 170;
    47.   MSCP: TPoint = [MSCX, MSCY];
    48.   MSBOX: TBox = [MSX1, MSY1, MSX2, MSY2];
    49.   CHATBOX: TBox = [6, 344, 513, 474];
    50.   INVBOX: TBox = [547, 204, 736, 465];
    51.  
    52.   MMX1 = 570;
    53.   MMY1 = 9;
    54.   MMX2 = 714;
    55.   MMY2 = 159;
    56.   MMCX = 642;
    57.   MMCY = 84;
    58.   MMCP: TPoint = [MMCX, MMCY];
    59.   MMBOX: TBox = [MMX1, MMY1, MMX2, MMY2];
    60.   MM_COMPASS_BOX: TBox = [546, 6, 574, 34];
    61.   MM_XP_DROP_BOX: TBox = [516, 21, 542, 47];
    62.  
    63.   BANK_CLOSE_BOX: TBox = [475, 12, 500, 34];
    64.  
    65.   TEXT_ORANGE    = 2070783;
    66.   TEXT_GREEN     = 49152;
    67.   TEXT_BLACK     = 0;
    68.   TEXT_WHITE     = $FFFFFF;
    69.   TEXT_BLUE      = 16711680;
    70.   TEXT_DARK_BLUE = 8388608;
    71.   TEXT_RED       = 128;
    72.  
    73.   YELLOW_ARROW_CTS2: TCTS2Settings = [7011068, 15, 0.02, 0.09];
    74.   GUIDE_RED_CTS2: TCTS2Settings = [792697, 9, 0.05, 0.42];
    75.   FIRE_FLAME_CTS2: TCTS2Settings = [2598615, 13, 0.19, 1.61];
    76.   CHICKEN_CTS2: TCTS2Settings = [6919082, 15, 0.03, 0.58];
    77.   INV_BG_CTS2: TCTS2Settings = [3424072, 5, 0.66, 1.26];
    78.  
    79.   TUTORIAL_STAGES: TStringArray = [
    80.                                    'Getting started',
    81.                                    'your player controls',
    82.                                    'r should acc',
    83.                                    'Interacting with scenery',
    84.                                    'Moving around',
    85.                                    'Viewing the items',
    86.                                    'Cut down a tree',
    87.                                    'Making a fire',
    88.                                    'ear the inventory button',
    89.                                    'Your skill stats',
    90.                                    'Catch some Shrimp',
    91.                                    'Cooking your shrimp',
    92.                                    'Burning your shrimp',
    93.                                    'your first RuneScape meal',
    94.                                    'used for navigation',
    95.                                    'out your music p',
    96.                                    'Making dough',
    97.                                    'Cooking dough',
    98.                                    'move on. Click on the fla',
    99.                                    'The music player',
    100.                                    'Emotes',
    101.                                    'Running',
    102.                                    'Run to the next guide',
    103.                                    'Talk with the Quest Guide',
    104.                                    'Open the Quest Journal',
    105.                                    'Your Quest Journal',
    106.                                    'the next area',
    107.                                    'Mining and Smithing',
    108.                                    'Prospecting',
    109.                                    'It''s tin',
    110.                                    'It''s copper',
    111.                                    'Mining.',
    112.                                    'Smelting',
    113.                                    'You''ve made a bronze bar!',
    114.                                    'Smithing a dagger',
    115.                                    'You''ve finished in this area',
    116.                                    'Combat.',
    117.                                    'Wielding weapons.',
    118.                                    'This is your worn inventory.',
    119.                                    'Worn interface',
    120.                                    'You''re now holding your dagger.',
    121.                                    'Unequipping items.',
    122.                                    'Combat interface.',
    123.                                    'This is your combat interface.',
    124.                                    'Attacking',
    125.                                    'Well done, you''ve made your first kill!',
    126.                                    'Rat ranging.',
    127.                                    'Moving on.',
    128.                                    'Banking.',
    129.                                    'This is your bank box.',
    130.                                    'This is a poll booth.',
    131.                                    'Financial advice.',
    132.                                    'Continue through the next door.',
    133.                                    'Prayer.',
    134.                                    'open the Prayer menu.',
    135.                                    'tell you about prayers',
    136.                                    'open your friends list',
    137.                                    'This is your friends list.',
    138.                                    'This is your ignore list.',
    139.                                    'find the path leading to your final',
    140.                                    'Your final instructor!',
    141.                                    'Open up your final menu.',
    142.                                    'Cast Wind Strike at a chicken.',
    143.                                    'You have almost completed the tutorial!'
    144.                                    ];
    145.  
    146.  
    147.  
    148. var
    149.   UpFont: TFontSet;
    150.   OCR: TSimpleOCR;
    151.   Tinderbox     : TInventoryItem = [80, 30, 28, 51, 7789174,  ['Tinderbox', 'inder']];
    152.   Logs          : TInventoryItem = [85, 31, 25, 44, 3698039, ['Logs', 'ogs']];
    153.   RawShrimp     : TInventoryItem = [137, 31, 23, 65, 7030867, ['Raw shrimps', 'shrimp']];
    154.   PotOfFlour    : TInventoryItem = [79, 26, 28, 35, 6100572, ['Pot of flour', 'of flour']];
    155.   BucketOfWater : TInventoryItem = [75, 20, 29, 37, 4950905, ['Bucket of water']];
    156.   BreadDough    : TInventoryItem = [75, 29, 23, 36, 7106950, ['Bread dough', 'read', 'dough']];
    157.   Bread         : TInventoryItem = [65, 27, 25, 43, 947766, ['Bread']];
    158.   TinOre        : TInventoryItem = [171, 32, 28, 75, 5164116, ['Tin ore']];
    159.   BronzeBar     : TInventoryItem = [62, 28, 22, 39, 2032043, ['Bronze bar', 'ronze ba']];
    160.   BronzeDagger  : TInventoryItem = [73, 21, 31, 49, 1365088, ['Bronze dagger', 'ronze da']];
    161.   BronzeSword   : TInventoryItem = [67, 20, 31, 48, 1433026, ['Bronze sword', 'ronze sw']];
    162.   WoodenShield  : TInventoryItem = [71, 27, 26, 39, 935175, ['Wooden shield', 'ooden sh']];
    163.   BronzeArrows50: TInventoryItem = [243, 31, 30, 71, 1446391, ['Bronze arrow', 'ronze ar']];
    164.   Shortbow      : TInventoryItem = [102, 30, 24, 66, 1121035, ['Shortbow', 'hortbo']];
    165.  
    166.  
    167. procedure Wait(w1, w2: Int32); Overload;
    168. begin
    169.   Wait(Random(w1, w2));
    170. end;
    171.  
    172. function FindColorsCTS2(var TPA: TPointArray; const B: TBox; const Settings: TCTS2Settings): Boolean;
    173. begin
    174.   SetColorToleranceSpeed(2);
    175.   SetToleranceSpeed2Modifiers(Settings.HueMod, Settings.SatMod);
    176.   Result := FindColorsTolerance(TPA, Settings.Color, B.X1, B.Y1, B.X2, B.Y2, Settings.Tol);
    177.   SetColorToleranceSpeed(1);
    178. end;
    179.  
    180. function FindColorsTolerance(var TPA: TPointArray; Color: Int32; b: TBox; Tol: Int32): Boolean; Overload;
    181. begin
    182.   Result := FindColorsTolerance(TPA, Color, b.x1, b.y1, b.x2, b.y2, Tol);
    183. end;
    184.  
    185. function FindColors(var TPA: TPointArray; Color: Int32; b: TBox): Boolean; Overload;
    186. begin
    187.   Result := FindColors(TPA, Color, b.x1, b.y1, b.x2, b.y2);
    188. end;
    189.  
    190. function CountColorTolerance(const Color: Int32; b: TBox; Tol: Int32): Int32; Overload;
    191. begin
    192.   Result := CountColorTolerance(Color, b.x1, b.y1, b.x2, b.y2, Tol);
    193. end;
    194.  
    195. function BitmapFromClient(const B: TBox): Int32; Overload;
    196. begin
    197.   Result := BitmapFromClient(B.X1, B.Y1, B.X2, B.Y2);
    198. end;
    199.  
    200. function BitmapFromTPA(const TPA: TPointArray; Color: Int32 = $FFFFFF): Int32;
    201. var
    202.   b: TBox;
    203.   temp: TPointArray;
    204. begin
    205.   b := GetTPABounds(tpa);
    206.   Result := CreateBitmap(b.x2 - b.x1 + 1, b.y2 - b.y1 + 1);
    207.   temp := CopyTPA(TPA);
    208.   OffsetTPA(temp, [-b.x1, -b.y1]);
    209.   DrawTPABitmap(Result, temp, Color);
    210. end;
    211.  
    212. //https://github.com/SRL/SRL-6/blob/d5817b11a391940d12180740a914a4cf5d72b204/lib/utilities/math.simba#L59
    213. function GridBox(Slot, Columns, Rows, w, h, DiffX, DiffY: Int32; StartPoint: TPoint): TBox;
    214. begin
    215.   Result.x1 := (StartPoint.x + ((Slot mod Columns) * DiffX) - (w div 2));
    216.   Result.y1 := (StartPoint.y + ((Slot div Columns) * DiffY) - (h div 2));
    217.   Result.x2 := (Result.x1 + w);
    218.   Result.y2 := (Result.y1 + h);
    219. end;
    220.  
    221. function GetSlotBox(const Slot: Int32): TBox;
    222. begin
    223.   if (not InRange(Slot, 1, 28)) then Exit;
    224.   Result := GridBox(Slot - 1, 4, 7, 31, 31, 42, 36, [578, 228]);
    225. end;
    226.  
    227. function BoxWidth(const B: TBox): Int32;
    228. begin
    229.   Result := B.X2 - B.X1 + 1;
    230. end;
    231.  
    232. function BoxHeight(const B: TBox): Int32;
    233. begin
    234.   Result := B.Y2 - B.Y1 + 1;
    235. end;
    236.  
    237. procedure Mouse(p: TPoint; Button: Int32);
    238. var
    239.   x, y: Int32;
    240. begin
    241.   MoveMouse(p.x, p.y);
    242.   if (Button = MOUSE_MOVE) then Exit();
    243.   Wait(15, 22);
    244.   HoldMouse(p.x, p.y, Button);
    245.   Wait(69, 120);
    246.   GetMousePos(x, y);
    247.   ReleaseMouse(x, y, Button);
    248. end;
    249.  
    250. procedure FastClick(Button: Int32);
    251. var
    252.   x, y: Int32;
    253. begin
    254.   GetMousePos(x, y);
    255.   HoldMouse(x, y, Button);
    256.   Wait(69, 120);
    257.   ReleaseMouse(x, y, Button);
    258. end;
    259.  
    260. procedure MouseBox(B: TBox; Button: Int32);
    261. begin
    262.   Mouse(MiddleBox(B), Button);
    263. end;
    264.  
    265. procedure TypeSend(Text: String; Enter: Boolean);
    266. var
    267.   Shift: Boolean;
    268.   i: Int32;
    269. begin
    270.   for i := 1 to Length(Text) do
    271.   begin
    272.     Shift := (Pos(Text[i], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+<>?:"{}~|') > 0);
    273.     if Shift then
    274.     begin
    275.       KeyDown(VK_SHIFT);
    276.       Wait(44, 69);
    277.     end;
    278.     KeyDown(GetKeyCode(Text[i]));
    279.     Wait(44, 69);
    280.     KeyUp(GetKeyCode(Text[i]));
    281.     Wait(44, 69);
    282.     if Shift then
    283.     begin
    284.       KeyUp(VK_SHIFT);
    285.       Wait(44, 69);
    286.     end;
    287.   end;
    288.   if Enter then
    289.   begin
    290.     KeyDown(VK_RETURN);
    291.     Wait(44, 69);
    292.     KeyUp(VK_RETURN);
    293.   end;
    294. end;
    295.  
    296. function ClientColors(x1, y1, w, h: Int32): T2DIntegerArray;
    297. var
    298.   bmp: Int32;
    299. begin
    300.   bmp := BitmapFromClient(x1, y1, x1 + w, y1 + h);
    301.   try
    302.     GetBitmapSize(bmp, w, h);
    303.     Result := GetBitmapAreaColors(bmp, 0, 0, w - 1, h - 1);
    304.   finally
    305.     FreeBitmap(bmp);
    306.   end;
    307. end;
    308.  
    309. function IsUpText(Text: String; WaitTime: Int32 = -1): Boolean;
    310. var
    311.   t: UInt32;
    312. begin
    313.   t := GetTickCount + WaitTime;
    314.   repeat
    315.     Result := (Pos(Text, OCR.Recognize(UPTEXT_BOX, OCR_RULES_UPTEXT)) > 0);
    316.     if Result then Exit;
    317.     Wait(4);
    318.   until (GetTickCount > t);
    319. end;
    320.  
    321. function IsUpTextMulti(Text: TStringArray; WaitTime: Int32 = -1): Boolean;
    322. var
    323.   t: UInt32;
    324. begin
    325.   t := GetTickCount + WaitTime;
    326.   repeat
    327.     Result := IsArrInStr(Text, OCR.Recognize(UPTEXT_BOX, OCR_RULES_UPTEXT));
    328.     if Result then Exit;
    329.     Wait(4);
    330.   until (GetTickCount > t);
    331. end;
    332.  
    333. function IsXPOpen(): Boolean;
    334. begin
    335.   Result := (CountColor(2306104, 389, 0, 515, 40) > 244);
    336. end;
    337.  
    338. function GetXP(): Int32;
    339. var
    340.   tpa: TPointArray;
    341.   atpa: T2DPointArray;
    342. begin
    343.   if IsXPOpen() then
    344.   begin
    345.     if FindColors(tpa, $FFFFFF, 389, 0, 515, 40) then
    346.     begin
    347.       atpa := ClusterTPA(tpa, 1);
    348.       Result := StrToIntDef(ExtractFromStr(GetTextATPA(atpa, 9, 'StatChars07'), NUMBERS), -1);
    349.     end;
    350.   end;
    351. end;
    352.  
    353. //https://github.com/SRL/SRL/blob/master/shared/text.simba#L18
    354. function FindTextIn(var Matches: TPointArray; const Text, Font: String; const Color: Int32; const b: TBox): Boolean;
    355. var
    356.   w, h: Int32;
    357.   TPA, TextTPA: TPointArray;
    358. begin
    359.   if FindColors(TPA, Color, b) then
    360.   begin
    361.     SetLength(Matches, 0);
    362.     TextTPA := TPAFromText(Text, Font, w, h);
    363.     Result := FindTextTPAinTPA(h-1, TextTPA, TPA, Matches);
    364.   end;
    365. end;
    366.  
    367. function FindText(var Matches: TPointArray; Text, Font: String; const Color: Int32): Boolean;
    368. var
    369.   w, h: Int32;
    370. begin
    371.   GetClientDimensions(w, h);
    372.   Result := FindTextIn(Matches, Text, Font, Color, [0, 0, w-1, h-1]);
    373. end;
    374.  
    375. function WaitFunc(Func: function: Boolean; WaitTime, WaitInterval: Int32; Condition: Boolean = True): Boolean;
    376. var
    377.   t: UInt32;
    378. begin
    379.   t := GetTickCount() + WaitTime;
    380.   repeat
    381.     Result := Func();
    382.     if (Result = Condition) then Exit(True);
    383.     Wait(WaitInterval);
    384.   until (GetTickCount() > t);
    385.   Result := False;
    386. end;
    387.  
    388. function IsWalking(): boolean;
    389. var
    390.   bmp1, bmp2, w, h: Int32;
    391. begin
    392.   try
    393.     bmp1 := BitmapFromClient(MSX1, MSY1, MSX2, MSY2);
    394.     Wait(69);
    395.     bmp2 := BitmapFromClient(MSX1, MSY1, MSX2, MSY2);
    396.     GetBitmapSize(bmp1, w, h);
    397.     Result := (CalculatePixelShift(bmp1, bmp2, [0, 0, w-1, h-1]) > 69696);
    398.   finally
    399.     if BitmapExists(bmp1) then FreeBitmap(bmp1);
    400.     if BitmapExists(bmp2) then FreeBitmap(bmp2);
    401.   end;
    402. end;
    403.  
    404. function WaitForInventoryShift(const WaitTime, WaitInterval: Int32): Boolean;
    405. var
    406.   BMP1, BMP2, w, h: Int32;
    407.   t: UInt32;
    408. begin
    409.   Result := False;
    410.   t := GetTickCount() + WaitTime;
    411.   BMP1 := BitmapFromClient(INVBOX);
    412.   GetBitmapSize(BMP1, w, h);
    413.   try
    414.     repeat
    415.       Wait(WaitInterval);
    416.       BMP2 := BitmapFromClient(INVBOX);
    417.       Result := (CalculatePixelShift(BMP1, BMP2, [0, 0, w-1, h-1]) > 0);
    418.       if Result then Exit;
    419.       FreeBitmap(BMP2);
    420.     until (GetTickCount() > t);
    421.   finally
    422.     FreeBitmap(BMP1);
    423.     if BitmapExists(BMP2) then FreeBitmap(BMP2);
    424.   end;
    425. end;
    426.  
    427.  function IsOptionOpen(var b: TBox): Boolean;
    428. var
    429.   tpa: TPointArray;
    430.   atpa: T2DPointArray;
    431. begin
    432.   if FindColors(tpa, 4674653, 0, 0, FIXED_WIDTH-1, FIXED_HEIGHT-1) then
    433.   begin
    434.     atpa := ClusterTPA(tpa, 5);
    435.     if (Length(atpa) > 0) then
    436.     begin
    437.       SortATPASize(atpa, True);
    438.       b := GetTPABounds(atpa[0]);
    439.       Exit(True);
    440.     end;
    441.   end;
    442. end;
    443.  
    444. function OptionOpen(): Boolean;
    445. var
    446.   b: TBox;
    447. begin
    448.   Result := IsOptionOpen(b);
    449. end;
    450.  
    451. function GetOptions(): TOptionArray;
    452. var
    453.   n, bmp, w, h, OldT: Int32;
    454.   tpa, bg, black: TPointArray;
    455.   atpa: T2DPointArray;
    456.   b, b2, b3: TBox;
    457. begin
    458.   if IsOptionOpen(b) then
    459.   begin
    460.     OldT := GetImageTarget;
    461.     b2 := [b.x1 + 4, b.y1 + 21, b.x2 - 2, b.y1 + 21 + 13];
    462.     SetLength(Result, 99);
    463.     while (b2.y2 < b.y2) do
    464.     begin
    465.       tpa := TPAFromBox(b2);
    466.       if FindColors(bg, 4674653, b2) then
    467.       begin
    468.         if FindColors(black, 0, b2) then
    469.         begin
    470.           tpa := ClearTPAFromTPA(tpa, bg);
    471.           tpa := ClearTPAFromTPA(tpa, black);
    472.           b3 := GetTPABounds(tpa);
    473.           bmp := BitmapFromTPA(tpa);
    474.           SetTargetBitmap(bmp);
    475.           GetBitmapSize(bmp, w, h);
    476.           Result[n] := [GetTextAtEx(0, 0, w-1, h-1, 0, 3, 9, $FFFFFF, 0, 'UpChars07'), b2];
    477.           Inc(n);
    478.           SetImageTarget(OldT);
    479.           FreeBitmap(bmp);
    480.         end;
    481.       end;
    482.       b2.y1 += 15;
    483.       b2.y2 += 15;
    484.     end;
    485.     SetLength(Result, n);
    486.   end;
    487. end;
    488.  
    489. function ChooseOption(Text: TStringArray; Button: Int32 = MOUSE_LEFT): Boolean;
    490. var
    491.   i, j, x, y: Int32;
    492.   Options: TOptionArray;
    493. begin
    494.   Options := GetOptions();
    495.   if (Length(Options) > 0) then
    496.   begin
    497.     for i := 0 to High(Text) do
    498.     begin
    499.       for j := 0 to High(Options) do
    500.       begin
    501.         if (Pos(Text[i], Options[j].Text) > 0) then
    502.         begin
    503.           Mouse(MiddleBox(Options[j].Bounds), Button);
    504.           Exit(True);
    505.         end;
    506.       end;
    507.     end;
    508.   end;
    509. end;
    510.  
    511. function IsBankOpen(): Boolean;
    512. var
    513.   Matches: TPointArray;
    514. begin
    515.   Result := (FindTextIn(Matches, 'Rearrange', 'SmallChars07', 2070783, MSBOX) or
    516.              FindTextIn(Matches, 'The Bank of RuneScape', 'UpChars07',  2070783, MSBOX));
    517. end;
    518.  
    519. function IsBankClosed(): Boolean;
    520. begin
    521.   Result := (not IsBankOpen);
    522. end;
    523.  
    524. function IsLoggedIn(): Boolean;
    525. begin
    526.   Result := (GetColor(FIXED_WIDTH - 1, 0) = 3494488);
    527. end;
    528.  
    529. function IsLoginScreen(): Boolean;
    530. var
    531.   Matches: TPointArray;
    532. begin
    533.   Result := FindTextIn(Matches, 'World', 'UpChars07', $FFFFFF, [0, 420, 111, FIXED_HEIGHT-1]);
    534. end;
    535.  
    536. procedure ClickToSwitch;
    537. begin
    538.   Mouse([55, 480], MOUSE_LEFT);
    539. end;
    540.  
    541. function IsWorldScreen(): Boolean;
    542. var
    543.   Matches: TPointArray;
    544. begin
    545.   Result := FindText(Matches, 'Type', 'UpChars07', $FFFFFF);
    546. end;
    547.  
    548. function FindWorld(World: Int32): Boolean;
    549. var
    550.   Matches: TPointArray;
    551. begin
    552.   Result := FindTextIn(Matches, IntToStr(World), 'UpChars07', $FFFFFF, [0, 420, 111, FIXED_HEIGHT-1]);
    553. end;
    554.  
    555. function ClickWorld(World: Int32): Boolean;
    556. var
    557.   WorldBMP, ClientBMP, OldT, NewT, x, y: Int32;
    558. begin
    559.   Result := False;
    560.   WorldBMP := BitmapFromText(IntToStr(World), 'UpChars07');
    561.   ClientBMP := BitmapFromClient(152, 49, 611, 475);
    562.   try
    563.     FastReplaceColor(ClientBMP, 0, $FFFFFF);
    564.     OldT := GetImageTarget;
    565.     NewT := SetTargetBitmap(ClientBMP);
    566.     Result := FindBitmap(WorldBMP, x, y);
    567.     SetImageTarget(OldT);
    568.     if Result then Mouse([x + 152, y + 49], MOUSE_LEFT);
    569.   finally
    570.     FreeTarget(NewT);
    571.     FreeBitmap(ClientBMP);
    572.     FreeBitmap(WorldBMP);
    573.   end;
    574. end;
    575.  
    576. function SelectWorld(WorldNumber: Int32): Boolean;
    577. var
    578.   WorldNumberBMP, x, y: Int32;
    579. begin
    580.   Result := False;
    581.   if FindWorld(WorldNumber) then Exit(True);
    582.   WorldNumberBMP := BitmapFromText(IntToStr(WorldNumber), 'UpChars07');
    583.   try
    584.     if IsLoginScreen then
    585.     begin
    586.       ClickToSwitch;
    587.       if (not WaitFunc(@IsWorldScreen, 4567, 234, True)) then Exit;
    588.     end;
    589.     if IsWorldScreen() then
    590.     begin
    591.       if ClickWorld(WorldNumber) then
    592.       begin
    593.         Result := WaitFunc(@IsLoginScreen, 4567, 234, True);
    594.       end;
    595.     end;
    596.   finally
    597.     FreeBitmap(WorldNumberBMP);
    598.   end;
    599. end;
    600.  
    601. function IsWelcomeBox(): Boolean;
    602. var
    603.   TPA: TPointArray;
    604. begin
    605.   Result := FindText(TPA, 'Welcome to', 'UpChars07', $00FFFF);
    606. end;
    607.  
    608. function IsEnterBox(): Boolean;
    609. var
    610.   TPA: TPointArray;
    611. begin
    612.   Result := FindText(TPA, 'Enter your', 'UpChars07', $00FFFF);
    613. end;
    614.  
    615. function ClickExistingUser(): Boolean;
    616. var
    617.   TPA: TPointArray;
    618. begin
    619.   if IsWelcomeBox() then
    620.   begin
    621.     if FindText(TPA, 'Existing', 'UpChars07', $FFFFFF) then
    622.     begin
    623.       Mouse(TPA[0], MOUSE_LEFT);
    624.       Result := WaitFunc(@IsEnterBox, 2345, 234, True);
    625.     end;
    626.   end;
    627. end;
    628.  
    629. function DoLogin(UN, PW: String; World: Int32): Boolean;
    630. var
    631.   TPA: TPointArray;
    632. begin
    633.   if SelectWorld(World) then
    634.   begin
    635.     if ClickExistingUser() then
    636.     begin
    637.       if (not FindText(TPA, UN, 'UpChars07', $FFFFFF)) then
    638.       begin
    639.         TypeSend(UN, True);
    640.         Wait(121, 212);
    641.       end;
    642.       TypeSend(PW, True);
    643.       Result := WaitFunc(@IsLoginScreen, 9876, 678, False);
    644.     end;
    645.   end;
    646. end;
    647.  
    648. function ItemAverageColor(Slot: Int32): Int32;
    649. var
    650.   i: Int32;
    651.   B: TBox;
    652.   Colors: TIntegerArray;
    653.   BGTPA, ShadowTPA, BorderTPA, TPA: TPointArray;
    654. begin
    655.   B := GetSlotBox(Slot);
    656.   if FindColors(BorderTPA, 65536, B) then
    657.   begin
    658.     if (FindColors(ShadowTPA, 2105392, B) or FindColors(ShadowTPA, 3355443, B)) then
    659.     begin
    660.       if FindColorsCTS2(BGTPA, B, INV_BG_CTS2) then
    661.       begin
    662.         TPA := TPAFromBox(B);
    663.         TPA := ClearTPAFromTPA(TPA, CombineTPA(CombineTPA(BorderTPA, BGTPA), ShadowTPA));
    664.         Colors := GetColors(TPA);
    665.         ClearSameIntegers(Colors);
    666.         Result := AverageTIA(Colors);
    667.       end;
    668.     end;
    669.   end;
    670. end;
    671.  
    672. function TInventoryItem.GetSlot(): Int32;
    673. var
    674.   i: Int32;
    675.   B: TBox;
    676.   TPA, ShadowTPA: TPointArray;
    677. begin
    678.   for i := 1 to 28 do
    679.   begin
    680.     if (FindColors(TPA, 65536, GetSlotBox(i)) and (FindColors(ShadowTPA, 2105392, GetSlotBox(i)) or FindColors(ShadowTPA, 3355443, GetSlotBox(i)))) then
    681.     begin
    682.       B := GetTPABounds(TPA);
    683.       if ((Self.Length = (High(TPA) + 1)) and
    684.           (Self.Width = BoxWidth(B)) and
    685.           (Self.Height = BoxHeight(B)) and
    686.           (Self.ShadowLength = (High(ShadowTPA) + 1)) and
    687.           (Self.AverageColor = ItemAverageColor(i))) then
    688.         Exit(i);
    689.     end;
    690.   end;
    691.   Result := -1;
    692. end;
    693.  
    694. function TInventoryItem.Count(): Int32;
    695. var
    696.   i: Int32;
    697.   B: TBox;
    698.   TPA: TPointArray;
    699. begin
    700.   for i := 1 to 28 do
    701.   begin
    702.     if FindColors(TPA, 65536, GetSlotBox(i)) then
    703.     begin
    704.       B := GetTPABounds(TPA);
    705.       if ((Self.Length = (High(TPA) + 1)) and
    706.           (Self.Width = BoxWidth(B)) and
    707.           (Self.Height = BoxHeight(B))) then
    708.         Inc(Result);
    709.     end;
    710.   end;
    711. end;
    712.  
    713. function TInventoryItem.Click(Button: Byte = MOUSE_LEFT): Boolean;
    714. var
    715.   Slot: Int32;
    716. begin
    717.   Slot := Self.GetSlot();
    718.   if (Slot > 1) then
    719.   begin
    720.     MouseBox(GetSlotBox(Slot), MOUSE_MOVE);
    721.     if IsUpTextMulti(Self.Text, 444) then
    722.     begin
    723.       FastClick(Button);
    724.       Result := True;
    725.     end;
    726.   end;
    727. end;
    728.  
    729. function TInventoryItem.Find(): Boolean;
    730. begin
    731.   Result := (Self.GetSlot() > 1);
    732. end;
    733.  
    734. function IsDesignScreen(): Boolean;
    735. var
    736.   TPA: TPointArray;
    737. begin
    738.   Result := FindText(TPA, 'design your player', 'UpChars07', TEXT_ORANGE);
    739. end;
    740.  
    741. function DoDesignScreen(RandomChar: Boolean): Boolean;
    742. const
    743.   DESIGN_BOX: TBox = [80, 70, 140, 320];
    744.   COLOUR_BOX: TBox = [380, 70, 440, 250];
    745.   DESIGNS: TStringArray = ['Head', 'Jaw', 'Torso', 'Arms', 'Hands', 'Legs', 'Feet'];
    746.   COLOURS: TStringArray = ['Hair', 'Torso', 'Legs', 'Feet', 'Skin'];
    747. var
    748.   i: Int32;
    749.   TPA: TPointArray;
    750. begin
    751.   if RandomChar then
    752.   begin
    753.     for i := 0 to High(DESIGNS) do
    754.     begin
    755.       if FindTextIn(TPA, DESIGNS[i], 'SmallChars07', TEXT_ORANGE, DESIGN_BOX) then
    756.       begin
    757.         OffsetTPA(TPA, [70, 0]);
    758.         for 0 to Random(9) do
    759.         begin
    760.           Mouse(TPA[0], MOUSE_LEFT);
    761.           Wait(222, 321);
    762.         end;
    763.       end;
    764.     end;
    765.     for i := 0 to High(COLOURS) do
    766.     begin
    767.       if FindTextIn(TPA, COLOURS[i], 'SmallChars07', TEXT_ORANGE, COLOUR_BOX) then
    768.       begin
    769.         OffsetTPA(TPA, [70, 0]);
    770.         for 0 to Random(9) do
    771.         begin
    772.           Mouse(TPA[0], MOUSE_LEFT);
    773.           Wait(222, 321);
    774.         end;
    775.       end;
    776.     end;
    777.   end;
    778.   if FindText(TPA, 'Accept', 'SmallChars07', TEXT_GREEN) then
    779.   begin
    780.     Mouse(TPA[0], MOUSE_LEFT);
    781.     Result := WaitFunc(@IsDesignScreen, 4567, 456, False);
    782.   end;
    783. end;
    784.  
    785. procedure ResetCamera();
    786. begin
    787.   MouseBox((MM_COMPASS_BOX), MOUSE_LEFT);
    788.   Wait(222);
    789.   KeyDown(VK_UP);
    790.   Wait(969, 1234);
    791.   KeyUp(VK_UP);
    792. end;
    793.  
    794. function FindYellowArrow(var P: TPoint): Boolean;
    795. var
    796.   c: Int32;
    797.   TPA: TPointArray;
    798. begin
    799.   while (not FindColorsCTS2(TPA, MSBOX, YELLOW_ARROW_CTS2)) do
    800.   begin
    801.     Wait(22);
    802.     if (Inc(c) > 22) then Exit;
    803.   end;
    804.   if InRange(Length(TPA), 200, 220) then
    805.   begin
    806.     P := MedianTPA(TPA);
    807.     Result := True;
    808.   end;
    809. end;
    810.  
    811. function ClickHereToContinue(): Boolean;
    812. var
    813.   TPA: TPointArray;
    814. begin
    815.   if (FindTextIn(TPA, 'Click here to continue', 'CharsNPC07', TEXT_BLUE, CHATBOX) or
    816.       FindTextIn(TPA, 'Click here to continue', 'CharsNPC07', TEXT_WHITE, CHATBOX)) then
    817.   begin
    818.     OffsetTPA(TPA, [69, 4]);
    819.     Mouse(TPA[0], MOUSE_LEFT);
    820.     Result := True;
    821.   end;
    822. end;
    823.  
    824. function PleaseWait(): Boolean;
    825. var
    826.   TPA: TPointArray;
    827. begin
    828.   Result := (FindTextIn(TPA, 'wait', 'CharsNPC07', TEXT_BLUE, CHATBOX) or
    829.              FindTextIn(TPA, 'wait', 'CharsNPC07', TEXT_WHITE, CHATBOX));
    830. end;
    831.  
    832. function IsConversation(): Boolean;
    833. var
    834.   TPA: TPointArray;
    835. begin
    836.   Result := FindTextIn(TPA, 'Click here to continue', 'CharsNPC07', TEXT_BLUE, CHATBOX);
    837. end;
    838.  
    839. function DoConversation(TextOptions: TStringArray = []): Boolean;
    840. var
    841.   i: Int32;
    842.   TPA: TPointArray;
    843. begin
    844.   repeat
    845.     if PleaseWait() then
    846.     begin
    847.       Wait(234, 432);
    848.       Continue;
    849.     end;
    850.     if ClickHereToContinue() then
    851.     begin
    852.       Wait(121, 212);
    853.       Continue;
    854.     end;
    855.     if (Length(TextOptions) > 0) then
    856.     begin
    857.       for i := 0 to High(TextOptions) do
    858.       begin
    859.         if FindTextIn(TPA, TextOptions[i], 'CharsNPC07', TEXT_BLACK, CHATBOX) then
    860.         begin
    861.           OffsetTPA(TPA, [4, 4]);
    862.           Mouse(TPA[0], MOUSE_LEFT);
    863.           Wait(121, 212);
    864.           Break;
    865.         end;
    866.       end;
    867.       if (i <= High(TextOptions)) then Continue;
    868.     end;
    869.     Break;
    870.   until False;
    871.   Result := True;
    872. end;
    873.  
    874. function IsTalkingTo(NPCName: String; WaitTime: Int32 = -1): Boolean;
    875. var
    876.   t: UInt32;
    877.   TPA: TPointArray;
    878. begin
    879.   t := GetTickCount + WaitTime;
    880.   repeat
    881.     Result := FindTextIn(TPA, NPCName, 'CharsNPC07', TEXT_RED, CHATBOX);
    882.     if Result then Exit;
    883.     Wait(44);
    884.   until (GetTickCount > t);
    885. end;
    886.  
    887. function TalkToNPC(Name: String; Text: TStringArray; WaitTime: Int32): Boolean;
    888. var
    889.   P: TPoint;
    890. begin
    891.   if FindYellowArrow(P) then
    892.   begin
    893.     P.Y += 30;
    894.     Mouse(P, MOUSE_MOVE);
    895.     if IsUpTextMulti(Text, 444) then
    896.     begin
    897.       FastClick(MOUSE_LEFT);
    898.       Result := IsTalkingTo(Name, WaitTime) or IsConversation();
    899.     end;
    900.   end;
    901. end;
    902.  
    903. function TalkToRuneScapeGuide2(): Boolean;
    904. var
    905.   TPA: TPointArray;
    906. begin
    907.   if FindColorsCTS2(TPA, MSBOX, GUIDE_RED_CTS2) then
    908.   begin
    909.     Mouse(MedianTPA(TPA), MOUSE_MOVE);
    910.     if IsUpTextMulti(['RuneScape Guide', 'uide', 'cape'], 696) then
    911.     begin
    912.       FastClick(MOUSE_LEFT);
    913.       Result := IsTalkingTo('RuneScape Guide', 4567);
    914.     end;
    915.   end;
    916. end;
    917.  
    918. function ClickTab(Tab: TTab): Boolean;
    919. begin
    920.   MouseBox(GridBox(Int32(Tab), 7, 2, 32, 35, 33, 298, [543, 185]), MOUSE_LEFT);
    921.   Result := True;
    922. end;
    923.  
    924. function IsOptionsTab(): Boolean;
    925. var
    926.   TPA: TPointArray;
    927. begin
    928.   Result := FindTextIn(TPA, 'Advanced options', 'SmallChars07', TEXT_ORANGE, INVBOX);
    929. end;
    930.  
    931. function AdjustBrightness(): Boolean;
    932. begin
    933.   if IsOptionsTab() then
    934.   begin
    935.     Mouse([715, 309], MOUSE_MOVE);
    936.     if IsUpTextMulti(['djust', 'creen', 'ightn'], 1234) then
    937.     begin
    938.       FastClick(MOUSE_LEFT);
    939.       Result := True;
    940.     end;
    941.   end;
    942. end;
    943.  
    944. function OpenDoor(): Boolean;
    945. var
    946.   P: TPoint;
    947. begin
    948.   if FindYellowArrow(P) then
    949.   begin
    950.     P.Y += 30;
    951.     Mouse(P, MOUSE_MOVE);
    952.     if IsUpTextMulti(['pen Do', 'Open Door', 'oor', 'Open', 'Door'], 696) then
    953.     begin
    954.       FastClick(MOUSE_LEFT);
    955.       Result := True;
    956.     end;
    957.   end;
    958. end;
    959.  
    960. function WalkToYellowArrow(): Boolean;
    961. var
    962.   c: Int32;
    963.   TPA: TPointArray;
    964. begin
    965.   while (not FindColorsCTS2(TPA, MMBOX, YELLOW_ARROW_CTS2)) do
    966.   begin
    967.     Wait(22);
    968.     if (Inc(c) > 22) then Exit;
    969.   end;
    970.   if InRange(Length(TPA), 30, 40) then
    971.   begin
    972.     OffsetTPA(TPA, [0, 4]);
    973.     Mouse(MedianTPA(TPA), MOUSE_LEFT);
    974.     if WaitFunc(@IsWalking, 1696, 345, True) then
    975.       while IsWalking() do
    976.         Wait(222);
    977.     Result := True;
    978.   end;
    979. end;
    980.  
    981. function WalkToRedArrow(): Boolean;
    982. var
    983.   c: Int32;
    984.   TPA: TPointArray;
    985. begin
    986.   while (not FindColors(TPA, 255, MMBOX)) do
    987.   begin
    988.     Wait(22);
    989.     if (Inc(c) > 22) then Exit;
    990.   end;
    991.   if InRange(Length(TPA), 80, 90) then
    992.   begin
    993.     OffsetTPA(TPA, [-9, 0]);
    994.     Mouse(MedianTPA(TPA), MOUSE_LEFT);
    995.     if WaitFunc(@IsWalking, 1696, 345, True) then
    996.       while IsWalking() do
    997.         Wait(222);
    998.     Result := True;
    999.   end;
    1000. end;
    1001.  
    1002. function ChopTree(): Boolean;
    1003. var
    1004.   P: TPoint;
    1005. begin
    1006.   if FindYellowArrow(P) then
    1007.   begin
    1008.     P.Y += 30;
    1009.     Mouse(P, MOUSE_MOVE);
    1010.     if IsUpTextMulti(['Chop', 'down', 'Tree', 'hop do'], 696) then
    1011.     begin
    1012.       FastClick(MOUSE_LEFT);
    1013.       Result := WaitForInventoryShift(12345, 969);
    1014.     end;
    1015.   end;
    1016. end;
    1017.  
    1018. function WaitXPChange(WaitTime: Int32): Boolean;
    1019. var
    1020.   XP: Int32;
    1021.   t: UInt32;
    1022. begin
    1023.   t := GetTickCount() + WaitTime;
    1024.   XP := GetXP();
    1025.   repeat
    1026.     Result := (GetXP() > XP);
    1027.     if Result then Exit();
    1028.     Wait(WaitTime div 9);
    1029.   until (GetTickCount() > t);
    1030. end;
    1031.  
    1032. function UseItemOnItem(ItemA, ItemB: TInventoryItem): Boolean;
    1033. var
    1034.   SlotA, SlotB: Int32;
    1035. begin
    1036.   SlotA := ItemA.GetSlot();
    1037.   SlotB := ItemB.GetSlot();
    1038.   if ((SlotA + SlotB) > 1) then
    1039.   begin
    1040.     MouseBox(GetSlotBox(SlotA), MOUSE_MOVE);
    1041.     if IsUpTextMulti(ItemA.Text, 696) then
    1042.     begin
    1043.       FastClick(MOUSE_LEFT);
    1044.       Wait(222);
    1045.       MouseBox(GetSlotBox(SlotB), MOUSE_MOVE);
    1046.       if IsUpTextMulti(ItemB.Text, 696) then
    1047.       begin
    1048.         FastClick(MOUSE_LEFT);
    1049.         Result := True;
    1050.       end;
    1051.     end;
    1052.   end;
    1053. end;
    1054.  
    1055. function LightFire(): Boolean;
    1056. begin
    1057.   if UseItemOnItem(Tinderbox, Logs) then
    1058.   begin
    1059.     Wait(444);
    1060.     if WaitForInventoryShift(2345, 234) then
    1061.     begin
    1062.       Result := WaitXPChange(12345);
    1063.     end else
    1064.     begin
    1065.       Mouse([300, 170], MOUSE_RIGHT);
    1066.       ChooseOption(['Walk', 'here', 'lk he', 'alk h', 'k her']);
    1067.     end;
    1068.   end;
    1069. end;
    1070.  
    1071. function CatchShrimp(): Boolean;
    1072. var
    1073.   P: TPoint;
    1074. begin
    1075.   if FindYellowArrow(P) then
    1076.   begin
    1077.     P.Y += 30;
    1078.     Mouse(P, MOUSE_MOVE);
    1079.     if IsUpTextMulti(['Net', 'Fishing', 'spot', 'ish'], 696) then
    1080.     begin
    1081.       FastClick(MOUSE_RIGHT);
    1082.       if ChooseOption(['Walk', 'here']) then
    1083.       begin
    1084.         Wait(444);
    1085.         while IsWalking() do Wait(444);
    1086.         if FindYellowArrow(P) then
    1087.         begin
    1088.           P.Y += 30;
    1089.           repeat
    1090.             Mouse(P, MOUSE_MOVE);
    1091.             if IsUpTextMulti(['Net', 'Fishing', 'spot', 'ish'], 696) then
    1092.             begin
    1093.               FastClick(MOUSE_LEFT);
    1094.               WaitForInventoryShift(9876, 456);
    1095.             end;
    1096.           until (RawShrimp.Count() > 1);
    1097.           Result := True;
    1098.         end;
    1099.       end;
    1100.     end;
    1101.   end;
    1102. end;
    1103.  
    1104. function CookShrimp(): Boolean;
    1105. var
    1106.   ShrimpSlot, i: Int32;
    1107.   TPA: TPointArray;
    1108.   ATPA: T2DPointArray;
    1109. begin
    1110.   ShrimpSlot := RawShrimp.GetSlot();
    1111.   if (ShrimpSlot > 0) then
    1112.   begin
    1113.     if FindColorsCTS2(TPA, MSBOX, FIRE_FLAME_CTS2) then
    1114.     begin
    1115.       ATPA := ClusterTPA(TPA, 2);
    1116.       FilterTPAsBetween(ATPA, 0, 22);
    1117.       if (Length(ATPA) < 1) then Exit;
    1118.       SortATPAFromMidPoint(ATPA, MSCP);
    1119.       MouseBox(GetSlotBox(ShrimpSlot), MOUSE_MOVE);
    1120.       if IsUpTextMulti(RawShrimp.Text, 1234) then
    1121.       begin
    1122.         FastClick(MOUSE_LEFT);
    1123.         for i := 0 to High(ATPA) do
    1124.         begin
    1125.           Mouse(MedianTPA(ATPA[i]), MOUSE_MOVE);
    1126.           if IsUpTextMulti(['Fire'], 696) then
    1127.           begin
    1128.             FastClick(MOUSE_RIGHT);
    1129.             if ChooseOption(['Fire']) then
    1130.             begin
    1131.               Result := WaitForInventoryShift(12345, 696);
    1132.               Exit;
    1133.             end;
    1134.           end;
    1135.         end;
    1136.       end
    1137.     end;
    1138.   end;
    1139. end;
    1140.  
    1141. function OpenGate(Offset: TPoint): Boolean;
    1142. var
    1143.   P: TPoint;
    1144. begin
    1145.   if FindYellowArrow(P) then
    1146.   begin
    1147.     P.X += Offset.X;
    1148.     P.Y += Offset.Y;
    1149.     Mouse(P, MOUSE_MOVE);
    1150.     if IsUpTextMulti(['Open', 'Gate', 'pen', 'ate'], 696) then
    1151.     begin
    1152.       FastClick(MOUSE_LEFT);
    1153.       Result := True;
    1154.     end;
    1155.   end;
    1156. end;
    1157.  
    1158. function CookDough(): Boolean;
    1159. var
    1160.   P: TPoint;
    1161. begin
    1162.   if Bread.Find() then Exit(True);
    1163.   if BreadDough.Click(MOUSE_LEFT) then
    1164.   begin
    1165.     if FindYellowArrow(P) then
    1166.     begin
    1167.       P.Y += 30;
    1168.       Mouse(P, MOUSE_MOVE);
    1169.       if IsUpTextMulti(['Range', 'ange', 'nge'], 696) then
    1170.       begin
    1171.         FastClick(MOUSE_LEFT);
    1172.         Wait(444);
    1173.         Result := WaitForInventoryShift(4567, 456);
    1174.       end;
    1175.     end;
    1176.   end;
    1177. end;
    1178.  
    1179. function ClickYesEmote(): Boolean;
    1180. begin
    1181.   MouseBox([549, 211, 590, 258], MOUSE_MOVE);
    1182.   if IsUpText('Yes', 444) then
    1183.   begin
    1184.     FastClick(MOUSE_LEFT);
    1185.     Result := True;
    1186.   end;
    1187. end;
    1188.  
    1189. function ClickRun(): Boolean;
    1190. begin
    1191.   MouseBox([599, 425, 638, 464], MOUSE_MOVE);
    1192.   if IsUpText('Toggle Run', 444) then
    1193.   begin
    1194.     FastClick(MOUSE_LEFT);
    1195.     Result := True;
    1196.   end;
    1197. end;
    1198.  
    1199. function DescendLadder(): Boolean;
    1200. var
    1201.   P: TPoint;
    1202. begin
    1203.   if FindYellowArrow(P) then
    1204.   begin
    1205.     P.Y += 30;
    1206.     Mouse(P, MOUSE_MOVE);
    1207.     if IsUpTextMulti(['Climb', 'down', 'Ladder', 'dder', 'limb'], 696) then
    1208.     begin
    1209.       FastClick(MOUSE_LEFT);
    1210.       Result := True;
    1211.     end;
    1212.   end;
    1213. end;
    1214.  
    1215. function WalkToMiningGuide(): Boolean;
    1216. begin
    1217.   Mouse([615, 130], MOUSE_LEFT);
    1218.   if WaitFunc(@IsWalking, 1444, 234, True) then
    1219.     while IsWalking() do
    1220.       Wait(222);
    1221. end;
    1222.  
    1223. function Prospect(): Boolean;
    1224. var
    1225.   P: TPoint;
    1226. begin
    1227.   if FindYellowArrow(P) then
    1228.   begin
    1229.     P.Y += 30;
    1230.     Mouse(P, MOUSE_MOVE);
    1231.     if IsUpTextMulti(['Mine', 'Rocks', 'ine', 'ocks'], 696) then
    1232.     begin
    1233.       FastClick(MOUSE_RIGHT);
    1234.       if ChooseOption(['Prospect']) then
    1235.       begin
    1236.         Result := WaitFunc(@IsConversation, 5678, 567, True);
    1237.       end;
    1238.     end;
    1239.   end;
    1240. end;
    1241.  
    1242. function Mining(): Boolean;
    1243. var
    1244.   P: TPoint;
    1245. begin
    1246.   if FindYellowArrow(P) then
    1247.   begin
    1248.     P.Y += 30;
    1249.     Mouse(P, MOUSE_MOVE);
    1250.     if IsUpTextMulti(['Mine', 'Rocks', 'ine', 'ocks'], 696) then
    1251.     begin
    1252.       FastClick(MOUSE_LEFT);
    1253.       Result := WaitForInventoryShift(9876, 456);
    1254.     end;
    1255.   end;
    1256. end;
    1257.  
    1258. function Smelt(): Boolean;
    1259. var
    1260.   P: TPoint;
    1261. begin
    1262.   if BronzeBar.Find() then Exit(True);
    1263.   if TinOre.Click(MOUSE_LEFT) then
    1264.   begin
    1265.     if FindYellowArrow(P) then
    1266.     begin
    1267.       P.Y += 30;
    1268.       Mouse(P, MOUSE_MOVE);
    1269.       if IsUpTextMulti(['Furnace', 'urna', 'nace'], 696) then
    1270.       begin
    1271.         FastClick(MOUSE_LEFT);
    1272.         Wait(444);
    1273.         Result := WaitForInventoryShift(4567, 456);
    1274.       end;
    1275.     end;
    1276.   end;
    1277. end;
    1278.  
    1279. function IsConversation2(): Boolean;
    1280. var
    1281.   TPA: TPointArray;
    1282. begin
    1283.   Result := FindTextIn(TPA, 'Click to continue', 'UpChars07', TEXT_DARK_BLUE, CHATBOX);
    1284. end;
    1285.  
    1286. function DoConversation2(): Boolean;
    1287. var
    1288.   TPA: TPointArray;
    1289. begin
    1290.   if FindTextIn(TPA, 'Click to continue', 'UpChars07', TEXT_DARK_BLUE, CHATBOX) then
    1291.   begin
    1292.     OffsetTPA(TPA, [4, 4]);
    1293.     Mouse(TPA[0], MOUSE_LEFT);
    1294.     Result := WaitFunc(@IsConversation2, 2345, 234, False);
    1295.   end;
    1296. end;
    1297.  
    1298. function IsSmithScreen(): Boolean;
    1299. var
    1300.   TPA: TPointArray;
    1301. begin
    1302.   Result := FindTextIn(TPA, 'would you like to make', 'UpChars07', TEXT_ORANGE, MSBOX);
    1303. end;
    1304.  
    1305. function SmithDagger(): Boolean;
    1306. var
    1307.   TPA: TPointArray;
    1308. begin
    1309.   if FindTextIn(TPA, 'Dagger', 'StatChars07', TEXT_WHITE, MSBOX) then
    1310.   begin
    1311.     OffsetTPA(TPA, [4, 0]);
    1312.     Mouse(TPA[0], MOUSE_MOVE);
    1313.     if IsUpTextMulti(['Smith', 'Bronze', 'dagger'], 1234) then
    1314.     begin
    1315.       FastClick(MOUSE_LEFT);
    1316.       Result := WaitForInventoryShift(3456, 345);
    1317.     end;
    1318.   end;
    1319. end;
    1320.  
    1321. function Smith(): Boolean;
    1322. var
    1323.   P: TPoint;
    1324. begin
    1325.   if BronzeDagger.Find() then Exit(True);
    1326.   if BronzeBar.Click(MOUSE_LEFT) then
    1327.   begin
    1328.     if FindYellowArrow(P) then
    1329.     begin
    1330.       P.Y += 30;
    1331.       Mouse(P, MOUSE_MOVE);
    1332.       if IsUpTextMulti(['Anvil', 'nvil'], 696) then
    1333.       begin
    1334.         FastClick(MOUSE_LEFT);
    1335.         Wait(444);
    1336.         if WaitFunc(@IsSmithScreen, 2345, 234, True) then
    1337.         begin
    1338.           if SmithDagger() then
    1339.           begin
    1340.             Result := True;
    1341.           end;
    1342.         end;
    1343.       end;
    1344.     end;
    1345.   end;
    1346. end;
    1347.  
    1348. function IsEquipScreen(): Boolean;
    1349. var
    1350.   TPA: TPointArray;
    1351. begin
    1352.   Result := FindTextIn(TPA, 'bonus', 'UpChars07', TEXT_ORANGE, MSBOX);
    1353. end;
    1354.  
    1355. function ViewEquipmentStats(): Boolean;
    1356. begin
    1357.   MouseBox([554, 413, 593, 452], MOUSE_MOVE);
    1358.   if IsUpTextMulti(['View', 'equipment', 'stats'], 696) then
    1359.   begin
    1360.     FastClick(MOUSE_LEFT);
    1361.     Result := WaitFunc(@IsEquipScreen, 2345, 234, True);
    1362.   end;
    1363. end;
    1364.  
    1365. function CloseEquipScreen(): Boolean;
    1366. begin
    1367.   if (not IsEquipScreen()) then Exit(True);
    1368.   MouseBox([481, 15, 506, 37], MOUSE_MOVE);
    1369.   if IsUpTextMulti(['Close', 'lose'], 696) then
    1370.   begin
    1371.     FastClick(MOUSE_LEFT);
    1372.     Result := WaitFunc(@IsEquipScreen, 2345, 234, False);
    1373.   end;
    1374. end;
    1375.  
    1376. function EquipSwordAndShield(): Boolean;
    1377. begin
    1378.   Result := (BronzeSword.Click() and WoodenShield.Click())
    1379. end;
    1380.  
    1381. function SitBackAndWatch(): Boolean;
    1382. var
    1383.   TPA: TPointArray;
    1384. begin
    1385.   Result := (FindTextIn(TPA, 'Sit back and watch', 'CharsNPC07', TEXT_BLUE, CHATBOX) or
    1386.              FindTextIn(TPA, 'Rat ranging.', 'CharsNPC07', TEXT_BLUE, CHATBOX));
    1387. end;
    1388.  
    1389. function AttackRat(): Boolean;
    1390. var
    1391.   P: TPoint;
    1392. begin
    1393.   if FindYellowArrow(P) then
    1394.   begin
    1395.     P.Y += 30;
    1396.     Mouse(P, MOUSE_MOVE);
    1397.     if IsUpTextMulti(['Attack', 'Giant', 'rat', 'ttac', 'iant'], 696) then
    1398.     begin
    1399.       FastClick(MOUSE_LEFT);
    1400.       if WaitFunc(@SitBackAndWatch, 12345, 1234, True) then
    1401.       begin
    1402.         Result := WaitFunc(@SitBackAndWatch, 12345, 1234, False);
    1403.       end;
    1404.     end;
    1405.   end;
    1406. end;
    1407.  
    1408. function ExitRatArea(): Boolean;
    1409. var
    1410.   TPA: TPointArray;
    1411.   ATPA: T2DPointArray;
    1412. begin
    1413.   if FindColorsTolerance(TPA, 237, MMBOX, 9) then
    1414.   begin
    1415.     ATPA := ClusterTPA(TPA, 1);
    1416.     FilterTPAsBetween(ATPA, 0, 4);
    1417.     if (Length(ATPA) < 1) then Exit;
    1418.     TPA := ATPA[0];
    1419.     if (MedianTPA(TPA).X < MMCX) then Exit(True);
    1420.     Mouse(MedianTPA(TPA), MOUSE_LEFT);
    1421.     if WaitFunc(@IsWalking, 1456, 345, True) then
    1422.       while IsWalking() do Wait(121);
    1423.     Mouse([290, 160], MOUSE_MOVE);
    1424.     if IsUpTextMulti(['Open', 'Gate', 'pen', 'ate'], 1234) then
    1425.     begin
    1426.       FastClick(MOUSE_LEFT);
    1427.       Result := True;
    1428.     end;
    1429.   end;
    1430. end;
    1431.  
    1432. function EquipBowAndArrows(): Boolean;
    1433. begin
    1434.   if ((not BronzeArrows50.Find()) and (not Shortbow.Find())) then
    1435.     Exit(True);
    1436.   Result := (BronzeArrows50.Click() and Shortbow.Click())
    1437. end;
    1438.  
    1439. function AscendLadder(): Boolean;
    1440. var
    1441.   P: TPoint;
    1442. begin
    1443.   if FindYellowArrow(P) then
    1444.   begin
    1445.     P.Y += 30;
    1446.     Mouse(P, MOUSE_MOVE);
    1447.     if IsUpTextMulti(['Climb', 'up', 'Ladder', 'dder', 'limb'], 696) then
    1448.     begin
    1449.       FastClick(MOUSE_LEFT);
    1450.       Result := True;
    1451.     end;
    1452.   end;
    1453. end;
    1454.  
    1455. function ClickBank(): Boolean;
    1456. var
    1457.   P: TPoint;
    1458. begin
    1459.   if FindYellowArrow(P) then
    1460.   begin
    1461.     P.Y += 30;
    1462.     Mouse(P, MOUSE_MOVE);
    1463.     if IsUpTextMulti(['Bank', 'ank'], 696) then
    1464.     begin
    1465.       FastClick(MOUSE_LEFT);
    1466.       Result := IsTalkingTo('Banker', 4567);
    1467.     end;
    1468.   end;
    1469. end;
    1470.  
    1471. function CloseBank(): Boolean;
    1472. begin
    1473.   if IsBankClosed() then Exit(True);
    1474.   MouseBox(BANK_CLOSE_BOX, MOUSE_MOVE);
    1475.   if IsUpTextMulti(['Close', 'lose', 'Clo'], 696) then
    1476.   begin
    1477.     FastClick(MOUSE_LEFT);
    1478.     Result := WaitFunc(@IsBankClosed, 2345, 234, True);
    1479.   end;
    1480. end;
    1481.  
    1482. function IsPollScreen(): Boolean;
    1483. var
    1484.   TPA: TPointArray;
    1485. begin
    1486.   Result := FindTextIn(TPA, 'History', 'StatChars07', TEXT_ORANGE, MSBOX);
    1487. end;
    1488.  
    1489. function ClickPollBooth(): Boolean;
    1490. var
    1491.   P: TPoint;
    1492. begin
    1493.   if FindYellowArrow(P) then
    1494.   begin
    1495.     P.Y += 30;
    1496.     Mouse(P, MOUSE_MOVE);
    1497.     if IsUpTextMulti(['Poll', 'booth', 'ooth', 'oll', 'll bo'], 696) then
    1498.     begin
    1499.       FastClick(MOUSE_LEFT);
    1500.       if WaitFunc(@IsConversation, 3456, 345, True) then
    1501.       begin
    1502.         if DoConversation() then
    1503.         begin
    1504.           Result := WaitFunc(@IsPollScreen, 2345, 234, True);
    1505.         end;
    1506.       end;
    1507.     end;
    1508.   end;
    1509. end;
    1510.  
    1511. function WalkToChapel(): Boolean;
    1512. var
    1513.   i: Int32;
    1514.   TPA: TPointArray;
    1515.   ATPA: T2DPointArray;
    1516. begin
    1517.   if FindColorsTolerance(TPA, 237, MMBOX, 9) then
    1518.   begin
    1519.     ATPA := ClusterTPA(TPA, 1);
    1520.     FilterTPAsBetween(ATPA, 0, 7);
    1521.     if (Length(ATPA) <> 1) then Exit;
    1522.     Mouse(MedianTPA(ATPA[0]), MOUSE_LEFT);
    1523.     if WaitFunc(@IsWalking, 1696, 456, True) then
    1524.       while IsWalking() do Wait(234);
    1525.     Result := True;
    1526.   end;
    1527. end;
    1528.  
    1529. function OpenChapelDoor(): Boolean;
    1530. begin
    1531.   Mouse([240, 169], MOUSE_MOVE);
    1532.   if IsUpText('Open', 696) then
    1533.   begin
    1534.     FastClick(MOUSE_LEFT);
    1535.     Wait(969);
    1536.   end;
    1537.   Result := True;
    1538. end;
    1539.  
    1540. function StrikeChicken(): Boolean;
    1541. var
    1542.   i: Int32;
    1543.   TPA: TPointArray;
    1544.   ATPA: T2DPointArray;
    1545. begin
    1546.   MouseBox([583, 220, 606, 243], MOUSE_MOVE);
    1547.   if IsUpTextMulti(['Wind', 'Strike', 'ind', 'trike'], 696) then
    1548.   begin
    1549.     FastClick(MOUSE_LEFT);
    1550.     if FindColorsCTS2(TPA, MSBOX, CHICKEN_CTS2) then
    1551.     begin
    1552.       ATPA := ClusterTPA(TPA, 2);
    1553.       FilterTPAsBetween(ATPA, 0, 22);
    1554.       if (Length(ATPA) < 1) then Exit;
    1555.       SortATPAFromMidPoint(ATPA, MSCP);
    1556.       for i := 0 to High(ATPA) do
    1557.       begin
    1558.         Mouse(MedianTPA(ATPA[i]), MOUSE_MOVE);
    1559.         if IsUpTextMulti(['Chicken', 'hick', 'cken'], 444) then
    1560.         begin
    1561.           FastClick(MOUSE_LEFT);
    1562.           Result := WaitXPChange(4567);
    1563.         end;
    1564.       end;
    1565.     end;
    1566.   end;
    1567. end;
    1568.  
    1569. function IsRunOn(): Boolean;
    1570. const
    1571.   COLOR = 6998507;
    1572.   TOL = 55;
    1573.   B: TBox = [570, 127, 590, 147];
    1574. begin
    1575.   Result := (CountColorTolerance(COLOR, B, TOL) > 69);
    1576. end;
    1577.  
    1578. function MMClickRun(): Boolean;
    1579. const
    1580.   B: TBox = [544, 126, 593, 151];
    1581. begin
    1582.   MouseBox(B, MOUSE_MOVE);
    1583.   if IsUpTextMulti(['Toggle', 'Run', 'oggle', 'ggle'], 696) then
    1584.   begin
    1585.     FastClick(MOUSE_LEFT);
    1586.     Result := True;
    1587.   end;
    1588. end;
    1589.  
    1590. function GetTutorialStage(): Int32;
    1591. var
    1592.   i: Int32;
    1593.   TPA: TPointArray;
    1594. begin
    1595.   for i := 0 to High(TUTORIAL_STAGES) do
    1596.   begin
    1597.     if (FindTextIn(TPA, TUTORIAL_STAGES[i], 'CharsNPC07', TEXT_BLUE, CHATBOX) or
    1598.         FindTextIn(TPA, TUTORIAL_STAGES[i], 'CharsNPC07', TEXT_BLACK, CHATBOX)) then
    1599.       Exit(i);
    1600.   end;
    1601.   Result := -1;
    1602. end;
    1603.  
    1604. function Finished(): Boolean;
    1605. var
    1606.   TPA: TPointArray;
    1607. begin
    1608.    Result := FindTextIn(TPA, '*', 'SmallChars07', TEXT_BLUE, CHATBOX);
    1609. end;
    1610.  
    1611. procedure Setup();
    1612. var
    1613.   w, h: Int32;
    1614. begin
    1615.   GetClientDimensions(w, h);
    1616.   if ((w <> FIXED_WIDTH) or (h <> FIXED_HEIGHT)) then
    1617.   begin
    1618.     WriteLn('client dimensions are wrong');
    1619.     TerminateScript();
    1620.   end;
    1621.  
    1622.   UpFont.Load('UpChars07_s');
    1623.   OCR.Init(UpFont);
    1624.  
    1625.  
    1626.   if (not IsLoggedIn()) then DoLogin(LOGIN, PASSWORD, WORLDS[Random(High(WORLDS))]);
    1627.   if (not WaitFunc(@IsLoggedIn, 9876, 678, True)) then TerminateScript();
    1628.   ResetCamera(); Wait(444);
    1629.   if (not IsXPOpen()) then MouseBox(MM_XP_DROP_BOX, MOUSE_LEFT);
    1630.   if (not IsRunOn()) then MMClickRun();
    1631. end;
    1632.  
    1633. procedure Mainloop();
    1634. begin
    1635.   case GetTutorialStage() of
    1636.     -1:
    1637.     begin
    1638.       if Finished() then TerminateScript();
    1639.       Wait(444);
    1640.       DoConversation();
    1641.       DoConversation2();
    1642.     end;
    1643.  
    1644.     0: //design character and talk to guide
    1645.     begin
    1646.       if IsDesignScreen() then
    1647.         if DoDesignScreen(RANDOMCHARACTER) then
    1648.           Wait(444);
    1649.  
    1650.       if (not IsXPOpen()) then MouseBox(MM_XP_DROP_BOX, MOUSE_LEFT);
    1651.  
    1652.       if TalkToNPC('RuneScape Guide', ['RuneScape', 'Guide', 'uneSc', 'uide'], 4567) then
    1653.         if DoConversation(['I am an experienced player']) then Wait(444);
    1654.     end;
    1655.  
    1656.     1: //player controls
    1657.     begin
    1658.       if ClickTab(Options) then Wait(444);
    1659.       if WaitFunc(@IsOptionsTab, 1234, 234, True) then
    1660.         if AdjustBrightness() then
    1661.           Wait(444);
    1662.     end;
    1663.  
    1664.     2: //talk to guide again, no arrow this time
    1665.     begin
    1666.       if TalkToRuneScapeGuide2() then
    1667.         if DoConversation() then
    1668.           Wait(444);
    1669.     end;
    1670.  
    1671.     3, 14, 19, 50, 52, 59: //open door
    1672.     begin
    1673.       if (not IsRunOn()) then
    1674.         if MMClickRun() then
    1675.           Wait(444);
    1676.       if OpenDoor() then
    1677.       begin
    1678.         if WaitFunc(@IsWalking, 1234, 234, True) then
    1679.           while IsWalking() do
    1680.             Wait(222);
    1681.       end else
    1682.       if WalkToYellowArrow() then
    1683.         Wait(444);
    1684.     end;
    1685.  
    1686.     4: //walk and talk to surivival
    1687.     begin
    1688.       if TalkToNPC('Survival Expert', ['Survival', 'Expert', 'urviv', 'pert'], 4567) then
    1689.       begin
    1690.         if DoConversation() then
    1691.           Wait(444);
    1692.       end else
    1693.       if WalkToYellowArrow() then
    1694.         Wait(444);
    1695.     end;
    1696.  
    1697.     5: //click inventory
    1698.     begin
    1699.       if ClickTab(Inventory) then
    1700.         Wait(444);
    1701.     end;
    1702.  
    1703.     6: //cut down a tree
    1704.     begin
    1705.       if ChopTree() then
    1706.         if DoConversation() then
    1707.           Wait(444);
    1708.     end;
    1709.  
    1710.     7: //making a fire
    1711.     begin
    1712.       if LightFire() then
    1713.         Wait(444);
    1714.     end;
    1715.  
    1716.     8: //click stats
    1717.     begin
    1718.       ClickTab(Stats);
    1719.     end;
    1720.  
    1721.     9: //speak to survival expert again
    1722.     begin
    1723.       if TalkToNPC('Survival Expert', ['Survival', 'Expert', 'urviv', 'pert'], 4567) then
    1724.       begin
    1725.         if DoConversation() then
    1726.           Wait(444);
    1727.       end else
    1728.       if WalkToYellowArrow()
    1729.         then Wait(444);
    1730.     end;
    1731.  
    1732.     10: //catch some shrimp
    1733.     begin
    1734.       if ClickTab(Inventory) then
    1735.         Wait(444);
    1736.       if WalkToYellowArrow() then
    1737.         if CatchShrimp() then
    1738.           Wait(444);
    1739.     end;
    1740.  
    1741.     11, 12: //cook shrimp
    1742.     begin
    1743.       if CookShrimp() then
    1744.         Wait(444);
    1745.     end;
    1746.  
    1747.     13, 35: //walk to and open gate
    1748.     begin
    1749.       if WalkToYellowArrow() then
    1750.       begin
    1751.         if OpenGate([-4, 30]) then
    1752.         begin
    1753.           Wait(999);
    1754.           while IsWalking() do
    1755.             Wait(444);
    1756.         end;
    1757.       end;
    1758.     end;
    1759.  
    1760.     15: //talk to master chef
    1761.     begin
    1762.       if TalkToNPC('Master Chef', ['Master', 'Chef', 'aste', 'hef'], 4567) then
    1763.         if DoConversation() then
    1764.           Wait(444);
    1765.     end;
    1766.  
    1767.     16: //making dough
    1768.     begin
    1769.       ClickTab(Inventory);
    1770.       if UseItemOnItem(PotOfFlour, BucketOfWater) then
    1771.         Wait(696);
    1772.     end;
    1773.  
    1774.     17: //cooking dough
    1775.     begin
    1776.       if (not CookDough()) then
    1777.         WalkToYellowArrow() else
    1778.         Wait(696);
    1779.     end;
    1780.  
    1781.     18: //click music tab
    1782.     begin
    1783.       if ClickTab(MusicPlayer) then
    1784.         Wait(444);
    1785.     end;
    1786.  
    1787.     20: //emotes
    1788.     begin
    1789.       if ClickTab(Emotes) then
    1790.       begin
    1791.         Wait(224);
    1792.         if ClickYesEmote() then
    1793.           Wait(969);
    1794.       end;
    1795.     end;
    1796.  
    1797.     21: //running
    1798.     begin
    1799.       if ClickTab(Options) then
    1800.       begin
    1801.         Wait(444);
    1802.         if ClickRun() then
    1803.           Wait(969);
    1804.       end;
    1805.     end;
    1806.  
    1807.     22: //run to next guide
    1808.     begin
    1809.       if WalkToYellowArrow() then
    1810.       begin
    1811.         if OpenDoor() then
    1812.         begin
    1813.           Wait(696);
    1814.           while IsWalking() do
    1815.             Wait(222);
    1816.         end;
    1817.       end else
    1818.       if WalkToRedArrow() then
    1819.         Wait(444);
    1820.     end;
    1821.  
    1822.     23, 25: //talk to quest guide
    1823.     begin
    1824.       if TalkToNPC('Quest Guide', ['Quest', 'Guide', 'uest', 'uide'], 4567) then
    1825.       begin
    1826.         if DoConversation() then
    1827.           Wait(444);
    1828.       end else
    1829.       if WalkToYellowArrow() then
    1830.         Wait(444);
    1831.     end;
    1832.  
    1833.     24: //open the quest journal
    1834.     begin
    1835.       if ClickTab(QuestList) then
    1836.         Wait(444);
    1837.     end;
    1838.  
    1839.     26: //go down ladder
    1840.     begin
    1841.       if DescendLadder() then
    1842.         Wait(2345) else
    1843.       if WalkToYellowArrow() then
    1844.         Wait(444);
    1845.     end;
    1846.  
    1847.     27, 30, 33: //talk to mining instructor
    1848.     begin
    1849.       if TalkToNPC('Mining Instructor', ['Mining', 'Instructor', 'ining', 'nstr'], 2345) then
    1850.       begin
    1851.         if DoConversation() then
    1852.           Wait(444);
    1853.       end else
    1854.       if WalkToYellowArrow() then
    1855.         Wait(444) else
    1856.       if WalkToRedArrow() then
    1857.         Wait(444) else
    1858.       if WalkToMiningGuide() then
    1859.         Wait(444);
    1860.     end;
    1861.  
    1862.     28, 29: //prospecting
    1863.     begin
    1864.       if Prospect() then
    1865.       begin
    1866.         if DoConversation() then
    1867.           Wait(444);
    1868.       end else
    1869.       if WalkToYellowArrow() then
    1870.         Wait(444);
    1871.     end;
    1872.  
    1873.     31: //mining
    1874.     begin
    1875.       if ClickTab(Inventory) then
    1876.         if Mining() then
    1877.         begin
    1878.           if DoConversation() then
    1879.             Wait(696);
    1880.         end else
    1881.         if WalkToYellowArrow() then
    1882.           Wait(444);
    1883.     end;
    1884.  
    1885.     32: //smelting
    1886.     begin
    1887.       if WalkToYellowArrow() then
    1888.         if Smelt() then
    1889.           if DoConversation2() then
    1890.             Wait(444);
    1891.     end;
    1892.  
    1893.     34: //smith a dagger
    1894.     begin
    1895.       if WalkToYellowArrow() then
    1896.         if Smith() then
    1897.           Wait(444);
    1898.     end;
    1899.  
    1900.     36: //talk to combat instructor
    1901.     begin
    1902.       if (not TalkToNPC('Combat Instructor', ['Combat', 'Instructor', 'omba', 'nstr'], 2345)) then
    1903.         WalkToYellowArrow() else
    1904.         if DoConversation() then
    1905.           Wait(444);
    1906.     end;
    1907.  
    1908.     37: //click equip tab
    1909.     begin
    1910.       if ClickTab(WornEquipment) then
    1911.         Wait(696);
    1912.     end;
    1913.  
    1914.     38: //view equip stats
    1915.     begin
    1916.       if ViewEquipmentStats() then
    1917.         Wait(696);
    1918.     end;
    1919.  
    1920.     39: //equip dagger
    1921.     begin
    1922.       if IsEquipScreen() then
    1923.         if BronzeDagger.Click() then
    1924.           Wait(696);
    1925.     end;
    1926.  
    1927.     40: //talk to comabt instructor again
    1928.     begin
    1929.       if CloseEquipScreen() then
    1930.         if TalkToNPC('Combat Instructor', ['Combat', 'Instructor', 'omba', 'nstr'], 2345) then
    1931.         begin
    1932.           if DoConversation() then
    1933.             Wait(696);
    1934.         end else
    1935.         if WalkToYellowArrow() then
    1936.           Wait(696);
    1937.     end;
    1938.  
    1939.     41: //equip sword and shield
    1940.     begin
    1941.       if ClickTab(Inventory) then
    1942.         if EquipSwordAndShield() then
    1943.           Wait(696);
    1944.     end;
    1945.  
    1946.     42: //combat interface
    1947.     begin
    1948.       if ClickTab(CombatOptions) then
    1949.         Wait(696);
    1950.     end;
    1951.  
    1952.     43: //gate
    1953.     begin
    1954.       if WalkToYellowArrow() then
    1955.       begin
    1956.         Wait(444);
    1957.         if OpenGate([1, 20]) then
    1958.         begin
    1959.           Wait(444, 696);
    1960.           while IsWalking() do Wait(444);
    1961.         end;
    1962.       end;
    1963.     end;
    1964.  
    1965.     44: //attack rat
    1966.     begin
    1967.       if AttackRat() then
    1968.         Wait(696) else
    1969.         if WalkToYellowArrow() then
    1970.           Wait(696);
    1971.     end;
    1972.  
    1973.     45: //exit rat area and comabt instructor again
    1974.     begin
    1975.       if ExitRatArea() then
    1976.       begin
    1977.         Wait(1234);
    1978.         if WalkToYellowArrow() then
    1979.           if TalkToNPC('Combat Instructor', ['Combat', 'Instructor', 'omba', 'nstr'], 2345) then
    1980.             if DoConversation() then
    1981.               Wait(444);
    1982.       end;
    1983.     end;
    1984.  
    1985.     46: //rat ranging
    1986.     begin
    1987.       if ClickTab(Inventory) then Wait(444);
    1988.       if EquipBowAndArrows() then
    1989.         Wait(696) else
    1990.         Exit;
    1991.       if (not AttackRat()) then
    1992.         if WalkToYellowArrow() then
    1993.           Wait(444);
    1994.     end;
    1995.  
    1996.     47: //climb ladder
    1997.     begin
    1998.       if (not AscendLadder()) then
    1999.         WalkToYellowArrow() else
    2000.           Wait(2345);
    2001.     end;
    2002.  
    2003.     48: //banking
    2004.     begin
    2005.       if (not ClickBank()) then
    2006.         WalkToYellowArrow() else
    2007.         if DoConversation(['Yes']) then
    2008.           if IsBankOpen() then
    2009.             Wait(696);
    2010.     end;
    2011.  
    2012.     49: //close bank
    2013.     begin
    2014.       if CloseBank() then
    2015.         if ClickPollBooth() then
    2016.           Wait(696);
    2017.     end;
    2018.  
    2019.     51: //talk to financial advisor
    2020.     begin
    2021.       if TalkToNPC('Financial Advisor', ['Financial', 'Advisor', 'inanc', 'dviso'], 2345) then
    2022.         if DoConversation() then
    2023.           Wait(696);
    2024.     end;
    2025.  
    2026.     53: //prayer
    2027.     begin
    2028.       if WalkToChapel() then
    2029.         if OpenChapelDoor() then
    2030.           if TalkToNPC('Brother Brace', ['Brother', 'Brace', 'rothe', 'race'], 2345) then
    2031.           begin
    2032.             if DoConversation() then
    2033.               Wait(696);
    2034.           end else
    2035.           if WalkToYellowArrow() then
    2036.             Wait(444);
    2037.     end;
    2038.  
    2039.     54: //click prayer tab
    2040.     begin
    2041.       if ClickTab(Prayer) then
    2042.         Wait(444);
    2043.     end;
    2044.  
    2045.     55, 58: //talk to brother again
    2046.     begin
    2047.       if TalkToNPC('Brother Brace', ['Brother', 'Brace', 'rothe', 'race'], 2345) then
    2048.         DoConversation() else
    2049.         if WalkToYellowArrow() then
    2050.           Wait(696);
    2051.     end;
    2052.  
    2053.     56: //click friends tab
    2054.     begin
    2055.       if ClickTab(FriendsList) then
    2056.         Wait(444);
    2057.     end;
    2058.  
    2059.     57: //click ignore tab
    2060.     begin
    2061.       if ClickTab(IgnoreList) then
    2062.         Wait(444);
    2063.     end;
    2064.  
    2065.     60, 63: //walk and talk to magic instructor
    2066.     begin
    2067.       if TalkToNPC('Magic Instructor', ['Magic', 'Instructor', 'agic', 'nstru'], 2345) then
    2068.         DoConversation(['Yes.', 'No, I''m not planning to do that.']) else
    2069.       if (not WalkToYellowArrow()) then
    2070.         if (not WalkToRedArrow()) then
    2071.         begin
    2072.           Mouse([662, 132], MOUSE_LEFT);
    2073.           if WaitFunc(@IsWalking, 1696, 345, True) then
    2074.             while IsWalking() do
    2075.               Wait(222);
    2076.         end;
    2077.     end;
    2078.  
    2079.     61: //click magic tab
    2080.     begin
    2081.       if ClickTab(Magic) then
    2082.         if WaitFunc(@IsConversation, 2345, 456, True) then
    2083.           if DoConversation() then
    2084.             Wait(696);
    2085.     end;
    2086.  
    2087.     62: //cast wind strike
    2088.     begin
    2089.       if ClickTab(Magic) then
    2090.         if StrikeChicken() then
    2091.           Wait(1234);
    2092.     end;
    2093.  
    2094.   end;
    2095.   Wait(444);
    2096. end;
    2097.  
    2098. begin
    2099.   ClearDebug();
    2100.   Setup();
    2101.   while IsLoggedIn() do Mainloop();
    2102. end.
    Last edited by Citrus; 02-21-2018 at 11:40 AM.

  2. #2
    Join Date
    Jan 2018
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Awesome, will test tomorrow.

  3. #3
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    Thanks Citrus! I'll tweak the script if needed.

  4. #4
    Join Date
    Jan 2018
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    First of all, very well done.

    Secondly, it did manage to get stuck during the banking and poll booth part.

    At the banking part it walked to the right of teller, and would loop attempting to click the booth but it aimed too high.

    After I manually clicked the booth, because of the location it was stuck and wouldn't click the poll booth.

    Other than that no issues, thank for release again.

  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 icyxen View Post
    First of all, very well done.

    Secondly, it did manage to get stuck during the banking and poll booth part.

    At the banking part it walked to the right of teller, and would loop attempting to click the booth but it aimed too high.

    After I manually clicked the booth, because of the location it was stuck and wouldn't click the poll booth.

    Other than that no issues, thank for release again.
    Thanks for the feedback. I never had that issue with the bank, but I'll look into it.

  6. #6
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    > Standalone
    > Uses a plugin that has only ever been shipped with aerolib

    Pick 1

    > Improvements should be easy to implement
    > Uses no includes

    Pick 1


    Good effort tho, skeptical about the idea of not using any include when they are right there, available, and even needed since you use rstext.dll.
    Last edited by slacky; 02-20-2018 at 04:34 AM.
    !No priv. messages please

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

    Default

    Quote Originally Posted by slacky View Post
    > Standalone
    > Uses a plugin that has only ever been shipped with aerolib

    Pick 1

    > Improvements should be easy to implement
    > Uses no includes

    Pick 1


    Good effort tho, skeptical about the idea of not using any include when they are right there, available, and even needed since you use rstext.dll.
    Oh, I thought rstext was just a 'default' Simba plugin.

    The whole no include thing is a half-truth. Really I just gutted my own include and only left in things that were actually used. I want to be able to run the script without having to worry about downloading the latest version of whatever.
    I also meant that improvements would be easy for me to implement.
    The improvements I had in mind were e.g. using standard color-finding methods to click objects and NPCs instead of the big yellow arrow. Some of this is already in the script and it would just be a matter of taking the time to write more.

  8. #8
    Join Date
    May 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    20 Post(s)

    Default

    I'm getting the error below:
    Code:
    Error: Access violation at line 325
    Execution failed.
    Last edited by Smalfinn; 02-20-2018 at 01:03 PM. Reason: I'm stupid.

  9. #9
    Join Date
    Jul 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    looks sweet will try it soon

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

    Default

    Quote Originally Posted by Smalfinn View Post
    I'm getting the error below:
    Code:
    Error: Access violation at line 325
    Execution failed.
    I'm not sure why that's happening to you, but I made a couple changes to the script, so try the current version.

  11. #11
    Join Date
    May 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    20 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    I'm not sure why that's happening to you, but I made a couple changes to the script, so try the current version.
    Okay fresh install of Simba with your new version and now I get this error:
    Code:
    Error: Out of memory at line 183
    Execution failed.

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

    Default

    Quote Originally Posted by Smalfinn View Post
    Okay fresh install of Simba with your new version and now I get this error:
    Code:
    Error: Out of memory at line 183
    Execution failed.
    Sorry, I still don't know what the problem is. Can you give any more information? Does error happen immediately, or after a few seconds?

  13. #13
    Join Date
    May 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    20 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Sorry, I still don't know what the problem is. Can you give any more information? Does error happen immediately, or after a few seconds?
    I fill in the settings, the script loads and logs me in, raises the camera angle then throws that error.

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

    Default

    Quote Originally Posted by Smalfinn View Post
    I fill in the settings, the script loads and logs me in, raises the camera angle then throws that error.
    Have you tried starting the script after you're already logged in?
    One potential issue: make sure you log in manually at least once on the client before starting the script.

  15. #15
    Join Date
    May 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    20 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Have you tried starting the script after you're already logged in?
    Okay so no more out of memory, I now have:
    Code:
    ERROR comes from a non-existing file (!addDelayedCore)
    Error: Access violation at line 103
    Execution failed.
    Just tried again after a plugin update to a different error too:
    Code:
    Error: Access violation at line 325
    Execution failed.
    Exception TLPThread.Destroy: Access violation
    Last edited by Smalfinn; 02-21-2018 at 11:09 AM.

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

    Default

    Quote Originally Posted by Smalfinn View Post
    Okay so no more out of memory, I now have:
    Code:
    ERROR comes from a non-existing file (!addDelayedCore)
    Error: Access violation at line 103
    Execution failed.
    Just tried again after a plugin update to a different error too:
    Code:
    Error: Access violation at line 325
    Execution failed.
    Exception TLPThread.Destroy: Access violation
    Alright another update. RsText is out, SimpleOCR is in. I did another run and tweaked a few other things too.

  17. #17
    Join Date
    May 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    20 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Alright another update. RsText is out, SimpleOCR is in. I did another run and tweaked a few other things too.
    IT WORKS PERFECTLY! A few things; Any plans to move to SMART, holding down space bar would go through text a lot faster then clicking continue, but other then that really good little script.

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

    Default

    Quote Originally Posted by Smalfinn View Post
    IT WORKS PERFECTLY! A few things; Any plans to move to SMART, holding down space bar would go through text a lot faster then clicking continue, but other then that really good little script.
    Glad it works! I would have used SimpleOCR from the start, but it never worked until I redownloaded it yesterday.

    I'll consider adding an option for SMART, but tbh it's a low priority at this point. I'll do some testing with using spacebar when I have the time.

  19. #19
    Join Date
    Jan 2018
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    IMO it's good enough without spacebar takes no more than 10 minutes to complete tutorial island, way faster than anything else.

  20. #20
    Join Date
    Dec 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Script is broken. Tried in official Client and RuneLite

    It detects the Client, sets Compass to North, opens up the XP meter and then hangs over the Run Energy bubble until I manually continue the tutorial.

    If I open up a text Window (talking, something that requires you to click 'next' or use spacebar to continue) it starts clicking the 'continue' button.

    It requires you to be logged in, it does not Select a world, but it does open up the world Select menu.

    1. Set display name and do tutorial until settings are configured according to this https://villavu.com/forum/showthread...39#post1391739 post.
    2. Talk to Gielinor Guide and then run the script
    3. Wait until it bugs out, open the door, it takes over again and runs to the Survival Expert
    4. After about a minute of the script trying to click the NPC, it finally clicks her, finishes the dialogue, then stops again
    5. Have to manually Cook shrimp

    at this point I don't think it's Worth continuing trying so I just bail on it.

    Maybe it's because of some updates, but it's at least outdated, at worst broken.
    Last edited by gay_retard; 12-30-2018 at 07:22 PM.

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
  •