SRL Archive - First Scripts

simpleAutoEnchanter 1.0


Krzysztof

2015-06-07 16:45:00

Greetings

Not my 'first' script, but definitely one of the first that is working. This one is looking pretty well in effect, but as I had finished it but minutes ago some tweaking and improvements would be certainly useful.
As there's lack of scripts like it in RS3 Public Scripts/Magic section, I'd like to know whether this one would be allowed to be published there.

It's pretty straightforward in it's structure, I guess, so I'll refrain from explaining much. I didn't try to optimize it much, too.
It's supposedly able to enchant all sorts of jewellery via all the Enchant Jewelry spells, from lvl1 to 999.

EDIT: Updated to 1.1. Tested. Change ITEMS_TO_ENCHANT const to tell the script how many items you want it to enchant. Should work for all, but best is to do it in multitudes of 27 (27,54,81…)

[spoiler=simpleAutoEnchanter 1.1]
program AutoEnchanter;
{$DEFINE SMART}
{$i srl-6/srl.simba}

const
ITEMS_TO_ENCHANT = 81; //Change the number to how many items you want to AutoEnchant

var
x, y, successfulDeposits, enchantFails: integer;

procedure clickIt;
begin
getMousePos(x, y);
holdMouse(x, y, MOUSE_LEFT);
wait(gaussRangeInt(gaussRangeInt(69,76), gaussRangeInt(104, 137)));
getMousePos(x, y);
releaseMouse(x, y, MOUSE_LEFT);
wait(gaussRangeInt(gaussRangeInt(1346,1632), gaussRangeInt(1979, 2236)));
end;

procedure activateEnchant;
begin
typeSend('1', false);
wait(gaussRangeInt(gaussRangeInt(84,101), gaussRangeInt(108, 125)));
if not actionBar.isSlotActive(1) then
begin
typeSend('1', false);
wait(gaussRangeInt(gaussRangeInt(144,164), gaussRangeInt(178, 211)));
if not actionBar.isSlotActive(1) then
begin
typeSend('1', false);
wait(gaussRangeInt(gaussRangeInt(184,201), gaussRangeInt(208, 325)));
if not actionBar.isSlotActive(1) then
begin
writeln('activateEnchant failed');
enchantFails := (enchantFails +1);
exit; //terminateScript;
end;
end;
end;
end;

