# Thread: First Script - High Level Alchemy

1. Registered User
Join Date
Dec 2015
Posts
3
Mentioned
0 Post(s)
Quoted
0 Post(s)

## First Script - High Level Alchemy

Hi All!

Thought I'd have a crack at a simple OSRS High Level Alchemy script:

I haven't set it up to utilise SMART, and it also relies on having the item-to-be-alched in that spot under the spell. In order to detect whether or not the animation had finished, I used the orb of my fire staff and also implemented an occasional random mouse move to different locations on the High-Alch spell for some - at least what I think is - more human movement. Apart from that doesn't have any antiban - hadn't decided on what to include, wasn't sure on how to include...

Here it is:
Simba Code:
program HighLevelAlchemy;
{$I SRL/OSR.simba} {$I RSWalker/Walker.simba}

procedure spellOpen();
var spellTab: TPointArray;
begin
if srl.FindColors(spellTab, CTS2(1382990, 11, 0.05, 0.23), Box(727, 170, 760, 200)) > 1 then
writeLn('Spellbook is open! Found ', Length(spellTab), ' points.');
end;

procedure waitLoop();
var staffTop: TPointArray
var endAnim: Boolean
begin
repeat
wait(randomRange(100,200));
if srl.FindColors(staffTop, CTS2(1255656, 5, 0.04, 1.59), MainScreen.GetBounds) > 20 then
endAnim := True;
wait(RandomRange(75,195));
writeLn('waiting');
until(endAnim = True);
end;

procedure initialise();
var alchSpell: TPointArray;
begin
if srl.FindColors(alchSpell, CTS2(3358022, 3, 1.23, 1.25), Box(710, 304, 719, 310)) > 50 then
Mouse.Move(alchSpell[Random(Length(alchSpell))]);
end;

procedure highAlch();
var alchSpell: TPointArray;
var randomInt: Integer;
begin
randomInt := RandomRange(1,10);
if srl.FindColors(alchSpell, CTS2(3358022, 3, 1.23, 1.25), Box(710, 304, 719, 310)) > 50 then
begin
writeLn('start');
if randomInt < 8 then
begin
Mouse.Hold(mouse_Left);
wait(RandomRange(70,90));
Mouse.Release(mouse_Left);

wait(RandomRange(250,400));
Mouse.Hold(mouse_Left);
wait(RandomRange(70,90));
Mouse.Release(mouse_Left);
sleep(1500);

waitLoop();
end;
if randomInt < 7 then
begin
Mouse.Move(alchSpell[Random(Length(alchSpell))]);

Mouse.Hold(mouse_Left);
wait(RandomRange(70,90));
Mouse.Release(mouse_Left);

wait(RandomRange(250,400));
Mouse.Hold(mouse_Left);
wait(RandomRange(70,90));
Mouse.Release(mouse_Left);
sleep(1500);

waitLoop();
end;
end;
end;

begin
clearDebug();
srl.Setup([]);
spellOpen();
initialise();

repeat
highAlch();
until(false)
end.

Any feedback/thoughts/improvements would be much appreciated. Cheers!

2. Registered User
Join Date
Jul 2019
Posts
12
Mentioned
0 Post(s)
Quoted
3 Post(s)
Hi, I'm only just learning myself but since a lot of this stuff is fresh on my mind I will try and give you some feedback.

I would try using Mainscreen.GetPlayerBox instead of .GetBounds because you will pick up anyone else alching with .GetBounds.

Unless there is some reason I dont know about you shouldn't use the var keyworld for every new variable inside a subprogram. eg. it should be:
var
staffTop: TPointArray
endAnim: Boolean

I'm not sure if you need to bother with the holdmouse stuff because if you use Mouse.Click() in SRL I think it has that built in.

This is purely just my opinion but I would avoid moving the mouse between alchs at all. The reason being is Jagex tracks your mouse movements and use them to find a pattern to prove you are using a macro. If you don't move it they can't do that and for all they know you could be using mousekeys so the mouse wouldn't move at all.

I'm not sure if the randomint is supposed to be < 7 and < 8 but I could just be reading it wrong.

I would consider some failsafes/timeouts just incase something goes wrong so you are not stuck in an infinite loop.

Overall I would say it is a good effort for a first script because its simple yet very useful and you are tidy with the standards.

3. Registered User
Join Date
Dec 2015
Posts
3
Mentioned
0 Post(s)
Quoted
0 Post(s)
Hey, thanks for the reply! I was primarily considering just alching in POH, so didn't think of GetBounds issue, and didn't know the re: vars - thanks for the tip! I'm also unsure if Mouse.Click has a delay built in so I thought it be best if I just used whatever delay I recorded on my own mouse, but if I find if its built in I'll switch it over for sure.

Good catch on the <7 and <8, one was meant to be the other way around - Cheers!

Thanks also re: failsafes/timeouts, feel a bit dumb now that I didn't include those...

Once again thanks for the response

4. An easier way to determine if the alch has finished is to use the changes between tabs.

When you alch, u switch from the magic tab, select the item, then are returned straight back to the magic tab. If you select the spell again and select the item before the alch has finished, it will que up the next alch to happened as soon as the first has completed.

A good loop to follow would be:

1. Click alch.
2. CLick item.
3. Wait for tab change back to magic tab.

This process will always wait for shift back to the magic tab, meaning that the current alch has completed, and we are ready for the next alch to be qued.
It also ensures 0 xp loss while alching.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•