SRL Archive - RS3 Outdated / Broken Scripts

[SRL-6] Wu-Tang Clan Fight Caves [DirectX Compatible]


Wu-Tang Clan

2014-01-26 22:07:53

I could not take it any longer. I just have to get this material out. I want to stress that this script is pretty messy at the moment. I mostly want to release this in a beta sort of thing- so I want to get feedback on how to optimize the script for best xp. I used it on myself for some pretty harsh range xp, but I remember DannyRS had a badass fightcaver that got like 60k/hr.
I have to give credit to my breh @Spartan 117 for his fantastic ability bar user, also thanks to @The Mayor for his help as well. I made too many help threads and thanks to everyone who helped out in those. But just a quick note before you start this script:
- Have auto-retaliate on. Without that the script will not do anything in the cave.
- I always manually log in, so I don't think I even set up declareplayers to work… but if you log it in, the setupcharacter will optimize you to run for hours Manual login will work, but I got login working smoothly.
- No 6 hour restart, but can run for well over 6 hours. SixHourFix(); implemented.
- Have your abilities ranging from highest cooldown to lowest followed by thresholds then ultimates, and read the const to set up everything else.
- Start at the entrance of the fight caves. Can start at entrance or inside the fightcaves.
- If you want to use @Brandon's DirectX plugin, then set it up here:
- http://villavu.com/forum/showthread.php?t=107256
- If you've already done that, then go to the mainloop at the end of the script and remove the "//" from the call before SetupSRL();
- Live your life to the fullest; fortune favors the brave.

program CaveFighter;
{$DEFINE SMART}
{$i srl-6/srl.simba}
//{$I SPS/lib/SPS-RS3.Simba}

var
InTheCave,InTheLobby: TPointArray;
r: Integer;

const
basic = [1,2,3,4,5,6]; //Which actionbar slots do you have a basic ability in?
threshold = [7,8]; //Which actionbar slots do you have a threshold ability in?
UseUltimate = True;
ultimate = [9]; //Which actionbar slots do you have an ultimate ability in?

procedure DeclarePlayers;
// I stole this off some random script... logs you in and stuff.
begin
setLength(players, 1);
currentPlayer := 0;

with players[0] do
begin
loginName := '';
password := '';
isMember := True;
isActive := true;
world := -1;
end;
end;

function WhereAreWe(): String;
var
p: Tpoint;
begin
if (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) or (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds)) then
Result := 'Lobby';

if not (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) and not (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds)) then
Result := 'Cave';
end;

procedure SetUpCharacter;
// Sets up the character to the script specifications
var
p: tpoint;
begin
Wait(3000+Random(300));
minimap.setAngle(MM_DIRECTION_EAST);
Wait(1000+Random(500));
TRSMainscreen.setAngle(MS_ANGLE_LOW);
mouseScroll(p, 50, False);
//WhereAreWe;
end;


function FindOpening: Boolean;
var
i, s, h: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
t: TTimeMarker;
p: Tpoint;
begin
WhereAreWe;
if (WhereAreWe = 'Cave') then
begin
Exit;
end;
if (WhereAreWe = 'Lobby') then
begin
mouse(p, MOUSE_LEFT);
FindColorsTolerance(TPA, 65793,MainScreen.GetBounds, 0, ColorSetting(2, 0.0, 0.0));
//FindColorsTolerance(TPA, 7449049,inttobox(65,267,520,333), 4, ColorSetting(2, 0.3, 0.3));
if (Length(TPA) < 1) then
begin
Writeln('nope');
Exit;
end;

ATPA := TPA.ToATPA(20, 20);
SortATPAFromMidPoint(ATPA, Point(randomRange(mainscreen.playerpoint.x - 100, mainscreen.playerpoint.x + 100), mainscreen.playerpoint.y));

h := High(ATPA);

for i := 0 to h do
begin
if (Length(ATPA[i]) < 50) then
Continue;

