SRL Archive - SRL Suggestions

New ChooseOption...


Gu3st...

2010-11-27 09:30:54

http://villavu.com/forum/showthread.php?t=65818

With the new update, runescape stuffs related options together to consume less space if the option box would originally go outside of the screen, so chooseoption wouldn't work in this example…

I haven't though about a way to fic this yet.. I'm just reporting the problem

Wizzup?

2010-11-27 09:54:16

Is there a way to turn this off? I find it annoying personally.
If not, we'll have to rewrite all the scripts. ;)

Harry

2010-11-27 11:02:13

What happens when that shortened list goes outside of the screen area? You can only shorten a list so much.

Also, I don't think it can be disabled, and it looks like crap, and makes PKing even harder (I think).

Gu3st...

2010-11-27 11:07:11

If we get together and rant at jagex on their forum for making pking harder, then they might add an option for disabling it…

blulightning

2010-11-27 11:11:43

From: Zyt3x
If we get together and rant at jagex on their forum for making pking harder, then they might add an option for disabling it…


Haha good plan. If that worked… oh, the irony would just kill me

Cstrike

2010-11-27 11:41:53

I hate it as it slows me down. Sometimes when you click it's all in one list, then another time it happens to be that new list, which confuses me. In addition, you have to not only process it, but then hover over it, open the new menu and select your option. In addition, it slows down humans more than bots, because bots will be able to get to the new menu anyways when fully updated.

mormonman

2010-11-27 12:50:12

ChooseOption(Category, Option: String): Boolean;
First it checks for the option, then it checks for the category, opens it and checks for the option in there.

Wizzup?

2010-11-27 12:56:35

From: mormonman
ChooseOption(Category, Option: String): Boolean;
First it checks for the option, then it checks for the category, opens it and checks for the option in there.


Yep. But we will have to go through SRL in it's entirety as well as all scripts.
Also; to all devs. Don't start committing this to srl-opendev just yet.

Gu3st...

2010-11-27 13:08:26

ChooseOption/ChooseOptionEx/ChooseOptionMulti/ChooseOptionMultiEx exists in:
 +  SRL\SRL\skill\woodcutting.scar
+ SRL\SRL\skill\fishing.scar
+ SRL\SRL\skill\smithing.scar
+ SRL\SRL\skill\prayer.scar
+ SRL\SRL\skill\runecrafting.scar
+ SRL\SRL\skill\mining.scar
+ SRL\SRL\misc\smartcolors.scar
+ SRL\SRL\core\text.scar
+ SRL\SRL\core\antiban.scar
+ SRL\SRL\core\timing.scar

WaitOption/WaitOptionMulti exists in:
 +  SRL\SRL\skill\fishing.scar
+ SRL\SRL\skill\magic.scar
+ SRL\SRL\misc\buysell.scar
+ SRL\SRL\core\bank.scar
+ SRL\SRL\core\mapwalk.scar
+ SRL\SRL\core\chat.scar
+ SRL\SRL\core\inventory.scar
+ SRL\SRL\core\antiban.scar
+ SRL\SRL\core\gametab.scar
+ SRL\SRL\core\timing.scar

Shuttleu

2010-11-27 13:12:43

use the ChooseOption with 2 arguments
do a check to see if it is condensed, if it is not the do a search for the option with both of the strings, if it is then search for the one with the first then search for the second in the new menu

do something like a bitmap to see if there are any arrows on the menu, if it is then its condensed, if there isnt then its not :)

To be honest, i dont think this is going to be hard to fix

~shut

EDIT: i will whip something up

Harry

2010-11-27 16:23:20

Should be ChooseOptionMenu for the new procedure; keep the old method the same as a fallback.

any_one

2010-11-27 16:46:47

Making ChooseOption(object name, action text) and doing what Shuttleu said should work, right? I also find the condensing menu annoying.

Wizzup?

2010-11-27 16:47:40

From: Harry
Should be ChooseOptionMenu for the new procedure; keep the old method the same as a fallback.


I would go with "ChooseOption" as that will make sure there are no other ChooseOption leftovers.

Harry

2010-11-27 16:56:05

From: Wizzup?
I would go with "ChooseOption" as that will make sure there are no other ChooseOption leftovers.

Not all menus have the external ">" on it. But now that I think about it though, you're right. Best to have compile errors instead of mismatched procedures. A compile error is fixed within 30 seconds, using an incorrect procedure rocks your head for hours.

Shuttleu

2010-11-28 06:29:14

can someone give this a try?
{$i srl/srl.scar}

function ChooseOptionText(x1, y1, x2, y2: Integer; var rx1, ry1, rx2, ry2, rx3, ry3: Integer; Text:TStringArray; TextType: string): Boolean;
var
cx1, cy1, cx2, cy2, px, py, i: Integer;
Colors: TIntegerArray;
There: Boolean;
begin
Colors := [13034990, 4231423, 2070783, 65535, 16776960, 9812166, 16777215];
cx1:= x1;
cy1:= y1;
cx2:= x2;
cy2:= y2;
for i:=0 to High(Text) do
begin
case TextType of
'action', 'player': There := FindTextTPAEx(Colors[0], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[5], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[6], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing);
'item' : There := FindTextTPAEx(Colors[1], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[2], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing);
'npc' : There := FindTextTPAEx(Colors[3], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing);
'object': There := FindTextTPAEx(Colors[4], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing);
else
There := FindTextTPAEx(Colors[0], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[1], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[2], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[3], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[4], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[5], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing) or
FindTextTPAEx(Colors[6], 3, cx1, cy1, cx2, cy2, px, py, Text[i], 'UpChars', Nothing);
end;
if (not(There)) then Break;
cy1:= py-3;
cy2:= py+20;
end;
rx1:= cx1;
ry1:= cy1;
rx2:= cx2;
ry2:= cy2;
rx3:= px;
ry3:= py;
Result:= There;
end;

