SRL Archive - RS3 Help

First script not working , error I don't understand


lanadekat

2014-08-01 16:03:15

Hi, I'm new here and I just created my own script, But it doesn't work, and it gives an error: "Exception in Script: Invalid type cast" It's probably a really dumb thing but I can't find it. Everything below is just basic copy and pasting from The Mayor's tutorials! (yes I understand what I copy, I'm NOT just copying everything without understanding what it does )The script should be a basic vial filler in the GE. I also have another question: can I just login myself ? Or do it need to automate it?

The things I probably messed up:
Functions
The walking to the bank and to the fontain


program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}


function minimap.waitPlayerMoving(waitFlagGone: boolean): boolean;
function sps.setup(map name: GEmap, SPS/img/runescape_other): Boolean;
function Backpack.simba;
function Text.simba;
function Mouse.simba;
function Mainscreen.simba;


procedure Clickbank();

begin
if bankscreen.open(BANK_NPC_GREY)
writln('bank opened!');
wait(randomRange(1000, 2000));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(1000, 2000));
bankScreen.withdraw(1, WITHDRAW_AMOUNT_ALL, ['ial']);
wait(randomRange(1000, 2000));
bankScreen.close();
if tabBackPack.isFull(); then

end;

procedure walktofontain();
minimap.setAngle(MM_DIRECTION_NORTH);
var Pathtofontain: TpointArray;
begin

pathtofontain := [Point(145, 65), Point(100, 19)]

if SPS.walkpath(paththofontain) then
minimap.waitPlayerMoving()
else writLn('not walking to fontain')
end;

procedure fillvials();
var
x, y: integer;

begin
tabBackPack.mouseSlot(1, MOUSE_RIGHT); //clicks vial in backpack
if mainscreen.findObject(x, y, -12756371, -6, ['ontain'], MOUSE_RIGHT) then //clicks fontain
begin
writeLn('Fountain clicked!')
chooseOption.select(['se Vial->Fontain']);
mainscreen.findObject(x, y, -7820808, -13, ['Fill'], MOUSE_RIGHT) //clicks fill
wait(randomRange(17000, 19000));
end;

procedure walktobanker();
var Pathtobanker: TpointArray;
begin

pathtobanker := [Point(100, 19), Point(145, 65)]

if SPS.walkpath(paththobanker) then
minimap.waitPlayerMoving()
Clickbank()
else writLn('not walking to banker')
end;

Lipcot

2014-08-01 16:23:44

hey, you didnt understand nothing about the tutotial eheh, i would recommend you to read it again in a slower pace and try to understand it better. you didnt even understand how a script works, Variables, procedures and functions and main loop. that thing you made, just erase it and start again that would be my suggestion at least

you dont have to do this:

function minimap.waitPlayerMoving(waitFlagGone: boolean): boolean;
function sps.setup(map name: GEmap, SPS/img/runescape_other): Boolean;
function Backpack.simba;
function Text.simba;
function Mouse.simba;
function Mainscreen.simba;

at the top oof the script, in the tutorial he does that for you to see which functions he uses INSIDE the procedures. to make a script you have to make all the procedures first, and then in the main loop use them in the order you want!

lanadekat

2014-08-01 16:51:50

From: undorak7
hey, you didnt understand nothing about the tutotial eheh, i would recommend you to read it again in a slower pace and try to understand it better. you didnt even understand how a script works, Variables, procedures and functions and main loop. that thing you made, just erase it and start again that would be my suggestion at least

you dont have to do this:

function minimap.waitPlayerMoving(waitFlagGone: boolean): boolean;
function sps.setup(map name: GEmap, SPS/img/runescape_other): Boolean;
function Backpack.simba;
function Text.simba;
function Mouse.simba;
function Mainscreen.simba;

at the top oof the script, in the tutorial he does that for you to see which functions he uses INSIDE the procedures. to make a script you have to make all the procedures first, and then in the main loop use them in the order you want!

Oh thanks , I will read it slower lol.
I thought it was something like libraries that you had to import so it would work cus there is a function list :duh:
Like you have in some coding language's

edit:
I have fixed it all , the only problem now is that SPS minimap doesn't load correclty:
ERROR: No minimap dot color found

the minimap is saved in the rigth place and is an .PNG

Anyway I'm gonna read the full tutorial tommorow ( slowly )
the new code is below.



// I added {$I SPS/lib/SPS-RS3.Simba} and mainloop
program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}


procedure Clickbank();

begin
if bankscreen.open(BANK_NPC_GREY) then
begin
writeLn('bank opened!');
wait(randomRange(1000, 2000));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(1000, 2000));
bankScreen.withdraw(1, WITHDRAW_AMOUNT_ALL, ['ial']);
wait(randomRange(1000, 2000));
bankScreen.close();
if tabBackPack.isFull() then
end;
end;

procedure walktofontain();
var Pathtofontain: TpointArray;
begin
minimap.setAngle(MM_DIRECTION_NORTH);
pathtofontain := [Point(145, 65), Point(100, 19)]
if SPS.walkpath(pathtofontain) then
minimap.waitPlayerMoving()
else writeLn('not walking to fontain');
end;

procedure fillvials();
var
x, y: integer;

begin
tabBackPack.mouseSlot(1, MOUSE_RIGHT); //clicks vial in backpack
if mainscreen.findObject(x, y, -12756371, -6, ['ontain'], MOUSE_RIGHT) then //clicks fontain
begin
writeLn('Fountain clicked!')
if chooseOption.select(['se Vial->Fontain']) then
begin
mainscreen.findObject(x, y, -7820808, -13, ['Fill'], MOUSE_RIGHT) //clicks fill
end;
end;
end;

procedure walktobanker();
var Pathtobanker: TpointArray;
begin

pathtobanker := [Point(100, 19), Point(145, 65)]

if SPS.walkpath(pathtobanker) then
minimap.waitPlayerMoving()
end;

begin //main loop

SPS.setup('GEmap', RUNESCAPE_OTHER); // Setup our map
Clickbank();
walktofontain();
fillvials();
walktobanker();
end

Turpinator

2014-08-01 17:44:44

From: lanadekat
Oh thanks , I will read it slower lol.
I thought it was something like libraries that you had to import so it would work cus there is a function list :duh:
Like you have in some coding language's


{$I SRL-6/SRL.simba}
this is the 'import' except here its include.