PDA

View Full Version : [Fighting] [SRL-6] Basic Fighter



bonsai
12-14-2014, 10:34 PM
Basic Combat Script
Melee/Range/Magic

This is a simple combat script that allows the user to enter CTS2 colors from ACA to fight NPCs.


Requirements:


You need a functional setup with current software (Simba 1.x, SMART 8.X, SRL-6 (http://villavu.com/forum/showthread.php?t=47714))

You need to use the player manager to add your character to a players file. The player manager is on the simba menu under srl->player manager.


Installing:


Download the script at the bottom of this post.
The script will create color files wherever it is, put it in its own folder if you like.

EOC Abilities:


The player form has a field manualAbilities. My current recommendation is to set this to False and use the Runescape combat mode "revolution". This will automatically use your abilities without the script needing to do anything.

If you set manualAbilities to True the script will use abilities on your visible ability bar. It uses the first 9 slots from RIGHT to LEFT. If you place basic skills on the left, threshold in the middle, and ultimate on the right, it will use the ultimate and threshold when they are ready.

In-game setup:


Make sure your interface settings have Always show target information checked.

Locate your character in the room you will be fighting in with a weapon in hand. You should be zoomed all the way out (smallest view of yourself).

If you want food support, have the food in your inventory. Set the food to one of the open taskbar slots. When you run the script, make sure the food key is set to the key to activate this slot.

Known bugs / issues:



Has some issues with trying to kill the same NPC it just killed.
Quality is highly dependant on the color selection.
New script with very little testing


Improvements to be made:



May need to add split size, min, max filter to data file, using one set of values for all NPCs is not ideal.



Progress reported:





Installer:

24815

KeepBotting
12-14-2014, 10:37 PM
Gratz on the release!

A question though: bonsaiFighter. what's the difference between that and this?

bonsai
12-14-2014, 10:47 PM
Gratz on the release!

A question though: bonsaiFighter. what's the difference between that and this?

The primary difference is that this one is using CTS2 colors and bonsaiFighter uses CTS0 colors that it chooses itself.

Instead of adding into the existing one, I wrote this up as a new script. Mostly for people who are trying to figure out how to do fighters.

bonsaiFighter uses a lot of includes that make it hard for someone to find what they want.

I get questions from poor people who are trying to sift through thousands of lines of code to find the "meat".

The Mayor
12-14-2014, 10:58 PM
Very neat little script you have there!

Ross
12-14-2014, 11:02 PM
Stole Ross's progress report but don't tell him


Reported Bonsai!

e: the padding on the bottom of the proggy is off when it prints :p

Nottabot
12-15-2014, 08:48 PM
Which would you recommend to the first time simba user? your basic fighter or bonsai fighter?

3Garrett3
12-15-2014, 09:04 PM
Which would you recommend to the first time simba user? your basic fighter or bonsai fighter?

The bonsai fighter is probably easier to use because this script requires getting your own colours (although that itself is pretty easy). The bonsai fighter automatically determines colours for you or can simply fight everything that moves.

jayman19981
12-16-2014, 12:49 AM
Congrats on the release love bonsaiFighter

Obquility
12-16-2014, 10:56 PM
Nice script, I use this over bonsai fighter when trying to attack a certain type of monster, that is in the same area. Sometimes it attacks another same monster when it is still fighting another. You should implement the features of BonsaiFighter that it detects when it is dead in different ways. Overall, amazing script though- although it looks like a bot, a bit of an antiban would be good if it could be implemented.
~Josh

EDIT: Sorry, this script doesn't compile now, think it might be my plugins though

icebeamer
12-18-2014, 03:04 PM
Hi, just want to ask why the NewNPC Procedure does not show up when I start the script? It always ends up like this after it passes the Player form:

Compiled successfully in 2246 ms.
=========== Basic Fighter ============
Fighting False
Kills: 0
Kills/Hr: 0
XP: 0
XP/Hr: 0
Time running: 26s
==============================================
Successfully executed.

Help would be much appreciated! :D

bonsai
12-18-2014, 03:10 PM
Looks like i need to update for the forms changes.

5 hours or so I'll post an update

icebeamer
12-18-2014, 03:13 PM
I think it has something to do with updating the Plugins :(

icebeamer
12-18-2014, 03:18 PM
Looks like i need to update for the forms changes.

5 hours or so I'll post an update

Yay! Thanks bonsai! :D

bonsai
12-18-2014, 08:42 PM
Yay! Thanks bonsai! :D

Update posted. Grab the script from the OP again.

bonsai
12-18-2014, 08:52 PM
Nice script, I use this over bonsai fighter when trying to attack a certain type of monster, that is in the same area. Sometimes it attacks another same monster when it is still fighting another. You should implement the features of BonsaiFighter that it detects when it is dead in different ways. Overall, amazing script though- although it looks like a bot, a bit of an antiban would be good if it could be implemented.
~Josh

EDIT: Sorry, this script doesn't compile now, think it might be my plugins though

Re: attacking the same npc, both scripts are having some issues with this currently. Jag upgraded combat and made it faster. Sometimes so fast it's hard for the script to be sure of what's up.

I could make it attack far from the npc first but that's kind of crappy too.

This script is a pretty close duplicate of bonsai fighter but using CTS2. I actually removed the great majority of those other detections after the update. So, yeah, the flashing lights are missing but it's doing the same work. In 450 lines of code instead of thousands :)

Re: antiban, I agree it doesn't try to hide itself and it's prone to people reporting you. I don't care to worry about the normal antiban stuff because time has proven that we're not getting banned for moving the mouse around like a monkey or killing things faster than people can. Seems like pure combat XP is fairly unwatched for now.

I do think this needs to let you configure the split size and min/max pixels. How you pick them is a pain but they are important to be able to handle so many different cases. I keep seeing it moving over the background on me due to color bleed.

icebeamer
12-19-2014, 02:10 AM
Update posted. Grab the script from the OP again.

Works perfectly! 3-thumbs up to Bonsai for this great program!

bonsai
12-20-2014, 08:26 AM
Anyone having form problems grab the download again from the OP.

the bank
01-15-2015, 10:47 PM
Hi, just want to ask why the NewNPC Procedure does not show up when I start the script? It always ends up like this after it passes the Player form:

Compiled successfully in 2246 ms.
=========== Basic Fighter ============
Fighting False
Kills: 0
Kills/Hr: 0
XP: 0
XP/Hr: 0
Time running: 26s
==============================================
Successfully executed.

Help would be much appreciated! :D
Having this problem again now!

EDIT: Commenting out the condition check and just invoking the newNpc() function then uncommenting and loading from the save data is a simple work around.

bonsai
01-16-2015, 06:17 AM
Having this problem again now!

EDIT: Commenting out the condition check and just invoking the newNpc() function then uncommenting and loading from the save data is a simple work around.

Did you grab the updated version? That issue should be long gone.

If your script and SRL are current, check inside the color files and see if you ended up with the name "True" in them.

the bank
01-16-2015, 03:25 PM
Did you grab the updated version? That issue should be long gone.

If your script and SRL are current, check inside the color files and see if you ended up with the name "True" in them.

Yeah buddy I got the latest version only just downloaded it yesterday!

Also, no "True" color file :/ the color file appears to be completely correct. Hold on ill debug this real quick.

Alright so it appears that npcName is holding the value "Right", which is of course for Right-Click selection.

Here is the code I have for varaiable assignment:

foodKey := playerForm.players[0].settings[0];
sgsKey := playerForm.players[0].settings[1];
mouseStr := playerForm.players[0].settings[2];
npcName := playerForm.players[0].settings[3];
manualAbilities := StrToBoolDef(playerForm.players[0].settings[4], false);

Next, if I output these values to the debug window:

foodKey: =
sgsKey: -
mouseStr: False
npcName: Right
manualAbilities: Flesh Crawler

So clearly these values are not being assigned correctly hehehe. Maybe somehow I grabbed the old version even though I only downloaded yesterday? But either way, these assignments fix it of course (leaving all this here for anyone else who may have the same problem):

foodKey := playerForm.players[0].settings[0];
sgsKey := playerForm.players[0].settings[1];
mouseStr := playerForm.players[0].settings[3];
npcName := playerForm.players[0].settings[4];
manualAbilities := StrToBoolDef(playerForm.players[0].settings[2], false);

bonsai
01-16-2015, 04:37 PM
Yeah buddy I got the latest version only just downloaded it yesterday!


I think I got the attachment sorted out so the proper version is there now.

Thanks!

Ross
02-13-2015, 11:41 PM
// stole this from ross, hehehe

Trying to tune this to my needs and as I'm scrolling through I find this :P

<3


edit: to show you what I changed

line 338
if mouseStyle = MOUSE_LEFT then
begin
fastClick(MOUSE_LEFT);
exit(didClick(true));
end;

//changed to

if mouseStyle = MOUSE_LEFT then
begin
exit(didClick(true));
end;

did this so it didn't double click.



and line 436:

while loginCheck() do
begin
if attack() then
begin
inc(kills);
failures := 0
if (kills mod 15) = 0 then progressReport();
writeln('Killed one');
end
else
inc(failures);

writeln('Failed to attack NPC');
if failures > 50 then
begin
writeln('***** Sorry, failed to find NPC 50 times, giving up');
terminateScript();
end;

// changed to

while loginCheck() do
begin
if attack() then
begin
inc(kills);
failures := 0
if (kills mod 15) = 0 then progressReport();
writeln('Killed one');
end
else
begin
inc(failures);
wait(1000);
end;

writeln('Failed to attack NPC');
if failures > 60 then
begin
writeln('***** Sorry, failed to find NPC 50 times, giving up');
terminateScript();
end;

so that it waits for about a minute if no npcs are around. before it just insta-terminated.

BenJerrySon
02-14-2015, 12:37 AM
///////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Bonsai ////////////////////////////////////////
//////////////////////////////////////// Fighter ////////////////////////////////////////
//////////////////////////////////////// _______ ////////////////////////////////////////
////////// //////////
////////// Script runtime: //////////
////////// 6 hr 13 min 39 sec(Total) 5 hr 54 min 39 sec(Active) 19 min 0 sec(Break) //////////
////////// //////////
//////////////////////////////////////// Kills ////////////////////////////////////////
////////// Total Per Hour /Hour Active //////////
////////// deadly-red-spid 1,655 265.75 279.99 //////////
////////// XP 1,655 265.75 279.99 //////////
////////// Const XP 551.67 88.58 93.33 //////////
////////// //////////
////////////////////////////////////////////////////////////////////////////////////////////////////



Proggy for you

bonsai
02-27-2015, 09:36 AM
edit: to show you what I changed


I fixed the clicker and added a timer and constant at the top for quitting if you can't find anything.

Want to try it out? If ok I will add to OP.

25138

General_Patrick
03-13-2015, 11:07 PM
Hey Bonsai

I am really enjoying your script and playing with it, but i was wondering if I could implement a looter. I wanted to do this to pick up the goodies that the monsters drop. I would love it if you could show me how to do it or direct me to someone who knows how to make a looter.

KeepBotting
03-13-2015, 11:15 PM
Hey Bonsai

I am really enjoying your script and playing with it, but i was wondering if I could implement a looter. I wanted to do this to pick up the goodies that the monsters drop. I would love it if you could show me how to do it or direct me to someone who knows how to make a looter.

I posted on your thread.

cBots
03-21-2015, 09:23 PM
Great release, looking forward to your future projects.

Hitac
03-22-2015, 01:14 PM
Great release, looking forward to your future projects.

Stop the spam you are becoming irritating

osoad1
03-23-2015, 10:59 PM
Wow, another combat script by Bonsai, Thanks for this!

sombix71
05-24-2015, 07:48 AM
Bug report:

Attempting to attack an another monster while not being finished with the current one
Refuses to do SGS, and very rarely does it trigger Ultimate/Threshold abilities during combat
The bot waits 1 or 2 seconds after a Global cooldown before using a manual ability

bonsai
05-25-2015, 09:54 AM
Bug report:

Attempting to attack an another monster while not being finished with the current one
Refuses to do SGS, and very rarely does it trigger Ultimate/Threshold abilities during combat
The bot waits 1 or 2 seconds after a Global cooldown before using a manual ability


More info needed on the first one. Is it constantly whacking at everything? Once in a while? One specific NPC it doesn't like?

Line 274 starts detectFight(). That uses a DTM to find the gold lock on the combat popup. Line 430 sets the tolerance on that DTM, currently it is 20. If you are sure the lock is visible on the mainscreen, maybe bump this up. I suspect your popup is not positioned well. It's best in the top left corner.

For SGS, the place to look is 'procedure checkHealth()', line 199. Are you less than 50% HP? If not, it won't try to use it.

Manual ability issues are probably the SRL function underneath, actionBar.getAbilityCooldown(). It has always been quirky.

It activates abilities from RIGHT to LEFT. Did you put your ultimates on the right? Thresholds next, then basics on the left?

Line 379 has a 2 second timer before trying to use an ability (2000 ms). Adjust or eliminate as desired.

sombix71
05-25-2015, 10:49 AM
More info needed on the first one. Is it constantly whacking at everything? Once in a while? One specific NPC it doesn't like?

Line 274 starts detectFight(). That uses a DTM to find the gold lock on the combat popup. Line 430 sets the tolerance on that DTM, currently it is 20. If you are sure the lock is visible on the mainscreen, maybe bump this up. I suspect your popup is not positioned well. It's best in the top left corner.

For SGS, the place to look is 'procedure checkHealth()', line 199. Are you less than 50% HP? If not, it won't try to use it.

Manual ability issues are probably the SRL function underneath, actionBar.getAbilityCooldown(). It has always been quirky.

It activates abilities from RIGHT to LEFT. Did you put your ultimates on the right? Thresholds next, then basics on the left?

Line 379 has a 2 second timer before trying to use an ability (2000 ms). Adjust or eliminate as desired.

Thanks for the reply Bonsai.

The first issue happens frequently but not too often and is not specific to an NPC. The bot thinks that it has killed a monster but in fact, it hasn't. So when it assumes it has killed a monster, it will move on to to an another. This can also happen when being aggro'd by a monster and the bot chooses to attack an another one instead.

As for the second one, I tried setting the line to 'if ((actionbar.getHPPercent() < 99)' and it still didn't work. I just fixed it by putting the special attack ability on the Food key (=).
Threshold/Ultimate issues are fixed now for some weird reasons

And lastly, you're right about the third one.

geek borgel
06-28-2015, 05:06 AM
Hi I'm learning to write my own combat scripts and I've learned a lot from this so thank you! My question is what exactly is going on in the detectTarget() function and why do you have it? The only thing I can figure out is that the lastBox is to save a few seconds so you don't click the same target?

bonsai
06-28-2015, 06:09 AM
Hi I'm learning to write my own combat scripts and I've learned a lot from this so thank you! My question is what exactly is going on in the detectTarget() function and why do you have it? The only thing I can figure out is that the lastBox is to save a few seconds so you don't click the same target?

Yeah, it probably needs some comments. That function is to detect the red combat circle that shows under the npc you are attacking. The colors vary a lot and it gets covered up all the time. Basic searches were very unreliable.

You are correct, it sets lastTargetBox. That is used to avoid re-attacking the same thing.

The first section loops through a bunch of CTS0 colors. If it finds more than 100 matches it skips that one (maybe it matched the background).

Then it gathers more from a CTS2 color.

It groups that into 45x45 chunks. That's a little larger than the red circle.

Then it decides if it found one. If there was only one grouping found, that gets a little extra credit (vote). If the width of what was found is reasonable, another vote. And another vote for the height being in the right range.

If two of those three things are true it will set lastTargetBox to it.

pashtun123
07-05-2015, 07:42 AM
Hi guys

I'm wondering if you could help me out for a minute totally new to the whole coding script scene so tbh i had no idea what was going on,but in around a day i have sorta familiarized myself with simba as the guide is pretty helpfully,my problem is that my script works well until log in and even faces the camera north however the red dot just stops ,i have no idea what to do tbh,and constantly get the message ''Failed to attack NPC'' in simba,can someone please help me out what am i doing wrong???

Snoozie
07-15-2015, 04:06 AM
This script really needs to have a kind of anti-ban where it turns the camera to look (or clicks on the minimap) to go to the other enemies. Whenever I am fighting, I kill all the way until the end of the room, then the script stops because everyone is dead, but comes back three seconds later.

EDIT:: I took out the "termination" part at the end of the script and replaced it with a camera tool that searches for the NPC instead. Testing it now!
Works perfectly now. Can't complain about a thing. I'm gonna have fun tweakin with this :d

Snoozie
07-15-2015, 06:15 PM
@Pashtun123:

At around line 449, where you see:
writeln('Failed to attack NPC');
if failures > 50 then
begin
writeln('***** Sorry, failed to find NPC 50 times, giving up');
terminateScript();
end; change all of that script to:
writeln('Failed to attack NPC');
if failures > 10 then
begin
writeln('Adjusting camera angle');
randomCompass(90, 95, false);
end;

What this does is it adds a little bit of randomness, while making the script look around for more enemies so it doesn't just stand there :p. It looks pretty human when it does it-- just make sure that you picked the right colors to put into the config of this script! Try picking the most unique colors, instead of a brown or woodland green x). Happy scripting!

bonsai
07-16-2015, 08:35 AM
Hi guys

I'm wondering if you could help me out for a minute totally new to the whole coding script scene so tbh i had no idea what was going on,but in around a day i have sorta familiarized myself with simba as the guide is pretty helpfully,my problem is that my script works well until log in and even faces the camera north however the red dot just stops ,i have no idea what to do tbh,and constantly get the message ''Failed to attack NPC'' in simba,can someone please help me out what am i doing wrong???

I have to guess you picked a bad color and it's not finding the npc. I encourage people to post good color choices that worked for them.


@Pashtun123:
What this does is it adds a little bit of randomness, while making the script look around for more enemies so it doesn't just stand there :p. It looks pretty human when it does it-- just make sure that you picked the right colors to put into the config of this script! Try picking the most unique colors, instead of a brown or woodland green x). Happy scripting!

Thanks for posting up your mod! There's lots of things you could choose to do in that situation, it's a good place for customization.

The Mayor
08-24-2015, 02:32 PM
Picked some colours for warped bats in 20 seconds and gave it a run on my ironman


=========== Basic Fighter ============
Fighting Warped Bat
Kills: 675
Kills/Hr: 516.127278261208
XP: 41242.5
XP/Hr: 31535.3767017598
Time running: 01h 18m 28s
==============================================


XP is a little elevated because I put in total XP per kill (+ HP) but then I saw you multiplied it by 1.3. That went through a full inv of food in 1h 20min so I switched to the crawling torsos so no food required, still running:


=========== Basic Fighter ============
Fighting Crawling Torso
Kills: 1530
Kills/Hr: 561.664730208201
XP: 56089.8
XP/Hr: 20590.6290094327
Time running: 02h 43m 26s
==============================================

bobjim
10-11-2015, 11:23 AM
Trying to use this on darkscape, picked a colour using ACA for warped bats but the client goes as far as logging me in and then it just sits there for a minute or 2 before closing, doesn't even face north, i've got a feeling i'm doing something wrong but I don't know what it is. Any suggestions?

fady
10-11-2015, 12:43 PM
Trying to use this on darkscape, picked a colour using ACA for warped bats but the client goes as far as logging me in and then it just sits there for a minute or 2 before closing, doesn't even face north, i've got a feeling i'm doing something wrong but I don't know what it is. Any suggestions?

So before the script can do work, it first needs to check that all the interfaces are in the correct position. It does that using the colors on the interface. The colors in darkscape are not the same as the colors in RS3 thus causing the script to not work because it can not detect the interface colors. SRL-6 has not been updated to accommodate darkscape.

Bottom line, you cant use this script outside of RS3 lol

bobjim
10-11-2015, 01:12 PM
Damn, OK thanks for the info. Do you know of any alternative to this that will work in darkscape?

ShotzOnMe
11-03-2015, 09:23 PM
Nice script, but how do I set what NPC to attack? Only script that has not given me errors besides the fact that I can't figure out how to set NPC :P

Lama
11-04-2015, 04:40 AM
Nice script, but how do I set what NPC to attack? Only script that has not given me errors besides the fact that I can't figure out how to set NPC :P

You have to input the monster data (color, tolerance, hue, saturation, etc using ACA) manually in the second form that pops up (after selecting your character, hitting 'Start Script') and setting the 'NPC' field to NEW (from then on it should save each monster you add, and that menu will have those in memory). At least that's what it looks like for me without running it ;)

BraK
11-10-2015, 11:09 PM
bonsai; Awesome script. It worked for about 3 hours that I set on a fairly low level account. Using balanced fighting style I gained 10 - 22 on all relevant skills. All in all it works fairly smoothly.

plinkus
04-13-2016, 03:00 AM
Hi,

I opened this script and put in the colors for the NPC I wanted to attack and it opened SMART, but then it did nothing. It just sat there. Am I missing something?

Thanks.

plinkus
04-14-2016, 07:32 PM
Hi,

I opened this script and put in the colors for the NPC I wanted to attack and it opened SMART, but then it did nothing. It just sat there. Am I missing something?

Thanks.

Nevermind it seems to be working now. I have been seeing an issue where the camera keeps jumping back and forth like it's looking around, when the NPC is right in front of it. I'm guessing it could be because of the colors as it doesn't do it very often. Am I correct that it triggers your moves from 9-1 (R-L) and not from 1-9 (L-R)? Also would this work for range training as well or only melee/mage?

bonsai
04-14-2016, 11:39 PM
Nevermind it seems to be working now. I have been seeing an issue where the camera keeps jumping back and forth like it's looking around, when the NPC is right in front of it. I'm guessing it could be because of the colors as it doesn't do it very often. Am I correct that it triggers your moves from 9-1 (R-L) and not from 1-9 (L-R)? Also would this work for range training as well or only melee/mage?

Yes, yes, yes, and yes. Maybe increase your tolerance. It will train range but I wouldn't expect to stay in a safe spot.

:spot:

plinkus
04-18-2016, 01:39 PM
Yes, yes, yes, and yes. Maybe increase your tolerance. It will train range but I wouldn't expect to stay in a safe spot.

:spot:

So I've used it a couple times in the last few days and just today I started to get an error. It would compile and open the window to load army/pick NPC but after I clicked start script it would instantly end itself. The debug read "These bitmaps were not released or freed or whatever: SMART Debug Image." Any reason that would start happening after I've used the program before without issue?

Thanks!

jcbird
11-20-2016, 01:03 AM
So I've used it a couple times in the last few days and just today I started to get an error. It would compile and open the window to load army/pick NPC but after I clicked start script it would instantly end itself. The debug read "These bitmaps were not released or freed or whatever: SMART Debug Image." Any reason that would start happening after I've used the program before without issue?

Thanks!

I'm having the same issue as well. I guess it is outdated. I loved his scripts :sasmokin:

nkd2009
02-28-2017, 03:52 AM
Bonsai,

Thought you might want an update on your script. It works great for me, but I'm not using smart so not sure about the above errors. Plz don't move to outdated.