SRL Archive - OSR Help

Script Help


lilcmp1

2011-12-24 00:22:10

I'm trying to get it to simply fish and drop. The procedure fishy when executed by itself successfully gets it to fish. When I try to add in everything else it quits clicking the fishing spot and hovers over the backpack inventory tab. I've also tried running it with a full inventory and it doesn't drop anything. Any ideas?


program New;
{$i SRL\SRL.scar}

Var
OldXP, TimeSinceFish: Integer;

Procedure Fishy;
var
SeX, SeY: Integer;

Begin
If FindObjCustom(SeX, SeY, ['Cage', 'Fishing'], [7956571, 9998731, 10458507], 5) Then
WriteLn('Found Spot!');
Begin
Case Random(2) Of
0: Mouse(SeX,SeY, 5,5, True);
1: Begin
Mouse(SeX,SeY,4,4,False);
WaitOption('Cage',Randomrange(100,300));
End;
End;
End;
End;

Procedure DropFish;
var x, y: integer;
begin
if FindObjCustom(x, y, ['Raw'], [2046824, 792619], 25) then
DropAll;
end;


Begin
SetupSRL;
Repeat

If IsXPBarOpen Then
Begin
If Not( GetXPBarTotal = OldXP) Then
Begin
OldXP := GetXPBarTotal;
MarkTime( TimeSinceFish);
End;
End;

If TimeFromMark( TimeSinceFish) > 8600 Then
Begin
If InvFull Then
DropFish
else
Begin
Fishy;
wait(1000);
End;
end;
Until False;
End.

YoHoJo

2011-12-24 00:27:25

FindObj functions are only for the mainscreen, not the inventory.
Is once piece of advice.

Also it will only drop if your 'timesincefish' is over 8600 AND inventory is full, that seems a bit odd?
Based on these lines

    If TimeFromMark( TimeSinceFish) > 8600 Then
Begin
If InvFull Then

Yanhua

2011-12-24 00:31:41

If you want to use FindObj in Inventory, if my memory is correct you can use FindObjEx and define the parameters yourself.

Such as MIX1, MIY1, MIX2, MIY2 if you are looking for something in the inventory.

YoHoJo

2011-12-24 00:33:54

I'd use DTMs to find stuff fin inventory.

lilcmp1

2011-12-24 00:42:08

From the looks of it doesn't dropall, drop everything regardless of the object? If that was the case I wouldn't need to find the object. I tried rearranging things to no avail;

Procedure Fishy;
var
SeX, SeY: Integer;

Begin
If FindObjCustom(SeX, SeY, ['Cage', 'Fishing'], [7956571, 9998731, 10458507], 5) Then
WriteLn('Found Spot!');
Begin
Case Random(2) Of
0: Mouse(SeX,SeY, 5,5, True);
1: Begin
Mouse(SeX,SeY,4,4,False);
WaitOption('Cage',Randomrange(100,300));
End;
End;
End;
End;


Begin
SetupSRL;

If InvFull Then
DropAll
Else

Repeat

If IsXPBarOpen Then
Begin
If Not( GetXPBarTotal = OldXP) Then
Begin
OldXP := GetXPBarTotal;
MarkTime( TimeSinceFish);
End;
End;

If TimeFromMark( TimeSinceFish) > 8600 Then
Begin
Fishy;
wait(1000);
End;

Until False;

End.

YoHoJo

2011-12-24 00:46:58

I'd get rid of the entire main loop, and think about it logically, and piece it together again.
That main loop is confusing :p

YoHoJo

2011-12-24 00:47:00

I'd get rid of the entire main loop, and think about it logically, and piece it together again.
That main loop is confusing :p