Mouse(ATPA[i][random(High(ATPA[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['ave', 'nter', 'ntrance'], 500) then
begin
fastclick(mouse_right);
Wait(500+Random(100));
chooseOption.select(['nter']);
Exit();
end;
end;
end;
end;

procedure NiceConvo;
begin
if (conversationBox.areTalking()) then
conversationBox.continue(true, true);
Wait(200+Random(100));
end;

function abilityReady(slot: integer): boolean;
begin
if not isLoggedIn then Exit;

result := false;

if actionBar.getAbilityCooldown(slot) = 1 then
result := true;
end;

function chooseAbility : integer;
begin
if not isLoggedIn then Exit;

if ((actionBar.getAdrenalinePercent() < 50) or (not (abilityready(threshold[0]) or abilityready(threshold[1])))) then
begin
for r := 0 to high(basic) do
begin
if abilityready(basic[r]) then
begin
result := basic[r];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
if (actionBar.getAdrenalinePercent() >= 50) then
begin
for r := 0 to high(threshold) do
begin
if abilityready(threshold[r]) then
begin
result := threshold[r];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
if useUltimate then
begin
if (actionBar.getAdrenalinePercent() = 100) then
begin
for r:= 0 to high(ultimate) do
begin
if abilityready(ultimate[r]) then
begin
result := ultimate[r];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
end;
end;

function InitQPrayer(): Boolean;
// If the prayer percent is lower than 90 percent, it will not toggle them as a failsafe. Otherwise it will toggle them.
begin
if (actionBar.getPrayerPercent()) < 99 then
begin
WriteLn('Prayer below 90%, not using Quickprayers');
Exit;
end;

MouseOval(306,323,3,3,Mouse_Left);
end;

procedure Fight;
var
NotFightingYet: Integer;
begin
if (WhereAreWe = 'Lobby') then
begin
Exit;
end;
repeat
actionbar.clickslot(chooseAbility);

writeln('Hitpoints %: ' +IntToStr(actionBar.getHPPercent()));
writeln('Adrenaline %: ' +IntToStr(actionBar.getAdrenalinePercent()));
writeln('Prayer %: ' +IntToStr(actionBar.getPrayerPercent()));
if (actionBar.getHPPercent()) = 100 then
begin
NotFightingYet := NotFightingYet+1; // Failsafe so that you don't get stuck out of a fight in fight mode with full health
end;
until actionBar.getHPPercent() < 2 or (NotFightingYet >= 100) or (WhereAreWe = 'Lobby');
if (NotFightingYet >= 100) then
begin
WriteLn('We were stuck in the lobby waiting to fight');
end;
Wait(6000+Random(1000));
end;

begin
smartPlugins := ['d3d9.dll'];
SetupSRL();
DeclarePlayers;
If Not Players[CurrentPlayer].Login Then
Players[CurrentPlayer].Login;
SetupCharacter;
repeat
FindOpening;
Wait(8000+Random(1000));
NiceConvo;
Wait(1000+Random(100));
InitQPrayer;
Fight;
Wait(6000+Random(300));
NiceConvo;
until not (isLoggedIn);
sixhourfix();
end.
Once the script is well ironed out, then I'll send it out as a download .simba file. Just for now you can read through it without having to download it and possibly learn something from it. If you got questions just ask me.

~Wu-Tang forever.

The Mayor

2014-01-26 22:22:25

Did you get my pm about making p global? The actual coords will be stored in the 'p' in whereAreWe, and the 'p' in findOpening will be empty

Spartan 117

2014-01-27 02:31:33

Congratz on pre-release!

PiercingShot,BindingShot,Snipe,FragmentationShot,Ricochet,NeedleStrike: Integer;

None of these seem to be used. (I'm guessing they were DTMs for action bar? haha)
Also should check out my chooseAbility update. It's quite a bit faster, has an added failsafe, and is much more human like. I think you'll like it!

Also when using my ability system, you will have to add an extra bit for snipe. It needs to hold for 3 seconds and the way it is set up is it will click snipe, wait for another ability to be ready, then click that ability. Therefore, it is a waste of snipe. Snipe has a neat little thing that pops up on the main screen while it is charging. You can add

if findDTM(snipeIcon, x, y, mainScreen.getBounds()) then
waitthecooldowntime;
or if you wanted to get fancy you can have this function:

function notUsingSnipe : boolean;
begin
result := not findDTM((snipeIcon, x, y, mainScreen.getBounds());
end;
then make this your fight loop

repeat
if not notUsingSnipe then
waitfunc(@notUsingSnipe, 50, 3000); //I made it notUsingSnipe because I don't know if you could do waitfunc(not @usingSnipe, 50, 3000);

actionbar.clickslot(chooseAbility);

writeln('Hitpoints %: ' +IntToStr(actionBar.getHPPercent()));
writeln('Adrenaline %: ' +IntToStr(actionBar.getAdrenalinePercent()));
writeln('Prayer %: ' +IntToStr(actionBar.getPrayerPercent()));
if (actionBar.getHPPercent()) = 100 then
begin
NotFightingYet := NotFightingYet+1; // Failsafe so that you don't get stuck out of a fight in fight mode with full health
end;
until actionBar.getHPPercent() < 2 or (NotFightingYet >= 100) or (WhereAreWe = 'Lobby');


The snipeIcon DTM might be tricky to catch, because it disappears so quickly, so you could alt+printscrn then paste into paint and find your dam that way.

Good looking script though! I love the simplicity!

EDIT: Also I think you forgot to post the SPS map

Wu-Tang Clan

2014-01-28 12:56:57

From: Spartan 117
Congratz on pre-release!

PiercingShot,BindingShot,Snipe,FragmentationShot,Ricochet,NeedleStrike: Integer;

None of these seem to be used. (I'm guessing they were DTMs for action bar? haha)
Also should check out my chooseAbility update. It's quite a bit faster, has an added failsafe, and is much more human like. I think you'll like it!

Also when using my ability system, you will have to add an extra bit for snipe. It needs to hold for 3 seconds and the way it is set up is it will click snipe, wait for another ability to be ready, then click that ability. Therefore, it is a waste of snipe. Snipe has a neat little thing that pops up on the main screen while it is charging. You can add

if findDTM(snipeIcon, x, y, mainScreen.getBounds()) then
waitthecooldowntime;
or if you wanted to get fancy you can have this function:

function notUsingSnipe : boolean;
begin
result := not findDTM((snipeIcon, x, y, mainScreen.getBounds());
end;
then make this your fight loop

repeat
if not notUsingSnipe then
waitfunc(@notUsingSnipe, 50, 3000); //I made it notUsingSnipe because I don't know if you could do waitfunc(not @usingSnipe, 50, 3000);

actionbar.clickslot(chooseAbility);

writeln('Hitpoints %: ' +IntToStr(actionBar.getHPPercent()));
writeln('Adrenaline %: ' +IntToStr(actionBar.getAdrenalinePercent()));
writeln('Prayer %: ' +IntToStr(actionBar.getPrayerPercent()));
if (actionBar.getHPPercent()) = 100 then
begin
NotFightingYet := NotFightingYet+1; // Failsafe so that you don't get stuck out of a fight in fight mode with full health
end;
until actionBar.getHPPercent() < 2 or (NotFightingYet >= 100) or (WhereAreWe = 'Lobby');


The snipeIcon DTM might be tricky to catch, because it disappears so quickly, so you could alt+printscrn then paste into paint and find your dam that way.

Good looking script though! I love the simplicity!

EDIT: Also I think you forgot to post the SPS map


Wow I would expect this kind of critique from SSRL+, but to get it from a Jr member is just incredible! Great work man you are really becoming a good scripter and member of the community. I'll be sure to fix all of that and get it out again when I have some time. And yes I forgot to add in the maps, but they aren't even used, so sps is kind of useless in here.

Sjoe

2014-01-28 12:58:42

grats on release, mr. Wu-Tang

EDIT: does directx uses the same colours as opengl?

RlagkRud

2014-01-28 13:47:02

From: Sjoe
grats on release, mr. Wu-Tang

EDIT: does directx uses the same colours as opengl?


I believe it does.
Pulled from the Direct X Beta thread.

From: sdf
It's just part of my script. Plays an alarm if new chat is detected. Colours on all utilities/menus are the same, the only noticable variance I've found is in the way water and fishing spots are rendered.

The Killer

2014-01-28 14:47:41

Ok time for TK's input :P
Firstly, You don't seem to use everything in declare players.
    integers[0] := 50;
integers[1] := 25;
booleans[0] := true;
Are not used. Like you say, you just took it from another script. So you might aswell go ahead and delete those.


function WhereAreWe(): String;
var
p: Tpoint;
begin
if (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) or (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds)) then
Result := 'Lobby';

if not (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) or not (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds)) then
Result := 'Cave';
end;
This is a little confusing for me. So I'm going to break it down a little.
Firstly, the function looks to see if it can find eithier symbol. If it finds ONE of the two, it sets the result to the lobby.
Then we have another statement which again looks for the symbols (we're already repeating code unnecessarily). As you have used "or" and two nots, if it does not find ONE of the two it sets the location to the cave. This is wrong. You should have used a AND instead as if it finds one (like the first part) it will set the result to cave. I'll come back to this.


procedure SetUpCharacter;
// Sets up the character to the script specifications
var
p: tpoint;
begin
Wait(3000+Random(300));
minimap.setAngle(MM_DIRECTION_EAST);
Wait(1000+Random(500));
TRSMainscreen.setAngle(MS_ANGLE_LOW);
mouseScroll(p, 50, False);
WhereAreWe;
end;
This is indented incorrectly. Look up standards mate. Also why is "wherearewe" called like that there? It looks to me like its being miss used or shouldn't be there at all.


procedure Fight;
var
NotFightingYet: Integer;
begin
if (WhereAreWe = 'Lobby') then
begin
Exit;
end;
Ok now back to the wherearewe function. You don't need to wrap that exit with begin end, as it is on its own. You only need begin end when theres multiple lines going in if the statement is true.

Personally, I would of set it to a boolean and rename it to InLobby. Although a string would be useful for if you were having a lot of different locations and using a case statement. Here it just adds a little bit of extra typing.

So it would look a little like this:

function InLobby(): Boolean;
var
p: Tpoint;
begin
Result := minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) or (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds);
end;



//and then when you call it
if InLobby then
Exit;


Hope you take my feedback onboard. Sorry if any of what I said is incorrect (I haven't actually caught up with srl6 yet). Don't get down because of a few mistake either :P

Wu-Tang Clan

2014-02-02 09:09:18

Updated my baby a little bit, now should run for just about anybody. I've gotten some half decent xp with it

nutta124

2014-02-19 06:56:33

any updates? :)

Wu-Tang Clan

2014-02-19 08:21:35

From: nutta124
any updates? :)

My brother had it working last night, should be good without any changes..

nutta124

2014-02-19 15:47:13

inventory setup? and what about prayer?

Wu-Tang Clan

2014-02-19 19:04:36

From: nutta124
inventory setup? and what about prayer?


Nothing in inventory needed… bring what you want but the inventory isn't used at all
Set up quick prayers- a button that allows you to toggle multiple preset prayers at once.

freeplay

2014-02-24 12:20:42

Definitely put this script to good use over the double xp weekend. It works reasonably well as long as you babysit it. You just have to worry about health bars in the minimap making the script think you are logged out (stops using abilities)and occasionally spamming a threshold ability when you don't have the adrenaline to use it.

Major combat update…
Revolution just spams basic abilities, so I think it might make the code for this script simpler.

warhawk881

2014-02-26 16:40:27

Hi, So I found an issue that you should look at. If someone or you has a familiar out with the option to "interact" the script will click on interact because of the "nter"
This happened to me because of a clan avatar someone else had.

Wu-Tang Clan

2014-02-26 17:46:32

From: warhawk881
Hi, So I found an issue that you should look at. If someone or you has a familiar out with the option to "interact" the script will click on interact because of the "nter"
This happened to me because of a clan avatar someone else had.


You could add a capital E to "nter" or you could put a space after = "nter "

intradaydude

2014-09-13 09:22:27

any chance this one will be coming back?

Mantasx27

2014-09-25 01:52:40

^I second this. Would be fantastic

cBots

2015-03-21 17:21:24

Thanks for this!

osoad1

2015-03-23 19:00:46

Ty for this. Gonna try it out.

jok145

2015-03-24 16:02:37

gonna try it out ty :)

destinyxx

2015-04-19 21:19:32

Does anyone know if this script works?

Wu-Tang Clan

2015-04-20 12:18:00

From: destinyxx
Does anyone know if this script works?


Best bet is that it doesn't… I haven't played in forever
if theres been any updates in like the last year or so this is probably broken

Pompus

2015-04-29 11:52:08

would be very grateful if this script got revisited :)

Mack

2015-06-09 13:41:09

—— TRSLobby.findPlayButton(): result = False ?