SRL Archive - Help and Support

Mouseitem


Rambozin

2009-08-26 15:34:42

MouseItem doesn't seem to work for me anymore .. It doesn't click on any inventoryspot at all and it just huggs the side of my screen.

Anyone knows how I can fix this?

Thanks in advance.

Naum

2009-08-26 16:27:44

From: Rambozin
MouseItem doesn't seem to work for me anymore .. It doesn't click on any inventoryspot at all and it just huggs the side of my screen.

Anyone knows how I can fix this?

Thanks in advance.


Hmm works for me, update to Dev Revision, maybe?

Rambozin

2009-08-26 16:58:14

I did, but that didn't help :(

My inventory is filled with logs, if that helps :/

ZephyrsFury

2009-08-26 16:59:47

You dragged the crosshairs, etc?

Rambozin

2009-08-27 12:14:31

Yes. :(

Naum

2009-08-27 19:29:17

From: Rambozin
Yes. :(


Could you please post the code then?

Rambozin

2009-08-27 19:31:30

program MyFireMaker;
{.include srl/srl.scar}

procedure LightWTinderbox;
begin;
Wait(1250+Random(350));
MouseItem(14, True);
Wait(850+Random(250));
end;

procedure Light1;
begin
MouseItem(10, True);
LightWTinderbox;
MouseItem(6, True);
LightWTinderbox;
MouseItem(2, True);
LightWTinderbox;
MouseItem(1, True);
LightWTinderbox;
MouseItem(5, True);
LightWTinderbox;
MouseItem(9, True);
LightWTinderbox;
MouseItem(13, True);
LightWTinderbox;
MouseItem(17, True);
LightWTinderbox;
MouseItem(21, True);
LightWTinderbox;
MouseItem(25, True);
LightWTinderbox;
MouseItem(26, True);
LightWTinderbox;
MouseItem(22, True);
LightWTinderbox;
MouseItem(18, True);
LightWTinderbox;
MouseItem(27, True);
LightWTinderbox;
MouseItem(23, True);
LightWTinderbox;
MouseItem(19, True);
LightWTinderbox;
MouseItem(15, True);
LightWTinderbox;
MouseItem(11, True);
LightWTinderbox;
MouseItem(7, True);
LightWTinderbox;
MouseItem(3, True);
LightWTinderbox;
MouseItem(4, True);
LightWTinderbox;
MouseItem(8, True);
LightWTinderbox;
MouseItem(12, True);
LightWTinderbox;
MouseItem(16, True);
LightWTinderbox;
MouseItem(20, True);
LightWTinderbox;
MouseItem(24, True);
LightWTinderbox;
MouseItem(28, True);
LightWTinderbox;
end;

begin
SetupSRL;
ActivateClient;
Light1;
end.

I only just started writing it, and i wanted to test the script to see if my timings were right, and they i discovered the error

Rich

2009-08-27 21:22:35

Not part of the problem, but makes it look much neater:

procedure Light1;
var
I : Integer;
B : TBooleanArray;

label
L;

begin
SetLength(B, 28);
repeat
L:
I:= Random(27) + 1;
if B[I] then goto L;
MouseItem(I, True);
LightWTinderbox;
B[I]:= True;
until(B[1..28] = True);
end;

Richard.

Rambozin

2009-08-27 21:30:41

Thanks, i've been searching the forums for some time for this! :)

But still, my problem isn't solved :[

Rich

2009-08-27 21:39:06

Try InvMouse?
{*******************************************************************************
procedure InvMouse(InvSlot, Action: Byte);
By: EvilChicken!
Description: A combined MouseItem & MMouseItem, will hopefully replace both
procedures one day. Usage is like SRL's MouseBox, Action determines what to do:
1: Leftclick
2: Rightclick
3: Move mouse to item
*******************************************************************************}

procedure InvMouse(InvSlot, Action: Byte);
var
TB: TBox;
begin
if (not InRange(Action, 1, 3)) then
begin
srl_Warn('InvMouse', 'Action #' + IntToStr(Action) + ' is not a valid action', warn_AllVersions);
Exit;
end;
if (not InRange(InvSlot, 1, 28)) then
begin
srl_Warn('InvMouse', 'Inventory slot #' + IntToStr(InvSlot) + ' is not a valid slot', warn_AllVersions);
Exit;
end;

GameTab(tab_inv);
TB := InvBox(InvSlot);
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, Action);
end;

Rambozin

2009-08-27 21:43:16

R1ch, thank you so much, again! :O That totally worked!

Rep++ :)

Rich

2009-08-27 21:47:38

No problem. Just trying to help :)

Richard.

Rambozin

2009-08-29 17:21:44

On a side note: I seem to keep getting an error @ "until(B[1..28] = True);" and I can't solve it :( Any help?

Thanks in advance.
Closing square bracket (']') expected in script

ZephyrsFury

2009-08-29 19:08:50

until(B[1..28] = True) isn't the proper syntax. To check if all booleans are true you'd need to do something else (such as create a function that returns true if all booleans are true then call that function in the until clause of your loop).

Rambozin

2009-08-29 19:09:57

Ooo I see, thank you.

noidea

2009-08-29 22:11:59

like

function IsAllTrue(Boo: TBooleanArray): boolean;
var
i: Integer;
begin
for i := 0 to high(Boo) do
begin
result := Boo[i];
if not result then
exit;
end;
end;

Rambozin

2009-08-29 22:16:56

Thanks for that! ;O I was stuck on the " for i := 0 to high(Boo) do " part :p