SRL Archive - OSR Help

Script will not run anymore?


Hazzah

2012-06-09 19:38:09

I am having a rough time getting this script to work. When I run it I get an access violation, however, I can run other scripts just fine, its just this one that I have been working on for a while now doesn't seem to want to run anymore.

program MiscellaniaExchanger;
{$DEFINE SRL5}
{$DEFINE SMART}
{$i SRL/srl.simba}
{$i SRL/SRL/misc/reports.simba}
{$DEFINE PAINTSMART}
Const

//SRL Stats
SRLStats_Username = '';
SRLStats_Password = '';

//General settings
DebugMode = False; //On-screen debugging?

Var
//Static
Teleport: String;
SummoningPotionDTM,WarTortPouch,ROWDTM,GLORYDTM,TABLEDTM,x,y:Integer;
UsingFamiliar:Boolean;


Procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Change this to add more players
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
with Players[0] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; // Bank pin
Teleport := '0' //Choose 0 (Edgeville), 1 (CastleWars), 2 (Fight Caves)
Member := True;
Active := True;
end;

{ // Remove comment and adjust numbers to add more players.
with Players[1] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; // Bank pin
Member := True;
Active := True;
end;
}
end;

Procedure SetDTM; //Sets all the DTMS needed to run the script.
Begin

SummoningPotionDTM := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');
ROWDTM:= DTMFromString('mrAAAAHic42BgYPjHxMDAzAzBf4DsL0D8CYi/A/EvIJ7HyMAwE4gXAfEqIF4OxAuAeDYQzwDi23vlgKYw4cT8DPgBIwEMAwClEwzS');
TABLEDTM:= DTMFromString('mrAAAAHic42BgYLjAxMBwH4gvA/FxID4MxOeA+CZUfBEjA8NqIF4DxXOAeAYUzwLiesE6oClMODEPA37ASADDAADlrQzu');
WarTortPouch := DTMFromString('mbQAAAHicY2VgYDAFYisg1gNiGyC2BuL3QPwEiD8A8RcgfgfEna4iDFfO7GDQ15BnaHcRAWN+oDg6ZsSCwQAAEz8LfQ==');
End;

{-------------------------------------------------------------------------------
By: Flight/Benland100
Permission: False (PM sent)
Description: Human like mouse movements!
-------------------------------------------------------------------------------}
procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist: extended;
lastX,lastY,MSP,W: integer;
sqrt2,sqrt3,sqrt5: extended;
begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;

case Random(50) of
1..25: W := (MSP + (Random((MSP/4))));
26..50: W := (MSP - (RandomRange((MSP/2), MSP-1)));
end;
if (W < 1) then
W := 1;

if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));

end;

if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));

MouseSpeed := MSP;
end;

Procedure HumanRandomMouse;
var
randSpeed: extended;
x, y, firstSpeed: integer;
begin
case(Random(10)) of
2..8:
begin
firstSpeed := mouseSpeed;

mouseSpeed := RandomRange(5,10);
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
GetMousePos(x, y);
SuperWindMouse(x, y, RandomRange(x - 75, x + 75), RandomRange(y - 75, y + 75),
30, 55, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);

mouseSpeed := firstSpeed;
// Smart_ClearCanvas;
end;
end;
end;

Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,X2,Y2,A,Dist,MP: integer;
begin
A := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
if MP < 0 then
MP := 1;

randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(A*MP), eX+(A*MP));
Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
SuperWindMouse(X, Y, X2, Y2, 9.0, 3.0, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := A;
end;

{-------------------------------------------------------------------------------
Original Function Name: SummonPoints
By: Ashaman/Flight/Brandon
Permission: True
Description: Gets Summoning Level.
-------------------------------------------------------------------------------}
Function SummoningPoints: Integer;
Var
ColourString: String;
Begin
Result:= GetMMLevels('summon', ColourString);
End;

Procedure FillFamiliar;
begin
if SummoningPoints<10 then
begin
if not(BankScreen) then
begin
OpenBankNPC;
end Else
Begin
FindDTM(SummoningPotionDTM,x,y,MSX1,MSY1,MSX2,MSY2);
HumanMMouse(x,y,4,6);
if IsUptext('Summoning') then
begin
Clickmouse2(True);
end Else
CloseBank;
Exit;
CloseBank;
If FindDTM(SummoningPotionDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
HumanMMouse(x,y,5,5);
if IsUptext('Potion') then
begin
clickmouse2(True);
OpenBankNPC;
DepositAll;
end Else
OpenBankNPC;
DepositAll;
TerminateScript;
end;
end;
end;
if SummoningPoints>10 then
begin
If Bankscreen then
begin
FindDtm(WarTortPouch,x,y,MSX1,MSY1,MSX2,MSY2);
HumanMMouse(x,y,5,5);
ClickMouse2(true);
CloseBank;
if FindDtm(WarTortPouch,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
HumanMMouse(x,y,0,0);
Clickmouse2(False);
ChooseOption('Summon');
end;
end;
end;
end;

{procedure FindAdvisorGhrimm
var
begin
end; }

Procedure TradeAdvisorGhrimm;
begin
HumanMMouse(25,330,4,4);
Clickmouse2(True);
Fflag(1);
Ftab(25);
Wait(1500);
// if FindAdvisorGhrimm then
begin
InvMouse(1,1);
HumanMMouse(x,y,0,0);
Clickmouse2(True);
end;
end;

Procedure Banking;
var
x,y:integer;

Begin
Wait(RandomRange(1000,15000));
OpenBankNPC;
Wait(1500);
if PinScreen then
begin
InPin(Players[CurrentPlayer].Pin);
Wait(1500);
end else;
begin
writeln('Invalid Pin, might wanna try putting that into its');
writeln('specified place');
terminatescript;
end;
Wait(1500);
if BankScreen then
begin
Wait(1500);
depositAll;
if findDTM(TABLEDTM,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
HumanMMouse(x,y,6,4);
ClickMouse2(False);
ChooseOption('All');
CloseBank;
if UsingFamiliar=True then
begin
FillFamiliar;
OpenBankNPC;
ChooseOption('All');
CloseBank;
end;
end;
end;
end;
Procedure TeleportMiscellania;
begin
if InvCount=28 then
GameTab(26);
Wait(300);
If FindDTM(ROWDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
HumanMMouse(x,y,5,5);
ClickMouse2(False);
ChooseOption('Miscellania');
Wait(15000);
end;// Else
//Exit;
end;

Procedure TeleporttoBank; //Sets which bank to teleport to

begin
Case Teleport of
'0': Begin // Edgeville Tele will require glory
FTab(tab_Equip);
if FindDTM(GloryDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
HumanMMouse(x,y,4,6);
Clickmouse2(False);
ChooseOption('Edgeville');
Wait(RandomRange(300,500));
end Else
begin
Writeln('Failed to teleport back to edgeville because you are out'+
'of glories, buy more or charge these ones');
TerminateSCript;
end;
end;
'1': Begin //CastleWars tele will require dueling ring

End;
'2': Begin //FightCave tele will require Tokkul-Zo ring (No need to get new ones)

End;
'': begin
Writeln('You fool, fill in where you want to teleport to!');
TerminateScript;
end;
end;
end;
{-------------------------------------------------------------------------------
Original Author: Sir Eska Eau
Permission: False
Edited: Hazzah
-------------------------------------------------------------------------------}
procedure SetupPlayer;
begin
if not (LoggedIn) then
LoginPlayer;
wait(500 + random(400));
end;

procedure FreDTM;
begin
FreeDTM(TABLEDTM);
FReeDTM(ROWDTM);
end;

{-------------------------------------------------------------------------------
By: Kyle Undefined
Edited by: Hazzah
Permission: False
Use: Makes smart load faster!
-------------------------------------------------------------------------------}

Procedure SmartSuperLoader;
Begin
if RsReady then
begin
exit;
end else;
begin
SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail); //Override the one in SetupSRL by calling this first!
SmartSetRefresh(100); //Smart is now loading slowly so speed it up by setting refresh to 100.
MMouse(1, 1, 1, 1); //Move the mouse 2-4 pixels so that Smart STARTS to load.. If you comment out this line, Smart Will load SLOW AS HELL
while (Not RSReady) do //Finally do what the SetupSRL was meant to do.. Wait until we are at the login screen..
SmartSetRefresh(95); HumanMMouse(1, 1, 1, 1); wait(100); SmartSetRefresh(100);
end;
End;

Procedure Setup;
begin
ClearDebug;
Smart_Server := 32;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SmartSuperLoader;
SetupSRL;
end;

Begin
Setup;
DeclarePlayers;
if Not(Loggedin) then
begin
LoginPlayer;
end Else
begin
Wait(1500);
SetDTM;
repeat
Banking; //Make sure you chose the correct method!
TeleportMiscellania;
TradeAdvisorGhrimm;
TeleportToBank;
until
Not(FindDTM(TABLEDTM,x,y,MSX1,MSY1,MSX2,MSY2))
if Not(FindDTM(TABLEDTM,x,y,MSX1,MSY1,MSX2,MSY2)) then
begin
Writeln('Couldnt find anymore Tables to trade in or the script got');
Writeln('lost');
TerminateScript;
end;
end;
AddOnTerminate('FreDTM');
End.

It would run to the point where I got it to open SMART, Log in, bank + tele to Miscellania, but not it does not seem to work at all. Can anyone give me a reason why.

Also, I know my standards are probably horrible and that this script is very disorganized and such, please don't comment on that :redface:, and I know it is not finished yet, but I would like to see that what I have written and combined here actually works.

putonajonny

2012-06-09 19:44:46

I don't know what SmartSuperLoader; does but try getting rid of it…

Hazzah

2012-06-09 19:51:31

If you look directly above the Setup procedure you would see what it does and it is commented as well. However, that seems to have done the trick, although it confuses me that it does not work in this script, yet I use it in almost every other script that I use.

Thanks good sir!