Press Play
2012-01-15 20:19:59
A function for text.simba
I believe that when you right-click and get the Options Menu, the colours at the top of the menu (ie. 'Choose Option') are static (don't change). This part also has no transparency either. I think this would be a good function to have in SRL!
The code above shows the different methods I used and my thought process:
EDIT: I think the reason I made this was because I don't like the way the Withdraw function re-right-clicks on an item in the bank when it wants to "Withdraw-X". It's very un-human like and yeahh :p So, I was thinking this too:
(*
OptionsMenuOpen
~~~~~~~~~~~
.. code-block:: pascal
function OptionsMenuOpen: Boolean;
Returns true if the option menu is open.
.. note::
by -daazndagger-
Example:
.. code-block:: pascal
if (OptionsMenuOpen) then
ChooseOption('');
*)
function OptionsMenuOpen: Boolean;
var
cho, fx, fy: Integer;
begin
{Writeln(IntToStr(CountColor(9812166, MCX1, MCY1, MCX2, MCY2)));
Result := CountColor(9812166, MCX1, MCY1, MCX2, MCY2) >= 309; }
{cho := BitmapFromString(22, 20, 'meJyLysyJogwp6hpSiKQ0NClFqp' +
'QiUQUVCpGIrAKFSFBKduqOY3AE5EIQGhcPgqjkFZMEIlxs/Aiikkt' +
'QBA3hEideJakmsPPwoyHkwEFTgCYOYTBzcqAhZHH8bAhiYmNHQ8ji' +
'+NnUcgMjOxsQkcdGM4qgGzDVQ0yjBGGGAKmI8vLBySOUQgQADJYpkw=='); }
cho := BitmapFromString(22, 6, 'meJybuuPY1B3HGNnZgGgqWWxmTg4' +
'IA86FIGQuVim4IMQ0ShDcZLKRlIYmhcjJI5RCBAA48FJl');
Result := FindBitmap(cho, fx, fy);
FreeBitmap(cho);
end; I believe that when you right-click and get the Options Menu, the colours at the top of the menu (ie. 'Choose Option') are static (don't change). This part also has no transparency either. I think this would be a good function to have in SRL!
The code above shows the different methods I used and my thought process:
- Firstly, I noted that the text 'Choose Option' is all the one colour, so I decided to use CountColor.
- Obviously, this would be unreliable if there there is the same colour on screen elsewhere!
- So I changed it to a bitmap.. Then reduced the size of the bitmap :)
- I would have done a text-check instead but I wasn't sure how to go about it :( I tried using multiple things but I believe that all the other functions take into account shadow? This text has no shadow.
EDIT: I think the reason I made this was because I don't like the way the Withdraw function re-right-clicks on an item in the bank when it wants to "Withdraw-X". It's very un-human like and yeahh :p So, I was thinking this too:
function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_move);
if (Length(Uptexts) > 0) then
if (not WaitUptextMulti(Uptexts, 500)) then
Exit;
if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;
if (Amount = -1) then
Result := WaitOptionMulti(['Withdraw-All but', 'l b'], 300)
else if (Amount = 0) then
Result := WaitOptionMulti(['Withdraw-All', 'w-A'], 300)
else
Result := WaitOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)] , 300);
if (not (Result)) and (Amount > 0) then
begin
if not OptionsMenuOpen then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);
if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;