Code:
{==============================================================================|
| Instructions |
|==============================================================================|
| |
| 1. Equip fire staff and make sure you have enough nature runes |
| 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. Post any progress reports and/or bugs! |
| |
| Created by marksteele. Code is based on pyroryan's Auto Alch, you can |
| view this at http://villavu.com/forum/showthread.php?t=54888 |
| |
|==============================================================================}
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;
// Booleans.
TAKE_BREAKS = 0;
// Strings.
LAMP_SKILL = 0;
var
startLevel: Integer;
EXP: Integer;
{==============================================================================|
| Setup the script from here to line 77! |
|==============================================================================}
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.
//SMART setup
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?
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] := 4800; // 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'];
end;
end;
{==============================================================================|
| Don't edit below this |
|==============================================================================}
procedure Antiban;
begin
case RandomRange(0,4) of
0:
begin
WriteLn('Using the "Bored Human" anti-ban');
BoredHuman;
end;
1:
begin
Writeln('Using the "Hover Skill" anti-ban');
HoverSkill('random', False);
end;
2:
begin
Writeln('Using the "random Right Click" anti-ban');
RandomRClick;
end;
3:
begin
Writeln('Using the "examine inventory" anti-ban');
ExamineInv;
end;
4:
begin
Writeln('Using the "Pick Up Mouse" anti-ban');
PickUpMouse;
end;
end;
end;
procedure 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;
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
Writeln('Found Random! ' + soundStr);
end;
UseRewardBox;
FindLamp(LampSkill);
end;
procedure Setup_Report_Loop;
begin
ClearDebug;
Writeln('|=================================================================|');
Writeln('|~ ~ ~ ~ ~ ~ ~ ~ Just Another Alcher Progress ~ ~ ~ ~ ~ ~ ~ ~ ~ ~|');
Writeln('|=================================================================|');
with Players[CurrentPlayer] do
begin
//EXP := EXP - 32;
Writeln(PadR('| Running Time: ' + TimeRunning, 66) + '|');
Writeln(PadR('| Items Alched: ' + IntToStr(Integers[Alchs]), 66) + '|');
Writeln(PadR('| Levels Gained: ' + IntToStr(Integers[LEVELS]), 66) + '|');
//WriteLn('PadR(| Exp to next level: ' + IntToStr(Integers[EXP]), 66 + '|');
end;
Writeln('|=================================================================|');
end;
procedure Setup_Report;
begin
ClearDebug;
Writeln('|=================================================================|');
Writeln('|~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~Just Another Alcher ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~|');
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) + ']'); end;
Writeln('|=================================================================|');
end;
procedure Setup_Player;
begin
Players[CurrentPlayer].Integers[LEVELS] := 0;
LogInPlayer;
SetAngle(True);
startLevel := GetSkillLevel('magic');
Writeln('Current Magic Level: ' + IntToStr(startLevel) + '.');
EXP := XPTillNextLevel('magic');
Writeln('XP Untill Next Magic Level: ' + IntToStr(EXP) + '.');
end;
procedure Setup_Script;
begin
Writeln('Loading, please wait...');
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
DeclarePlayers;
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 (not GetCurrentTab = 28) then
begin
Gametab(tab_Magic);
end;
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;
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;
EXP := XPTillNextLevel('magic');
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;
Gametab(tab_Magic);
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;
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;
Break;
MarkTime(sinceLogin);
end;
until(AllPlayersInactive);
end;
begin
Setup_MainLoop;
end.