function Option(First, Second: TStringArray; TextType: string): Boolean;
var
Arrow, ChooseOptionBMP, x, y, cx1, cx2, cy1, cy2, x1, y1, x2, y2, x3: Integer;
There: Boolean;
begin
cx1:= 0;
cy1:= 0;
cx2:= 764;
cy2:= 502;
ChooseOptionBMP := BitmapFromString(14, 10, 'meJxjYGCYuuMYHDHAABoXTQQXG5' +
'cIrVUiu58YM7F6meoqCbIJhjyEDQCSWn6I');
if FindBitmapin(ChooseOptionBMP, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
There:= ChooseOptionText(0, 0, 764, 502, cx1, cy1, cx2, cy2, x1, y1, First, TextType);
if There then
begin
MMouse(x1, y1, 0, 0);
arrow:= BitmapFromString(6, 7, 'meJz7/x8KZNS14eg/uYIkcYEIAPCp' +
'R8g=');
if (not(FindBitmap(arrow, x, y))) then
begin
There:= ChooseOptionText(cx1, cy1, cx2, cy2, cx1, cy1, cx2, cy2, x1, y1, Second, TextType);
end else
begin
Wait(500+Random(500));
FindColor(x2, y2, 1647656, x1, cy1, cx2, cy2);
x3:= x1;
There:= ChooseOptionText(x2, 0, 764, 502, cx1, cy1, cx2, cy2, x1, y1, Second, TextType);
if (not(There)) then
begin
FindColor(x2, y2, 1647656, 0, cy1, x3, cy2);
There:= ChooseOptionText(0, 0, x2, 502, cx1, cy1, cx2, cy2, x1, y1, Second, TextType);
end;
end;
FreeBitmap(Arrow);
end;
end;
Mouse(x1, y1, 0, 0, True);
FreeBitmap(ChooseOptionBMP);
Result:= There;
end;

begin
setupsrl;
wait(5000);
Option(['Ivy'], ['hop'], 'all');
end.
it works well for me :)

~shut

Wizzup?

2010-11-28 06:38:58

Now that I have slept a night on this, I think it is definitely an improvement. We can now more easily see all the options. (Sometimes we could not see them)

Sir R. M8gic1an

2010-11-28 07:46:12

This shouldn't be too hard to adapt to.

ChooseOption(Main, sub: string): boolean;

Always look for main first.
If the main is not found -> return false
if the main is found -> check for sub
if sub is found -> click it
if sub is not found -> open menu
if sub is found -> click it
if sub is not found -> return false

Shut's function seems to handle this pretty well imo :)

~RM

Shuttleu

2010-11-28 09:20:44

From: Sir R. Magician
Shut's function seems to handle this pretty well imo :)

~RM

Thanks :D

i use a bitmap to see if there are sub menus

~shut

3Garrett3

2010-12-24 12:56:51

Kinda a late bump, but still relevant since this hasn't been fixed yet.

I'm using
Function FindFishOption: Boolean;
Begin
Debug('FindFishOption');
Result := Option(['ishing', 'Fish', 'Spot', ' ishing Spot'], [FishOption], 'All');
Debug('FindFishOption Result: ' + ToStr(Result));
End;

It's turning out "FindFishOption Result: False" each time, the menu is very clearly there. Is there something wrong with the code all of a sudden? I don't see anything wrong..

Wanted

2011-10-23 19:15:31

Considering writing this

How often does anyone need this?

euphemism

2011-10-23 19:44:20

From: Wanted
Considering writing this

How often does anyone need this?


Shuttleu's post a bit of the way up appears to contain code already written for this. Is it outdated, or are you considering it for O.S.I.?

Wanted

2011-10-23 19:51:26

From: euphemism
Shuttleu's post a bit of the way up appears to contain code already written for this. Is it outdated, or are you considering it for O.S.I.?


I'm just curious if how much anyone has actually had the need for this.

Eventually it will get done regardless.

I am considering this for OSI but really SRL would benefit from this seeing as it's been an entire year almost with out it.

euphemism

2011-10-23 19:57:46

From: Wanted
I'm just curious if how much anyone has actually had the need for this.

Eventually it will get done regardless.

I am considering this for OSI but really SRL would benefit from this seeing as it's been an entire year almost with out it.


Main and Smarter Child have color fighting scripts I believe. So right now I think those are the only two who might get use out of it. Though, if Jagex does stop, or at least set back, reflection on the 25th, then there might be a sudden interest in such a function.

Wanted

2011-10-23 20:05:27

From: euphemism
Main and Smarter Child have color fighting scripts I believe. So right now I think those are the only two who might get use out of it. Though, if Jagex does stop, or at least set back, reflection on the 25th, then there might be a sudden interest in such a function.


Are reflection option functions able to function fully with the sub groups?

Yago

2011-10-23 20:09:29

From: Wanted
Are reflection option functions able to function fully with the sub groups?


yes as of Ref2

Wanted

2011-10-23 20:27:41

I think I'll incorporate it into ChooseOptionMulti where it detects the arrow and uses one of the other texts in the array on the 2nd window. FindColorsSkipBox to get the 2nd window position.