IntelliJ Posted May 9, 2014 Share Posted May 9, 2014 (edited) Well... I wanted to level my fishing skill in RIFT but I find it incredibly boring (and I want to do other things ). Created this bad boy and I run it in a VM. I've only tested this in the Argent Glade fishing spot (since that's the first area). Everything is pretty self explanatory. The reason I had to implement a fail timer is because I don't have a good way of detecting if the fish gets away. If anyone has any ideas feel free to share. Constructive criticism is always welcome! program RIFT_Auto_Fisher; {$I RIFT/Skills/Fishing.scar} const deepFishing = true; var running: Boolean; iterations: Integer; begin running := true; SetFishing(false); iterations := 0; Load; SetFishingStyle(deepFishing); while (running) do begin if (GetKeyState(VK_DELETE)) then begin WriteLn('Stopping script...'); TerminateScript; end; if (iterations >= 40) then begin SetFishing(false); end; if (CanLoot) then begin Loot; iterations := 0; end; if (IsFishing) then begin if (CanCatchFish) then begin CatchFish; iterations := 0; Sleep(800); end else begin Inc(iterations); Sleep(500); end; end else begin CastPole; Sleep(800); end; end; end. The Include: var pole, shallow, deep, fish, loota, lootb: Integer; w, h, tw, th, x, y, cx, cy: Integer; searching, dFishing, fishing: Boolean; Procedure Load; begin WriteLn('Loading...'); pole := DTMFromString('78DA63346262609803C4486059A727986684F' + '2199581F293D0D4CCE941556303945F89AA6645AD11AA1A905D2B' + '50D534F7F7A2AA5101CACF435593989088AA461F28BF1E558DABA' + 'B2B8A1A00136E0D34'); shallow := 15188294; deep := 2472923; fish := 5723991; loota := DTMFromString('78DA63BCCAC4C060C3C8800CEE9C5FC0C005A' + '441A2FF818011A4C61E4DCD39841A1000AB71C2AD068CEF60AAB9' + '7A6236AA9AFB98EE39736806AA9A17986AAE9E9A8BA906CDAE2BC' + '767C1D5B082E857F8DD0C5673085BF82C84AB6107D14731D5DC3C' + '3B1F55CD614CBBAE9D9C83A206002F01297C'); lootb := DTMFromString('78DA63DCC5C4C020C4C8800CBEFDFCC9C005A' + '441A2FF818011A4461255CD97AF5FE16A4080712FA69A176FDEA0' + 'AAD98369D79FBF7F51D59CC254F3F3F71F4C3568767DFFF10355C' + 'D194C35BFFFA099B38C08F7AC2442CD724CBB5EA2F91D00D19F29' + 'A0'); tw := 0; th := 0; GetBoxSize(GetClient.ImageArea, w, h); end; Procedure Clear; begin x := 0; y := 0; end; function ShouldStop: Boolean; begin if (GetKeyState(VK_DELETE)) then begin TerminateScript; end; end; function ValidSpot(xx,xy: Integer): Boolean; begin if (dFishing) and (FindColorTol(x, y, deep, xx - 50, xy - 50, xx + 50, xy + 50, 10)) then begin result := true; end else if (not dFishing) and (FindColorTol(x, y, shallow, xx - 50, xy - 50, xx + 50, xy + 50, 10)) then begin result := true; end else begin result := false; end; end; function IsFishing: Boolean; begin result := fishing; end; function SetFishing(bool: Boolean): Boolean; begin fishing := bool result := bool; end; function SetFishingStyle(style: Boolean): Boolean; begin dFishing := style; result := style; end; function CanCatchFish: Boolean; begin result := FindColorTol(cx, cy, fish, tw - 10, th - 10, tw + 10, th + 10, 3); end; function CanLoot: Boolean; begin result := FindDTM(loota, x, y, 0, 0,w, h) or FindDTM(lootb, x, y, 0, 0, w, h); end; Procedure FindCastPosition; begin WriteLn('Finding cast position...'); searching := true; tw := w div 2; th := h div 2 + 15; while (searching) do begin if (th <= 0) then begin searching := false; end; ShouldStop; MoveMouseEx(tw, th, RandomRange(40, 50)); if (ValidSpot(tw, th)) then begin searching := false; end else begin th := th - 5; end; end; end; Procedure SelectPole; begin if (FindDTM(pole, x, y, 0, 0, w, h)) then begin WriteLn('Selecting pole...'); MoveMouseEx(x, y, RandomRange(20, 30)); Sleep(300); ClickMouse(x, y, mbLeft); Clear; Sleep(300); end; end; Procedure CastPole; begin SelectPole; if (tw = 0) and (th = 0) then begin FindCastPosition; end; WriteLn('Casting pole...'); MoveMouseEx(tw, th, RandomRange(20, 30)); Sleep(300); if (ValidSpot(tw, th)) then begin fishing := true; ClickMouse(tw, th, mbLeft); Sleep(800); end else begin fishing := false; tw := 0; th := 0; Sleep(200); end; end; Procedure CatchFish; begin WriteLn('We got one! Reeling it in...'); MoveMouseEx(cx, cy, RandomRange(20, 30)); ClickMouse(cx, cy, mbLeft); Sleep(800); end; Procedure Loot; begin if (FindDTM(loota, x, y, 0, 0, w, h)) or (FindDTM(lootb, x, y, 0, 0, w, h)) then begin WriteLn('Look at that loot! Collecting...'); MoveMouseEx(x, y, RandomRange(20, 30)); Sleep(400); fishing := false; ClickMouse(x, y, mbLeft); Sleep(400); end; end; NOTE: This has been completely rewritten. Edited May 15, 2014 by IntelliJ complete rewrite Quote Link to comment Share on other sites More sharing options...