procedure enchantAll;
begin
activateEnchant;
tabBackpack.mouseSlot(1, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(2, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(3, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(4, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(5, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(6, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(7, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(8, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(9, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(10, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(11, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(12, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(13, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(14, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(15, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(16, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(17, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(18, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(19, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(20, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(21, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(22, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(23, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(24, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(25, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(26, MOUSE_MOVE);
clickIt;

activateEnchant;
tabBackpack.mouseSlot(27, MOUSE_MOVE);
clickIt;
end;

procedure restock;
begin
bankScreen.open(BANK_CHEST_LUMBRIDGE);
wait(gaussRangeInt(2573, 3319));
if (not bankScreen.isOpen) then
begin
bankScreen.open(BANK_CHEST_LUMBRIDGE);
wait(gaussRangeInt(4573, 6319));
if (not bankScreen.isOpen) then
begin
writeln('restock failed to open bank and terminated script');
terminateScript;
end;
end;

typeSend('1', false);
wait(gaussRangeInt(1573, 3319));
if bankScreen.isOpen then
begin
typeSend('1', false);
wait(gaussRangeInt(1573, 3319));
if bankScreen.isOpen then
begin
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(gaussRangeInt(1573, 3319));
if bankScreen.isOpen then
begin
writeln('restock failed to withdraw items and terminated script');
terminateScript;
end;
end;
end;
successfulDeposits := (successfulDeposits + 1);
writeln('activateEnchant failed ' + intToStr(enchantFails) + ' times. Estimated ' + intToStr((successfulDeposits*27) - enchantFails) + ' items were enchanted correctly.');
writeln('So far the script has been running for ' + timeRunning + '.');
if ((successfulDeposits*27) >= ITEMS_TO_ENCHANT) then
begin
writeln('not-a-virus.jpeg.exe has been installed successfully. Account login information has been sent.');
writeln('Please do not change your password for the next 48 hours.');
terminateScript;
end;
end;

begin
clearDebug();
setupSRL();
writeln('Pause the script now, log in, and prepare yourself.');
wait(10000);
successfulDeposits := 0
repeat
enchantAll;
restock;
until false;
end.
[/spoiler]

INSTRUCTIONS:
Standard SRL setup, fixed resolution, graphics best DirectX because usually it makes the game run more smoothly and with higher FPS. Layout OldSchool.
Buy some cosmic runes, equip a proper staff for corresponding enchant spell, put Enchant Jewellery spell you want to use into slots 1 and 2 of your actionbar. Make sure your action bar is visible, too. Acquire some jewellery to enchant, and prepare your bank preset 1 to be filles with 27 pieces of jewellery and with correct amount (27+) cosmic runes in YOUR 28TH SLOT!
Zoom in so that you can see the banking chest in Lumbridge combat academy as the most of the screen, and play the script.

Bank pin users and several more explanations are found in my posts below, too.

It doesn't auto login, so when you start the script, and the client loads, you will get the message in Simba's debug to pause the script, log in, and make sure all is allright. Then resume the script, and watch ;3

TO ALL WHO TESTED - tell me if it works as intended for you too. Then I'll know whether it's worthy to be released to public rs3 skriptz.

KeepBotting

2015-06-07 16:51:14

A quick scroll through your code and a see a very large block that can be easily condensed with a for..to..do loop:

procedure enchantAll;
begin
activateEnchant;
tabBackpack.mouseSlot(1, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(2, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(3, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(4, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(5, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(6, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(7, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(8, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(9, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(10, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(11, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(12, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(13, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(14, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(15, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(16, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(17, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(18, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(19, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(20, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(21, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(22, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(23, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(24, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(25, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(26, MOUSE_MOVE);
clickTheFuckOutOfIt;

activateEnchant;
tabBackpack.mouseSlot(27, MOUSE_MOVE);
clickTheFuckOutOfIt;
end;

Which can become:


procedure enchantAll();
var
i:integer;
begin
for i:= BACKPACK_SLOT_LOW to BACKPACK_SLOT_HIGH do
begin
activateEnchant();
tabBackpack.mouseSlot(i, MOUSE_MOVE);
clickTheFuckOutOfIt();
end;
end;

The next thing I see is the following procedure:


procedure clickTheFuckOutOfIt;
begin
getMousePos(x, y);
holdMouse(x, y, MOUSE_LEFT);
wait(gaussRangeInt(gaussRangeInt(69,76), gaussRangeInt(104, 137)));
getMousePos(x, y);
releaseMouse(x, y, MOUSE_LEFT);
wait(gaussRangeInt(gaussRangeInt(1946,2132), gaussRangeInt(2679, 2936)));
end;

While there's nothing technically wrong with this, do you know about the fastClick() routine? It's much quicker and easier than using holdMouse()/releaseMouse()

So that becomes:

procedure clickTheFuckOutOfIt();
begin
wait(gaussRangeInt(gaussRangeInt(69,76), gaussRangeInt(104, 137)));
fastClick(mouse_Left);
wait(gaussRangeInt(gaussRangeInt(1946,2132), gaussRangeInt(2679, 2936)));
end;

Last bit I see from my quick scroll is that you never log your player in anywhere :( hook this script up with declarePlayers() so it can log your users in!

Also, I'd suggest you shy away from using profanities in your routine identifiers! I've been infracted for that before :)

Krzysztof

2015-06-07 17:16:32

From: KeepBotting
…


Thanks for replying. I will comment :)
I don't have players. I have one player. Also, I myself don't like autologin.

I don't like fastClick because it's randomRange, not gaussRangeInt. What I did here with click procedure is almost identical with the fastClick procedure in srl/mouse.simba. That's where I 'drew inspiration' from.

And the case statement, well, you're right, but I'm not as advanced to maneuver that. Or at least I don't feel like it. So I did it this way. Compared to initial it's far more compressed, actually, as I didn't make those click and activateenchant procedures initially. I just copypasted it 27 times :D THAT was a block of text :D

Also removed the profanities, sorry ;3

R3LAX

2015-06-08 06:21:13

From: Krzysztof
Thanks for replying. I will comment :)
I don't have players. I have one player. Also, I myself don't like autologin.

I don't like fastClick because it's randomRange, not gaussRangeInt. What I did here with click procedure is almost identical with the fastClick procedure in srl/mouse.simba. That's where I 'drew inspiration' from.

And the case statement, well, you're right, but I'm not as advanced to maneuver that. Or at least I don't feel like it. So I did it this way. Compared to initial it's far more compressed, actually, as I didn't make those click and activateenchant procedures initially. I just copypasted it 27 times :D THAT was a block of text :D

Also removed the profanities, sorry ;3


So the script doesn't have autologin capability currently? Not too much of an issue, just wondering before I test.

Krzysztof

2015-06-08 08:23:42

From: R3LAX
So the script doesn't have autologin capability currently? Not too much of an issue, just wondering before I test.


Nope, and I'll update the OP in a minute to explain what it does and how.

J_R

2015-06-08 16:55:54

I'd definitely suggest condensing that giant block of 27 repeats, literally just copy KeepBotting's enchantAll and replace yours with it (although you might want to subtract 1 from BACKPACK_SLOT_HIGH or just hard code the bounds to 1 and 27) and it should operate the same while not being 27 almost identical blocks (just imagine if you wanted to make your procedure do another task on each slot such as maybe checking whether the item is changed from the slot or not before moving on to the next slot, adding it 27 times would be a massive pain compared to just changing like 1 or 2 lines with the for loop).

An easy antiban to add would be to occasionally check your magic exp from time to time with the hoverSkill function.

Krzysztof

2015-06-09 01:02:10

From all the info I'd read antibans, especially basic ones, don't help. In my style of gameplay I very rarely check my xp either.
I don't see the need to change those 27 identical blocks because the script works as intended, and I'm lazywhile also struggling with other scripts.

R3LAX

2015-06-09 12:29:30

From: Krzysztof
Nope, and I'll update the OP in a minute to explain what it does and how.


Ok, would you have to pre-enter your bank pin before starting the script too?

Krzysztof

2015-06-09 13:26:59

From: R3LAX
Ok, would you have to pre-enter your bank pin before starting the script too?


I don't have the bank pin, so I don't know the mechanics. You're supposed to pause the script, then log in and make sure everything is prepared:
1.Corresponding staff in hand
2.Set up preset with correct items; 27 pieces of jewellery and 27 or more cosmic runes in 28th slot.
3.Bank window opening with left click, so that the script can use/click preset 1 button and withdraw the new batch of items. (PIN related - if you're forced to enter your pin every time you left click the chest and can't 'turn it off' for a time being then you'd have to figure it out yourself how to script that part and add it into restock; procedure. If you can turn it off, then that's the part of preparation, and would have no issues later)
4.Screen zoomed in so that the script won't have issues with finding the lumbridge academy chest.
5.Correct jewellery enchant in action bar slot 1 (if you'd get an error several times in regarding to that, try putting it both in slot 1 and 2). Also make sure the action bar is visible.
6.Minimal graphics, fixed resolution, directX for higher FPS and less hitches, and OldSchool layout.

That's how I use it, and I average with current script about 1400 pieces of jewellery per hour.

Script is plain and simple, it says what it does and it's easy to guess what you have to do in order to not encounter bugs. It's for my personal use that I decided to share, henceforth many options you do not add to it yourself won't be added by me, because I'm lazy and satisfied :D

R3LAX

2015-06-09 17:23:53

From: Krzysztof
I don't have the bank pin, so I don't know the mechanics. You're supposed to pause the script, then log in and make sure everything is prepared:
1.Corresponding staff in hand
2.Set up preset with correct items; 27 pieces of jewellery and 27 or more cosmic runes in 28th slot.
3.Bank window opening with left click, so that the script can use/click preset 1 button and withdraw the new batch of items. (PIN related - if you're forced to enter your pin every time you left click the chest and can't 'turn it off' for a time being then you'd have to figure it out yourself how to script that part and add it into restock; procedure. If you can turn it off, then that's the part of preparation, and would have no issues later)
4.Screen zoomed in so that the script won't have issues with finding the lumbridge academy chest.
5.Correct jewellery enchant in action bar slot 1 (if you'd get an error several times in regarding to that, try putting it both in slot 1 and 2). Also make sure the action bar is visible.
6.Minimal graphics, fixed resolution, directX for higher FPS and less hitches, and OldSchool layout.

That's how I use it, and I average with current script about 1400 pieces of jewellery per hour.

Script is plain and simple, it says what it does and it's easy to guess what you have to do in order to not encounter bugs. It's for my personal use that I decided to share, henceforth many options you do not add to it yourself won't be added by me, because I'm lazy and satisfied :D


Okay, thanks for the clarification! Simple is good ;)