SRL Archive - RS3 Outdated / Broken Scripts

Auto Alch


pyroryan

2010-02-11 19:31:30

Alright guys, here's my first script. It's an alcher, and does more than 1k alchs an hour. This script is derived from Coh3n's woodcutting script, so all, and I do mean all, credit should go to him. There is no stats, so all feedback will have to be from you guys. It checks for randoms, and takes a break every hour or so.

If the script can't solve a random after 5 tries it logs out. Not being able to solve the randoms is an SRL issue, not a scripting issue. The best I can do is to increase the opportunities that it has to search for the randoms. As of this writing, the script will find the randoms, but fails to solve any teleport randoms. Once again, this seems to be an SRL issue.

Instructions, please follow correctly:
1. Equip fire staff.
2. Place item to alch in noted form in the 3rd inventory slot.
3. Hide combat, teleport and skill spells. (VERY IMPORTANT)
4. Turn off all chat but game.
5. Make sure you have enough nature runes in your inventory.
6. Set the number of items to alch. Do not put a number higher than the number of items you have.
7. Post any progress reports and/or bugs!

{==============================================================================]
[ Instructions ]
[==============================================================================]
[ ]
[ 1. Equip fire staff. ]
[ 2. Place item to alch in noted form in the 3rd inventory slot. ]
[ 3. Hide combat, teleport and skill spells. (VERY IMPORTANT) ]
[ 4. Turn off all chat but game. ]
[ 5. Make sure you have enough nature runes in your inventory. ]
[ 6. Post any progress reports and/or bugs! ]
[ 7. Determine whether or not you're using SMART (line 16). ]
[ Created by pyroryan. Major credit to Coh3n for letting me use his script ]
[ as a base. ]
[ ]
[==============================================================================}

program AutoAlch;
{.Include srl\srl\Misc\Smart.scar}
{.Include srl\srl.scar}
{.Include srl\srl\Misc\Debug.scar}

const
// Integers.
TAlchs = 0;
Alchs = 1;
LEVELS = 2;
EXP = 3;
BREAKS = 4;

// Booleans.
TAKE_BREAKS = 0;

// Strings.
LAMP_SKILL = 0;

{ const Mouse Constants;
Description: Constants representing different types mouse clicks. }
const
MOUSE_OPTIONS = 3;
CLICK_LEFT = 1;
CLICK_RIGHT = 2;
HOVER = 3;

{ var Global;
Description: Global variables used throughout the script. }
var
srl_MMTPA: TPointArray;
startLevel: Integer;

{==============================================================================]
[ Setup the script from here to line 77! ]
[==============================================================================}

const
SMART_WORLD = 152; // World to load.
SMART_MEMBERS_WORLD = False; // True = Members world.
SMART_HIGH_DETAIL = False; // True = High detail.
SMART_SIGNED_CLIENT = True; // True = Signed client.

const
RANDOM_SOUND = False; // True = a sound when a random is found.
BREAK_TIME = 10; // How long to break for (in minutes).
// Script will +/- a random 5 minutes.

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := 'Username';
Pass := 'Password';
Nick := ''; // 3-4 LOWERCASE letters from your username.
Active := True; // True = use this player.
Integers[TAlchs] := 450; // Total times to alch.
Booleans[TAKE_BREAKS] := True; // True = the script will take breaks.
Strings[LAMP_SKILL] := 'Magic';
BoxRewards := ['amp', 'mote', 'ostume', 'oins', 'unes', 're', 'ems'];
Integers[LEVELS] := 0; //Do not edit this.
end;
end;

{==============================================================================]
[ Don't edit below this ]
[==============================================================================}

{*******************************************************************************
function AC_CircleTPA(cX, cY, r: Integer): TPointArray;
By: Nava2
Description: Creates a TPA of a circle with radius 'r' and center point cX, cY.
*******************************************************************************}
function AC_CircleTPA(cX, cY, r: Integer): TPointArray;
var
i, j, l, tX, tY: Integer;
begin
setLength(Result, 4 * r * r);
l := 2 * r - 1;
tX := cX - r;
tY := cY - r;
for i := 0 to l do
for j := 0 to l do
Result[j + l * i] := Point(tX + i, tY + j);

Result := RemoveDistTPointArray(cX, cY, r, Result, True);
end;

{*******************************************************************************
function AC_ReturnMMTPA: TPointArray;
By: Nava2
Description: Performs AC_CircleTPA for the RS minimap.
*******************************************************************************}
function AC_ReturnMMTPA: TPointArray;
begin
if High(srl_MMTPA) < 0 then
begin
Result := AC_CircleTPA(MMCX, MMCY, (MMX2 - MMX1) div 2);
srl_MMTPA := Result;
end else
Result := srl_MMTPA;
end;

procedure Load_Antiban;
var
i, x, y: Integer;
begin
case Random(40) of

0: begin // Boredhuman without camera movement.
Writeln('Performing Antiban - Boredhuman.');
if not LoggedIn then Exit;
for i := 1 to (1 + Random(5)) do
begin
MMouse(Random(MSX2), Random(MSY2), 0, 0);
if IsUpText('opti') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('Examine');
end;
end;
end;

10: begin
Writeln('Performing Antiban - HoverSkill[Random].');
HoverSkill('random', False);
end;

20: begin
Writeln('Performing Antiban - RandomRClick.');
RandomRClick;
end;

30: begin
Writeln('Performing Antiban - HoverSkill[Magic].');
HoverSkill('magic', False);
end;

40: begin
Writeln('Performing Antiban - PickUpMouse.');
PickUpMouse;
end;

end;
end;

procedure Next_Break;
begin
if (not LoggedIn) then
Exit;

begin
Writeln('Taking a ' + IntToStr(BREAK_TIME) + ' minute break.');
Logout;
Wait((BREAK_TIME * 60000) + RandomRange(-300000, 300000));
Writeln('Break over, logging back in.');
LoginPlayer;
end;

with Players[CurrentPlayer] do
Integers[BREAKS] := Integers[BREAKS] + 1;
end;

procedure Find_Randoms;
var
soundStr: String;
begin
if (not LoggedIn) then
Exit;

LampSkill := Lowercase(Players[CurrentPlayer].Strings[LAMP_SKILL]);
Writeln('Scanning for random events...');

if (FindNormalRandoms) then
begin
if (RANDOM_SOUND) then
begin
PlaySound(ScriptPath + 'RandomSound.wav');
soundStr := 'Playing Random Sound.';
end;

Writeln('Found Random! ' + soundStr);
end;

UseRewardBox;
FindLamp(LampSkill);
end;

procedure Setup_Report;
begin
Writeln('[=================================================================]');
Writeln(PadR('[ Auto Alch ', 66) + ']');
Writeln('[=================================================================]');
Writeln('[ ]');

with Players[CurrentPlayer] do
begin
Writeln(PadR('[ Ran For: ' + TimeRunning, 66) + ']');
Writeln(PadR('[ Items Alched: ' + IntToStr(Integers[Alchs]), 66) + ']');
Writeln(PadR('[ Levels Gained: ' + IntToStr(Integers[LEVELS]), 66) + ']');
Writeln(PadR('[ Breaks: ' + IntToStr(Integers[BREAKS]), 66) + ']');
end;
Writeln('[ ]');
Writeln('[=================================================================]');
Writeln('[=================================================================]');
end;

procedure Setup_Player;
begin
LoginPlayer;
SetAngle(True);
startLevel := GetSkillLevel('magic');
Writeln('Current Magic Level: ' + IntToStr(startLevel) + '.');
end;

procedure Setup_Script;
begin
Smart_Server := SMART_WORLD;
Smart_Signed := SMART_SIGNED_CLIENT;
Smart_SuperDetail := SMART_HIGH_DETAIL;

Writeln('Loading, please wait...');
SetupSRL;
ActivateClient;
DeclarePlayers;
Disguise('Items alched: 0');
end;

procedure Alch_items;
var
a,b,r: Integer;
begin
if (not LoggedIn) then
Exit;
begin
a:=0;
r:=0;
b:=RandomRange(40, 50);

repeat
if(GameTab(tab_Magic)) then
begin
Mouse(643+RandomRange(-5,5), 230+RandomRange(-5,5), 3, 3, True);
Wait(RandomRange(100, 200));
Mouse(660+RandomRange(-5,5), 228+RandomRange(-5,5), 3, 3, True);
Wait(RandomRange(1000, 1200));
a:=a+1;
r:=0;

with Players[CurrentPlayer] do
begin
Integers[Alchs] := Integers[Alchs] + 1;
Disguise('Items Alched: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs]));
if (FindNPCChatText('ongrat', Nothing) or FindNPCChatText('dvanced', Nothing) or FindNPCChatText('ulatio', Nothing) or FindNPCChatText('agic', Nothing)) then
begin
Writeln('Magic level gained!');
with Players[CurrentPlayer] do
begin
Integers[Levels] := Integers[Levels] + 1;
end;
end;

if(Integers[Alchs]=Integers[TAlchs]) then
begin
Writeln('Alched desired number of items, exiting.');
Setup_Report;
Logout;
TerminateScript;
end;
end;
end else
begin
Writeln('Can''t find magic tab, possibly in a random!');
Find_Randoms;
r:=r+1;
if (r=5) then
begin
Writeln('Can''t find magic tab or solve random after 5 tries, exiting.');
Setup_Report;
Logout;
TerminateScript;
end;
end;
until(a>b);

Wait(RandomRange(100, 1000));
Find_Randoms;
Load_Antiban;
end;
end;

procedure Setup_MainLoop;
var
sinceLogin: Integer;
begin
Setup_Script;
sinceLogin := 0;
MarkTime(sinceLogin);
Setup_Player;
repeat
Alch_items;

if (Players[CurrentPlayer].Booleans[TAKE_BREAKS]) then
if (TimeFromMark(sinceLogin) >= (60*60000+RandomRange(-300000, 300000))) then
begin
Setup_Report;
Next_Break;
MarkTime(sinceLogin);
end;

until(AllPlayersInactive);
end;

begin
Setup_MainLoop;
end.

Hexzar

2010-02-12 12:00:50

Firstly, It logs in but for some reason doesn't click the "click to play runescape" button on the welcome screen… Had to do it manually.

Next it keeps clicking magic tab then invo and gives this message each time -

"Can't find magic tab, possibly in a random!
Scanning for random events…"

Frement

2010-02-12 12:07:18

From: Hexzar
Firstly, It logs in but for some reason doesn't click the "click to play runescape" button on the welcome screen… Had to do it manually.

Next it keeps clicking magic tab then invo and gives this message each time -

"Can't find magic tab, possibly in a random!
Scanning for random events…"


Latest SCAR + opendev?

Hexzar

2010-02-12 12:25:21

From: Frement
Latest SCAR + opendev?


Downloaded scar today from - http://freddy1990.com/index.php?page=product&name=scar

Then clicked download includes/SRL.

Then followed this tutorial - http://www.villavu.com/forum/showthread.php?t=47714

And set up SNV for SRL part only. Then i copy and pasted the includes folder to the plugins folder like it said.

Anything I'm missing here?

code841

2010-02-12 13:41:21

From: Hexzar
Downloaded scar today from - http://freddy1990.com/index.php?page=product&name=scar

Then clicked download includes/SRL.

Then followed this tutorial - http://www.villavu.com/forum/showthread.php?t=47714

And set up SNV for SRL part only. Then i copy and pasted the includes folder to the plugins folder like it said.

Anything I'm missing here?


Well you don't want the on on Freddies downloads page, it's more than a month out of date.
http://freddy1990.com/svn/scarprerelease/scar.exe <– Is the 3.23 "beta" which uses the fixed UpText and other stuff you want (simply replace the old scar.exe with the new one).

Hexzar

2010-02-12 14:12:51

Ah, now when i click play it says -

"Failed when compiling
Line 270: [Error] (15553:1): Invalid number of parameters in script C:\Program Files (x86)\SCAR 3.22\includes\SRL\SRL\Core\AntiRandoms\Sandwich.scar"

pyroryan

2010-02-12 14:51:08

You want to use the open dev srl, not the downloads from scar. Follow that same guide on installing tortoise svn and do a checkout with the supplied link. Move the plugins to the folder and you should be good to go.

Hexzar

2010-02-12 15:20:08


Don't know why that ! comes, i updated it to the latest revision and i copy and pasted the contents in the folder "place inside plugins folder" inside the actual plugins folder of my scar.

swisspking

2010-02-12 15:33:44

I also had that problem a while ago, just download srl manually and this shouldn't happen anymore :)

Hexzar

2010-02-14 08:55:24

Ran For: 1 Hours, 37 Minutes and 27 Seconds ]
[ Items Alched: 1158 ]
[ Levels Gained: 0 ]
[ Breaks: 1

Nice =)

pyroryan

2010-02-14 18:00:39

Increased alching speed. Please get new script.

[=================================================================]
[ Auto Alch ]
[=================================================================]
[ ]
[ Ran For: 24 Minutes and 37 Seconds ]
[ Items Alched: 450 ]
[ Levels Gained: 1 ]
[ Breaks: 0 ]
[ ]
[=================================================================]
[=================================================================]

phantom1

2010-05-06 16:15:56

very nice script.. ill post proggies later

phantom1

2010-05-06 16:51:09

[=================================================================]
[ Auto Alch ]
[=================================================================]
[ ]
[ Ran For: 28 Minutes and 26 Seconds ]
[ Items Alched: 450 ]
[ Levels Gained: 1 ]
[ Breaks: 0 ]
[ ]
[=================================================================]
[=================================================================]
Successfully executed

phantom1

2010-05-06 21:02:35

[=================================================================]
[ Auto Alch ]
[=================================================================]
[ ]
[ Ran For: 2 Hours, 11 Seconds ]
[ Items Alched: 1655 ]
[ Levels Gained: 5 ]
[ Breaks: 1 ]
[ ]
[=================================================================]
[=================================================================]
Successfully executed

Mclarenvj

2010-07-15 06:53:47

[=================================================================]
[ Auto Alch ]
[=================================================================]
[ ]
[ Ran For: 58 Minutes and 3 Seconds ]
[ Items Alched: 1093 ]
[ Levels Gained: 1 ]
[ Breaks: 0 ]
[ ]
[=================================================================]
[=================================================================]


i'm lovin' it

EDIT:
I've spent my day fiddling around with the Progress Report of it… finally done it. :D

The Progress Report is shown after every alch cast and shows more information. Then a Final Report is shown at the end. I'm a newb to this, so go easy ;)
example

[=================================================================]
[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch Progress ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]
[=================================================================]
[ Running Time: 51 Seconds ]
[ Items Alched: 6 ]
[ Levels Gained: 0 ]
[ Anti-Bans Performed: 0 ]
[ Random Searches Performed: 0 ]
[ Random Events Found: 0 ]
[ Breaks: 0 ]
[=================================================================]
and

[=================================================================]
[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]
[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~Final Report~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ]
[=================================================================]
[ Ran For: 26 Minutes and 12 Seconds ]
[ Items Alched: 500 ]
[ Levels Gained: 1 ]
[ Anti-Bans Performed: 1 ]
[ Random Searches Performed: 10 ]
[ Random Events Found: 0 ]
[ Breaks: 0 ]
[=================================================================]



{==============================================================================]
[ Instructions ]
[==============================================================================]
[ ]
[ 1. Equip fire staff. ]
[ 2. Place item to alch in noted form in the 3rd inventory slot. ]
[ 3. Hide combat, teleport and skill spells. (VERY IMPORTANT) ]
[ 4. Turn off all chat but game. ]
[ 5. Make sure you have enough nature runes in your inventory. ]
[ 6. Post any progress reports and/or bugs! ]
[ 7. Determine whether or not you're using SMART (line 16). ]
[ Created by pyroryan. Major credit to Coh3n for letting me use his script ]
[ as a base. ]
[ ]
[==============================================================================}

program AutoAlch;
{.Include srl\srl\Misc\Smart.scar}
{.Include srl\srl.scar}
{.Include srl\srl\Misc\Debug.scar}

const
// Integers.
TAlchs = 0;
Alchs = 1;
LEVELS = 2;
EXP = 3;
BREAKS = 4;
ANTIBAN = 5;
RANDOMSEARCH = 6;
RANDOMEVENT = 7;
// Booleans.
TAKE_BREAKS = 0;

// Strings.
LAMP_SKILL = 0;

{ const Mouse Constants;
Description: Constants representing different types mouse clicks. }
const
MOUSE_OPTIONS = 3;
CLICK_LEFT = 1;
CLICK_RIGHT = 2;
HOVER = 3;

{ var Global;
Description: Global variables used throughout the script. }
var
srl_MMTPA: TPointArray;
startLevel: Integer;

{==============================================================================]
[ Setup the script from here to line 77! ]
[==============================================================================}

const
SMART_WORLD = 144; // World to load.
SMART_MEMBERS_WORLD = True; // True = Members world.
SMART_HIGH_DETAIL = False; // True = High detail.
SMART_SIGNED_CLIENT = True; // True = Signed client.

const
RANDOM_SOUND = False; // True = a sound when a random is found.
BREAK_TIME = 10; // How long to break for (in minutes).
// Script will +/- a random 5 minutes.

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := ''; // 3-4 LOWERCASE letters from your username.
Active := True; // True = use this player.
Integers[TAlchs] := 500; // Total times to alch.
Booleans[TAKE_BREAKS] := True; // True = the script will take breaks.
Strings[LAMP_SKILL] := 'Magic';
BoxRewards := ['amp', 'mote', 'ostume', 'oins', 'unes', 're', 'ems'];
Integers[LEVELS] := 0; //Do not edit this.
end;
end;

{==============================================================================]
[ Don't edit below this ]
[==============================================================================}

{*******************************************************************************
function AC_CircleTPA(cX, cY, r: Integer): TPointArray;
By: Nava2
Description: Creates a TPA of a circle with radius 'r' and center point cX, cY.
*******************************************************************************}
function AC_CircleTPA(cX, cY, r: Integer): TPointArray;
var
i, j, l, tX, tY: Integer;
begin
setLength(Result, 4 * r * r);
l := 2 * r - 1;
tX := cX - r;
tY := cY - r;
for i := 0 to l do
for j := 0 to l do
Result[j + l * i] := Point(tX + i, tY + j);

Result := RemoveDistTPointArray(cX, cY, r, Result, True);
end;

{*******************************************************************************
function AC_ReturnMMTPA: TPointArray;
By: Nava2
Description: Performs AC_CircleTPA for the RS minimap.
*******************************************************************************}
function AC_ReturnMMTPA: TPointArray;
begin
if High(srl_MMTPA) < 0 then
begin
Result := AC_CircleTPA(MMCX, MMCY, (MMX2 - MMX1) div 2);
srl_MMTPA := Result;
end else
Result := srl_MMTPA;
end;

procedure Load_Antiban;
var
i, x, y: Integer;
begin
case Random(40) of

0: begin // Boredhuman without camera movement.
Writeln('Performing Antiban - Boredhuman.');
if not LoggedIn then Exit;
for i := 1 to (1 + Random(5)) do
begin
MMouse(Random(MSX2), Random(MSY2), 0, 0);
if IsUpText('opti') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('Examine');
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;
end;
end;

10: begin
Writeln('Performing Antiban - HoverSkill[Random].');
HoverSkill('random', False);
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

20: begin
Writeln('Performing Antiban - RandomRClick.');
RandomRClick;
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

30: begin
Writeln('Performing Antiban - HoverSkill[Magic].');
HoverSkill('magic', False);
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

40: begin
Writeln('Performing Antiban - PickUpMouse.');
PickUpMouse;
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

end;
end;

procedure Next_Break;
begin
if (not LoggedIn) then
Exit;

begin
Writeln('Taking a ' + IntToStr(BREAK_TIME) + ' minute break.');
Logout;
Wait((BREAK_TIME * 60000) + RandomRange(-300000, 300000));
Writeln('Break over, logging back in.');
LoginPlayer;
end;

with Players[CurrentPlayer] do
Integers[BREAKS] := Integers[BREAKS] + 1;
end;

procedure Find_Randoms;
var
soundStr: String;
begin
if (not LoggedIn) then
Exit;

LampSkill := Lowercase(Players[CurrentPlayer].Strings[LAMP_SKILL]);
Writeln('Scanning for random events...');
with Players[CurrentPlayer] do
Integers[RANDOMSEARCH] := Integers[RANDOMSEARCH] + 1;
if (FindNormalRandoms) then
begin
if (RANDOM_SOUND) then
begin
PlaySound(ScriptPath + 'RandomSound.wav');
soundStr := 'Playing Random Sound.';
end;

Writeln('Found Random! ' + soundStr);
with Players[CurrentPlayer] do
Integers[RANDOMEVENT] := Integers[RANDOMEVENT] + 1;
end;

UseRewardBox;
FindLamp(LampSkill);
end;

procedure Setup_Report_Loop;
begin
ClearDebug;
Writeln('[=================================================================]');
Writeln('[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch Progress ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]');
Writeln('[=================================================================]');

with Players[CurrentPlayer] do
begin
Writeln(PadR('[ Running Time: ' + TimeRunning, 66) + ']');
Writeln(PadR('[ Items Alched: ' + IntToStr(Integers[Alchs]), 66) + ']');
Writeln(PadR('[ Levels Gained: ' + IntToStr(Integers[LEVELS]), 66) + ']');
Writeln(PadR('[ Anti-Bans Performed: ' + IntToStr(Integers[ANTIBAN]), 66) + ']');
Writeln(PadR('[ Random Searches Performed: ' + IntToStr(Integers[RANDOMSEARCH]), 66) + ']');
Writeln(PadR('[ Random Events Found: ' + IntToStr(Integers[RANDOMEVENT]), 66) + ']');
Writeln(PadR('[ Breaks: ' + IntToStr(Integers[BREAKS]), 66) + ']');
end;
Writeln('[=================================================================]');
end;

procedure Setup_Report;
begin
ClearDebug;
Writeln('[=================================================================]');
Writeln('[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]');
WriteLn('[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~Final Report~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ]');
Writeln('[=================================================================]');

with Players[CurrentPlayer] do
begin
Writeln(PadR('[ Ran For: ' + TimeRunning, 66) + ']');
Writeln(PadR('[ Items Alched: ' + IntToStr(Integers[Alchs]), 66) + ']');
Writeln(PadR('[ Levels Gained: ' + IntToStr(Integers[LEVELS]), 66) + ']');
Writeln(PadR('[ Anti-Bans Performed: ' + IntToStr(Integers[ANTIBAN]), 66) + ']');
Writeln(PadR('[ Random Searches Performed: ' + IntToStr(Integers[RANDOMSEARCH]), 66) + ']');
Writeln(PadR('[ Random Events Found: ' + IntToStr(Integers[RANDOMEVENT]), 66) + ']');
Writeln(PadR('[ Breaks: ' + IntToStr(Integers[BREAKS]), 66) + ']');
end;
Writeln('[=================================================================]');
end;

procedure Setup_Player;
begin
LoginPlayer;
SetAngle(True);
startLevel := GetSkillLevel('magic');
Writeln('Current Magic Level: ' + IntToStr(startLevel) + '.');
end;

procedure Setup_Script;
begin
Smart_Server := SMART_WORLD;
Smart_Signed := SMART_SIGNED_CLIENT;
Smart_SuperDetail := SMART_HIGH_DETAIL;

Writeln('Loading, please wait...');
SetupSRL;
ActivateClient;
DeclarePlayers;
Disguise('Items alched: 0');
end;

procedure Alch_items;
var
a,b,r: Integer;
begin
if (not LoggedIn) then
Exit;
begin
a:=0;
r:=0;
b:=RandomRange(40, 50);

repeat
if(GameTab(tab_Magic)) then
begin
Mouse(643+RandomRange(-5,5), 230+RandomRange(-5,5), 3, 3, True);
Wait(RandomRange(100, 200));
Mouse(660+RandomRange(-5,5), 228+RandomRange(-5,5), 3, 3, True);
Wait(RandomRange(1000, 1200));
a:=a+1;
r:=0;

with Players[CurrentPlayer] do
begin
Integers[Alchs] := Integers[Alchs] + 1;
Disguise('Items Alched: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs]));
Setup_Report_Loop;
if (FindNPCChatText('ongrat', Nothing) or FindNPCChatText('dvanced', Nothing) or FindNPCChatText('ulatio', Nothing) or FindNPCChatText('agic', Nothing)) then
begin
Writeln('Magic level gained!');
with Players[CurrentPlayer] do
begin
Integers[Levels] := Integers[Levels] + 1;
end;
end;

if(Integers[Alchs]=Integers[TAlchs]) then
begin
Writeln('Alched desired number of items, exiting.');
Setup_Report;
Logout;
TerminateScript;
end;
end;
end else
begin
Writeln('Can''t find magic tab, possibly in a random!');
Find_Randoms;
r:=r+1;
if (r=5) then
begin
Writeln('Can''t find magic tab or solve random after 5 tries, exiting.');
Setup_Report;
Logout;
TerminateScript;
end;
end;
until(a>b);

Wait(RandomRange(100, 1000));
Find_Randoms;
Load_Antiban;
end;
end;

procedure Setup_MainLoop;
var
sinceLogin: Integer;
begin
Setup_Script;
sinceLogin := 0;
MarkTime(sinceLogin);
Setup_Player;
repeat
Alch_items;

if (Players[CurrentPlayer].Booleans[TAKE_BREAKS]) then
if (TimeFromMark(sinceLogin) >= (60*60000+RandomRange(-300000, 300000))) then
begin
Setup_Report;
Next_Break;
MarkTime(sinceLogin);
end;

until(AllPlayersInactive);
end;

begin
Setup_MainLoop;
end.

marksteele

2010-08-01 15:34:30

[=================================================================]
[ Auto Alch ]
[=================================================================]
[ ]
[ Ran For: 56 Minutes and 54 Seconds ]
[ Items Alched: 1184 ]
[ Levels Gained: 0 ]
[ Breaks: 0 ]
[ ]
[=================================================================]
[=================================================================]

[=================================================================]
[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch Progress ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]
[=================================================================]
[ Running Time: 1 Hours, 36 Minutes and 52 Seconds ]
[ Items Alched: 2326 ]
[ Levels Gained: 1 ]
[ Anti-Bans Performed: 51 ]
[ Random Searches Performed: 52 ]
[ Random Events Found: 1 ]
[ Breaks: 1 ]
[=================================================================]

only other thing it can you give it a longer time to retry the spell casting, sometimes after i come back from a random it takes too long to load.

I've been fiddling around with this code while I'm learning and I changed a few things, took out some unneeded lines, and have been working on fixing a part where it seems to randomly log me out even though I'm not in a random.

{==============================================================================]
[ Instructions ]
[==============================================================================]
[ ]
[ 1. Equip fire staff. ]
[ 2. Place item to alch in noted form in the 3rd inventory slot. ]
[ 3. Hide combat, teleport and skill spells. (VERY IMPORTANT) ]
[ 4. Turn off all chat but game. ]
[ 5. Make sure you have enough nature runes in your inventory. ]
[ 6. Post any progress reports and/or bugs! ]
[ 7. Determine whether or not you're using SMART (line 16). ]
[ Created by pyroryan. Major credit to Coh3n for letting me use his script ]
[ as a base. ]
[ ]
[==============================================================================}

program AutoAlch;
{.Include srl\srl\Misc\Smart.scar}
{.Include srl\srl.scar}
{.Include srl\srl\Misc\Debug.scar}

const
// Integers.
TAlchs = 0;
Alchs = 1;
LEVELS = 2;
EXP = 3;
BREAKS = 4;
ANTIBAN = 5;
RANDOMSEARCH = 6;
RANDOMEVENT = 7;
// Booleans.
TAKE_BREAKS = 0;

// Strings.
LAMP_SKILL = 0;

{ const Mouse Constants;
Description: Constants representing different types mouse clicks. }
const
MOUSE_OPTIONS = 3;
CLICK_LEFT = 1;
CLICK_RIGHT = 2;
HOVER = 3;

{ var Global;
Description: Global variables used throughout the script. }
var
startLevel: Integer;

{==============================================================================]
[ Setup the script from here to line 77! ]
[==============================================================================}

const
SmartWorld = 66; // Which World/Server do you want to use?
SmartMembers = True; // Is it a Members World?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False; // Use Super Detail?

const
RANDOM_SOUND = False; // True = a sound when a random is found.
BREAK_TIME = 6; // How long to break for (in minutes).
// Script will +/- a random 5 minutes.

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := ''; // 3-4 LOWERCASE letters from your username.
Active := True; // True = use this player.
Integers[TAlchs] := 7000; // Total times to alch.
Booleans[TAKE_BREAKS] := True; // True = the script will take breaks.
Strings[LAMP_SKILL] := 'Magic';
BoxRewards := ['amp', 'mote', 'ostume', 'oins', 'unes', 're', 'ems'];
Integers[LEVELS] := 0; //Do not edit this.


end;
end;

{==============================================================================]
[ Don't edit below this ]
[==============================================================================}
procedure Create_Antiban;
begin
case RandomRange(0,4) of

0: begin
WriteLn('Using the BoredHuman anti-ban');
BoredHuman;
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

1: begin
Writeln('Using the Hover Skill anti-ban');
HoverSkill('random', False);
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

2: begin
Writeln('Using the random Right Click anti-ban');
RandomRClick;
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

3: begin
Writeln('Using the examine inventory anti-ban');
ExamineInv;
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

4: begin
Writeln('Using the Pick Up Mouse anti-ban');
PickUpMouse;
with Players[CurrentPlayer] do
Integers[ANTIBAN] := Integers[ANTIBAN] + 1;
end;

end;
end;

procedure Next_Break;
begin
if (not LoggedIn) then
ExitToLobby;

begin
Writeln('Taking a ' + IntToStr(BREAK_TIME) + ' minute break.');
Logout;
Wait((BREAK_TIME * 60000) + RandomRange(-300000, 300000));
Writeln('Break over, logging back in.');
LoginPlayer;
end;

with Players[CurrentPlayer] do
Integers[BREAKS] := Integers[BREAKS] + 1;
end;

procedure Find_Randoms;
var
soundStr: String;
begin
if (not LoggedIn) then
Exit;

LampSkill := Lowercase(Players[CurrentPlayer].Strings[LAMP_SKILL]);
Writeln('Scanning for random events...');
with Players[CurrentPlayer] do
Integers[RANDOMSEARCH] := Integers[RANDOMSEARCH] + 1;
if (FindNormalRandoms) then
begin
Writeln('Found Random! ' + soundStr);
with Players[CurrentPlayer] do
Integers[RANDOMEVENT] := Integers[RANDOMEVENT] + 1;
end;

UseRewardBox;
FindLamp(LampSkill);
end;

procedure Setup_Report_Loop;
begin
ClearDebug;
Writeln('[=================================================================]');
Writeln('[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch Progress ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]');
Writeln('[=================================================================]');

with Players[CurrentPlayer] do
begin
Writeln(PadR('[ Running Time: ' + TimeRunning, 66) + ']');
Writeln(PadR('[ Items Alched: ' + IntToStr(Integers[Alchs]), 66) + ']');
Writeln(PadR('[ Levels Gained: ' + IntToStr(Integers[LEVELS]), 66) + ']');
Writeln(PadR('[ Anti-Bans Performed: ' + IntToStr(Integers[ANTIBAN]), 66) + ']');
Writeln(PadR('[ Random Searches Performed: ' + IntToStr(Integers[RANDOMSEARCH]), 66) + ']');
Writeln(PadR('[ Random Events Found: ' + IntToStr(Integers[RANDOMEVENT]), 66) + ']');
Writeln(PadR('[ Breaks: ' + IntToStr(Integers[BREAKS]), 66) + ']');
end;
Writeln('[=================================================================]');
end;

procedure Setup_Report;
begin
ClearDebug;
Writeln('[=================================================================]');
Writeln('[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Auto Alch ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~]');
WriteLn('[~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~Final Report~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ]');
Writeln('[=================================================================]');

with Players[CurrentPlayer] do
begin
Writeln(PadR('[ Ran For: ' + TimeRunning, 66) + ']');
Writeln(PadR('[ Items Alched: ' + IntToStr(Integers[Alchs]), 66) + ']');
Writeln(PadR('[ Levels Gained: ' + IntToStr(Integers[LEVELS]), 66) + ']');
Writeln(PadR('[ Anti-Bans Performed: ' + IntToStr(Integers[ANTIBAN]), 66) + ']');
Writeln(PadR('[ Random Searches Performed: ' + IntToStr(Integers[RANDOMSEARCH]), 66) + ']');
Writeln(PadR('[ Random Events Found: ' + IntToStr(Integers[RANDOMEVENT]), 66) + ']');
Writeln(PadR('[ Breaks: ' + IntToStr(Integers[BREAKS]), 66) + ']');
end;
Writeln('[=================================================================]');
end;

procedure Setup_Player;
begin
LogInPlayer;
SetAngle(True);
startLevel := GetSkillLevel('magic');
Writeln('Current Magic Level: ' + IntToStr(startLevel) + '.');
end;

procedure Setup_Script;
begin
Writeln('Loading, please wait...');
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
DeclarePlayers;
Disguise('Items alched: 0');
end;

procedure Alch_items;
var
a,b,r: Integer;
begin
if (not LoggedIn) then
Exit;
begin
a:=0;
r:=0;
b:=RandomRange(40, 50);

repeat
if(GameTab(tab_Magic)) then
begin
Mouse(643+RandomRange(-5,5), 230+RandomRange(-5,5), 3, 3, True);
Wait(RandomRange(120, 200));
Mouse(660+RandomRange(-5,5), 228+RandomRange(-5,5), 3, 3, True);
Wait(RandomRange(1050, 1200));
a:=a+1;
r:=0;

with Players[CurrentPlayer] do
begin
Integers[Alchs] := Integers[Alchs] + 1;
Disguise('Items Alched: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs]));
Setup_Report_Loop;
Levelup;
if (Levelup) then
begin
with Players[CurrentPlayer] do
begin
Integers[Levels] := Integers[Levels] + 1;
end;
end;

if(Integers[Alchs]=Integers[TAlchs]) then
begin
Writeln('Alched desired number of items, exiting.');
Setup_Report;
Logout;
TerminateScript;
end;
end;
end else
begin
Find_Randoms;
{ Writeln('Can''t find magic tab, possibly in a random!');
Find_Randoms;
r:=r+1;
if (r=5) then
begin
Writeln('Can''t find magic tab or solve random after 5 tries, exiting.');
Setup_Report;
Logout;
TerminateScript;
end; }
end;
until(a>b);

Wait(RandomRange(100, 1000));
Find_Randoms;
Create_Antiban;
end;
end;

procedure Setup_MainLoop;
var
sinceLogin: Integer;
begin
Setup_Script;
sinceLogin := 0;
MarkTime(sinceLogin);
Setup_Player;
repeat
Alch_items;

if (Players[CurrentPlayer].Booleans[TAKE_BREAKS]) then
if (TimeFromMark(sinceLogin) >= (60*60000+RandomRange(-300000, 300000))) then
begin
Setup_Report;
Next_Break;
MarkTime(sinceLogin);
end;

until(AllPlayersInactive);
end;

begin
Setup_MainLoop;
end.


The part I'm having problems with is here

 end else
begin
Find_Randoms; //added as a temp fix
{ Writeln('Can''t find magic tab, possibly in a random!');
Find_Randoms;
r:=r+1;
if (r=5) then
begin
Writeln('Can''t find magic tab or solve random after 5 tries, exiting.');
Setup_Report;
Logout;
TerminateScript;
end; }
end;

it seems to randomly just log me out sometimes (perhaps add a move n click onto the magic tab to verify its not there?)