From f03a03d31ba46eb0241e50d1183aad27f6aea1c3 Mon Sep 17 00:00:00 2001 From: Michel Pauwels Date: Tue, 21 Oct 2025 11:57:11 +0200 Subject: [PATCH] fix: failing test after CollectButton implementation --- .../grandexchange/grandexchange.simba | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/osrs/interfaces/mainscreen/grandexchange/grandexchange.simba b/osrs/interfaces/mainscreen/grandexchange/grandexchange.simba index 7468669d..047f9aae 100644 --- a/osrs/interfaces/mainscreen/grandexchange/grandexchange.simba +++ b/osrs/interfaces/mainscreen/grandexchange/grandexchange.simba @@ -366,8 +366,10 @@ begin Self.Slots[i]._Setup(tba[i]); with Self.Bounds do + begin Self.HistoryButton := [X1+7, Y1+7, X1+53, Y1+26]; - Self.ConfirmButton := [X1+391, Y1+40, X1+473, Y1+59]; + Self.CollectButton := [X1+391, Y1+40, X1+473, Y1+59]; + end; end; (* @@ -518,6 +520,27 @@ begin Result := Self.Slots[slot]; end; +(* +## TRSGrandExchange.Collect +```pascal +function TRSGrandExchange.Collect(): Boolean; +``` +Attempts to Collect from the Grand Exchange. + +In case of failure, returns False. + +Example: +```pascal +WriteLn GrandExchange.Collect(); +``` +*) +function TRSGrandExchange.Collect(): Boolean; +begin + if OCR.Locate(Self.CollectButton, 'Collect', [RSFonts.WHITE], 0, RSFonts.PLAIN_11) < 0.85 then + Exit(False); + Mouse.Click(Self.CollectButton, EMouseButton.LEFT); + Result := SleepUntil(OCR.Locate(Self.CollectButton, 'Collect', [RSFonts.WHITE], 0, RSFonts.PLAIN_11) = 0,200, 2000); +end; var (*