SRL Archive - Jr. Member General Help and Discussion

Scripting combat


Last Legend

2014-07-08 08:49:42

Hello all,

After a long hiatus I was drawn back into this drug addiction we call RS and scripting ;) Now I'm taking on an ambitious project and after a long time away needless to say I'm struggling to recall how to do even the simplest of tasks in SRL.

I am really struggling with building a bare-bones consistent combat procedure. I have currently used the bonsaifighter and The Mayor's abomination script as references, however The Mayor is far too brilliant for his own good and there are many instances I struggle to follow ;)

I would also love to include a "use regenerate when done with combat by pressing '-' when hp below 80%" or something similar just to make it capable of sustaining itself but of course scripting abilities is something that I have never had to do and doesn't seem covered by any of the old tutorials I grew to love.

Any help or collaboration would be appreciated, and if someone could let me know if this is against the rules to ask for help on a script you intend to apply with then please shout it out there!

Thanks everyone!

KeepBotting

2014-07-08 08:56:09

if not InCombat and (actionBar.getHpPercent() < 80) then actionBar.clickSlot(rejuvSlot);

Combat detection isn't included with SRL-6, I personally like to use the red & yellow targeting rings that appear around the monster you've clicked.

Once you've got that down, it should work fine, provided you declare rejuvSlot as a global constant and fill it in correctly.

Last Legend

2014-07-08 08:58:08

Ah so I would have to enable to targeting option in interface or graphics I assume? Personally I've never even seen the rings but I could just be oblivious XD

KeepBotting

2014-07-08 09:07:34

From: Last Legend
Ah so I would have to enable to targeting option in interface or graphics I assume? Personally I've never even seen the rings but I could just be oblivious XD


Afaik they're enabled by default, but there might be an option.

Don't take what I said as written in stone though! there are many other ways to detect combat

Last Legend

2014-07-08 09:08:58

Good to get me thinking, as I have had NO clue how to go about it. Much appreciated

Clarity

2014-07-08 10:44:48

The rings are difficult to detect in many complex NPC battles and environment color schemes. You can use a findDTM to check for the presence of the weakness texture on your string. This is also particularly useful for scripts that handle combat with different NPCs.

For instance, in my Barrows script, not only can I detect when I am fighting something, but I can also detect exactly what specific thing I am fighting. This is helpful for automatically updating the script's perception of what is going on in case it thought I was fighting something else.

This works up to a point (you run out of unique weaknesses), which is why for the more complex combat scripts I've since moved to OGL model detection.

As far as things to include in combat scripts, the buff/debuff bar is Jagex's godsend to scripters. You can easily detect with color only whether you are praying, whether potions are running out, whether you have a familiar out, etc.

Last Legend

2014-07-08 11:03:03

From: Clarity
The rings are difficult to detect in many complex NPC battles and environment color schemes. You can use a findDTM to check for the presence of the weakness texture on your string. This is also particularly useful for scripts that handle combat with different NPCs.

For instance, in my Barrows script, not only can I detect when I am fighting something, but I can also detect exactly what specific thing I am fighting. This is helpful for automatically updating the script's perception of what is going on in case it thought I was fighting something else.

This works up to a point (you run out of unique weaknesses), which is why for the more complex combat scripts I've since moved to OGL model detection.

As far as things to include in combat scripts, the buff/debuff bar is Jagex's godsend to scripters. You can easily detect with color only whether you are praying, whether potions are running out, whether you have a familiar out, etc.


I wish I understood all of that XD

The buff bar is something that I've been looking into using for when I include summoning support so that was already in my mind, although I wasn't aware pots showed up there as well so thanks for that.

Unfortunately the weakness textures are something I'm not familiar with, as well as the OGL.

Feel free to PM if you'd rather discuss there and have the time!

The Mayor

2014-07-09 00:20:43

From: Last Legend
I wish I understood all of that XD

The buff bar is something that I've been looking into using for when I include summoning support so that was already in my mind, although I wasn't aware pots showed up there as well so thanks for that.

Unfortunately the weakness textures are something I'm not familiar with, as well as the OGL.

Feel free to PM if you'd rather discuss there and have the time!


In GAO I use a DTM of the ranged weakness symbol. A better way would be to use the gold lock (which was just released in a recent update) as it would be universal meaning you wouldn't have to create multiple DTMs for each weakness type.


Last Legend

2014-07-09 00:22:48

From: The Mayor
In GAO I use a DTM of the ranged weakness symbol. A better way would be to use the gold lock (which was just released in a recent update) as it would be universal meaning you wouldn't have to create multiple DTMs for each weakness type.



You just solved a lot of issues for me! Much appreciated sir :D