SRL Archive - OSR Help

Why won't this run?..


Keasbey

2013-02-16 18:36:59

So I've put a couple of hours of reading tutorials and messing around with Simba and come up with the first few building blocks for a fletching script I want to make. It compiles fine, but when I click run, SMART loads , and the script goes through once without logging the player in (all of my writeln statements are printed ) , and then terminates on its own :(

If anyone could help me I'd really appreciate it.. I was expecting errors but not like this lol ( especially since it compiled. ).
Anyway.. here's the code.. Sorry it's not to standards, it is in my Simba window but when I copy/paste it my computer decides to get rid of formatting :/

Program Stringing;
{$DEFINE SMART}
{$i srl/srl.simba}

//Login at draynor bank

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Pin :='';
Players[0].Nick :='';
//Players[0].WorldInfo:=[44]; //If You Want A Home World
Players[0].Active:=True; //Don't Touch
WORLDSWITCHERENABLED:=False; //Don't Touch
end;

Function ClearInv: Boolean;
Begin
Result := findbank('db')
if not Result then
WriteLn('Please Login Already In The Draynor Village Bank');
if Result then
begin
Wait(RandomRange(100,350));
DepositAll;
Wait(RandomRange(50,200));
Withdraw(9, 0, 14);
Wait(RandomRange(1,75));
Withdraw(9, 1, 14);
Wait(RandomRange(1,100));
WriteLn(' Successfully Withdrew Supplies ');
end;
end;

Function FindStringAndBows: Boolean;
begin
Result := ItemActivated(1);
If not result then
begin
MMouse(871, 359, 4, 4);
Wait(RandomRange(1,75));
ClickMouse2(true);
Wait(RandomRange(1, 75));
MMouse(958, 464, 4, 4);
Wait(RandomRange(1, 75));
ClickMouse2(true);
WriteLn('Successfully Used Supplies')
end;
end;

begin;
ActivateClient;
SetUpSRL;
DeclarePlayers;
ClearInv;
FindStringAndBows
end.

The Mayor

2013-02-16 18:40:33

So it is not logging in?

PS: might want to remove your details from script

Sawyer

2013-02-16 18:47:48

This procedure should log your player in.
procedure SetupSmartClient;
begin
SRL_SixHourFix := True;
SMART_FixSpeed := True;

ClearDebug;
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
FindNormalRandoms;
end;

EDIT: The script didn't log you in because you didn't tell it to.

Keasbey

2013-02-16 18:55:01

From: Sawyer
This procedure should log your player in.
procedure SetupSmartClient;
begin
SRL_SixHourFix := True;
SMART_FixSpeed := True;

ClearDebug;
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
FindNormalRandoms;
end;

EDIT: The script didn't log you in because you didn't tell it to.


So that should be the beginning of my mainloop which will login the players?
And all of my functions/procedures should follow "findnormalrandoms" correct?

@TheMayor , lol, thanks.

The Mayor

2013-02-16 19:01:24

You could just login like this



begin;
ActivateClient;
SetUpSRL;
DeclarePlayers;
if not LoggedIn then
LoginPlayer;
ClearInv;
FindStringAndBows
end.

Sawyer

2013-02-16 19:16:17

It is a procedure, Copy and paste it into your script and replace your ActivateClient, declareplayer, and SetupSRL with SetupSmartClient in your mainloop and it should go. :)

Wardancer

2013-02-16 19:25:40

Just as a precision since it seems to be confusing, DeclarePlayers is only a procedure that loads up your character information. By itself, it doesn't do anything as far as I do. I'd compare it to a LoadDTMs procedure. It's other procedures and functions that call for the information found in DeclarePlayers (i.e LoginPlayer).

Thought you'd like to understand what went wrong.

Finally, for future references, you might want to paste your codes using the Simba tags (
. It helps a ton with readability.

Hoping that this is only a start for your scripting amusement.

Keasbey

2013-02-16 21:47:25

Thanks everyone so much for the help so far.. it logs in now (yay!).
However I still have the same problem where my script doesn't actually do anything, it runs through the code ( printing all of my writeln statements ) and then terminates.

How it looks now:
Program Stringing;
{$DEFINE SMART}
{$i srl/srl.simba}

//Login at draynor bank

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='uubee2@gmail.com';
Players[0].Pass :='hansel5';
Players[0].Pin :='';
Players[0].Nick :='';
//Players[0].WorldInfo:=[44]; //If You Want A Home World
Players[0].Active:=True; //Don't Touch
WORLDSWITCHERENABLED:=False; //Don't Touch
end;

procedure SetupSmartClient;
begin
SRL_SixHourFix := True;
SMART_FixSpeed := True;

ClearDebug;
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
FindNormalRandoms;
end;

Function ClearInv: Boolean;
Begin
Result := findbank('db')
if not Result then
WriteLn('Please Login Already In The Draynor Village Bank');
if Result then
begin
Wait(RandomRange(100,350));
DepositAll;
Wait(RandomRange(50,200));
Withdraw(9, 0, 14);
Wait(RandomRange(1,75));
Withdraw(9, 1, 14);
Wait(RandomRange(1,100));
WriteLn(' Successfully Withdrew Supplies ');
end;
end;

Function FindStringAndBows: Boolean;
begin
Result := ItemActivated(1);
If not result then
begin
MMouse(871, 359, 4, 4);
Wait(RandomRange(1,75));
ClickMouse2(true);
Wait(RandomRange(1, 75));
MMouse(958, 464, 4, 4);
Wait(RandomRange(1, 75));
ClickMouse2(true);
WriteLn('Successfully Used Supplies')
end;
end;

begin;
SetupSmartClient;
ClearInv;
if not LoggedIn then
LoginPlayer;
FindStringAndBows
end.

Wardancer

2013-02-16 21:59:04

The way that you use results seem problematic to me. I believe what you mean to do is:


procedure FindStringAndBows;
begin
If not ItemActivated(1) then
begin
MMouse(871, 359, 4, 4);
Wait(RandomRange(1,75));
ClickMouse2(true);
Wait(RandomRange(1, 75));
end;
MMouse(958, 464, 4, 4);
Wait(RandomRange(1, 75));
ClickMouse2(true);
WriteLn('Successfully Used Supplies')
end;

EDIT: You might also want to try without the if..then statement with ItemActivated(1). I don't know how effective/accurate this function is and it might be interfering with your script.