SRL Archive - Newly Added to Reflection

GuildFishers rejoice: R_ChooseOptionDual


Cstrike

2010-12-06 15:22:37

R_ChooseOptionDual

For the lack of a better name…


{*******************************************************************************
function R_ChooseOptionDual(AboveOptionFragment, BelowOptionFragment: String; ChooseAboveOption: Boolean): Boolean;
By: Cstrike, copied mainly from Drags111
Description: Checks for two paired text that should be next to each other.
Useful for fishing when you have Net/Harpoon versus Cage/Harpoon and you are
trying to 'harpoon'. If the texts aren't next to each other, will return false.
ChooseTopOption = true means it will choose AboveOption, false = BelowOption.
*******************************************************************************}

One problem that really irritated me in the fishing guild is that occasionally the lobster/sword spot would be next to or on the net/harpoon spot, meaning that you'd have to failsafe it from catching the other stuff, and this could only be done *after* the fact, and might not even prevent it from happening that much since if you want to fish sharks… 'harpoon' will appear on each fishing spot.
Sure, you could make your mouse randomness to zero and hit the dead center, if you want to be banned… but no need, this function now does it all for you!

Note that it only searches for a fragment of the text, so be specific in what you're looking for. If it says 'Harpoon Fishing spot', put something like 'Harpoon Fi' because it uses the Pos(); function

Bonuses for using:
  • Does the same thing as R_ChooseOptionMulti almost, except it passes this new parameter to ensure you're hitting the right option.
  • Now human names won't affect your option choosing, if some guy has the name 'harpoon' in his name, you won't accidentally pick him
  • For the same reason above, bot hunters now won't stop you :sasmokin:


How it works
R_ChooseOptionDual(AboveOptionFragment, BelowOptionFragment: String; ChooseAboveOption: Boolean)

If you have a menu text like this:
Trade with NoobFace121 (level-64)
Cage Fishing spot
Harpoon Fishing spot
Net Fishing spot
Harpoon Fishing spot <----
Walk Here
Cancel

If you want to target the area I pointed to above, do this:
R_ChooseOptionDual('Net Fishing', 'Harpoon Fishing', False);
We set the last option as False because we don't want it to choose the above fragment.


===========================================

If you get this:
Trade with NoobFace121 (level-64)
Net Fishing spot
Harpoon Fishing spot
Cage Fishing spot <----
Harpoon Fishing spot
Walk Here
Cancel

Use
R_ChooseOptionDual('Cage Fis', 'Harpoon Fis', True);
To select the top spot.



===========================================

If you get this:
Trade with NoobFace121 (level-64)
Cage Fishing spot <----
Harpoon Fishing spot
Net Fishing spot
Harpoon Fishing spot
Walk Here
Cancel

You can use either R_ChooseOptionDual or R_ChooseOption[Multi] if you want, as either will work. But of course, it won't always end up this pretty.


This function should be used when you need to select a specific action relative to another one.
More to come :)
If you have any problems with it post


Yes, this may hint towards what is in the works… ;)

If you have any problems with this, post here. Thank you

mormonman

2010-12-06 17:29:14

From: cstrike
Note that it only searches for a fragment of the text, so be specific in what you're looking for. If it says 'Harpoon Fishing spot', put something like 'Harpoon Fi' because it uses the Pos(); function


False, you can put the whole text. Pos() will still return true. It doesn't search for fragment.

Cstrike

2010-12-06 18:12:52

From: mormonman
False, you can put the whole text. Pos() will still return true. It doesn't search for fragment.


Technically that's true, though from personal experience more letters means more nerfing. If people keep it shorter, the better of they are or should be.

Yes I know it SHOULDNT matter how long the length is… but it just seems to randomly go wrong.

Sir R. M8gic1an

2010-12-07 20:01:01

Interesting… Nice function! :-)

~RM

Nava2

2010-12-07 20:16:18

I feel like this should be implemented for N-texts..

Cstrike

2010-12-07 20:31:59

From: Nava2
I feel like this should be implemented for N-texts..


This I will eventually work on, and was thinking of that today ;) In my opinion it should actually be implemented for all different texts eventually, we'd be considered at a loss if we don't create this function.

The question is how to set it up though?

R_ChooseOption[namehere?] (Actions: TStringArray; RelativeLines: TIntegerArray; OptionToSelect: Integer): Boolean;

Sir R. M8gic1an

2010-12-07 20:45:11

ChooseOptionList(List: TStringArray; Which: integer)

Net Fishingspot
Cage Fishingspot
Net Fishingspot <--
Harpoon fishingspot

ChooseOptionsList(['Net Fi', 'Cage Fi', 'Net Fi', 'Harpoon Fi'], 2)

how about that?

~RM

Cstrike

2010-12-07 20:58:49

From: Sir R. Magician
ChooseOptionList(List: TStringArray; Which: integer)

Net Fishingspot
Cage Fishingspot
Net Fishingspot <--
Harpoon fishingspot

ChooseOptionsList(['Net Fi', 'Cage Fi', 'Net Fi', 'Harpoon Fi'], 2)

how about that?

~RM


I like that :)

Though what is 'which' relative to? If you got


Net Fishingspot
Cage Fishingspot
Crap
Crap
Crap
Net Fishingspot <--
Harpoon fishingspot

Would which be '3' still?

Sir R. M8gic1an

2010-12-07 23:55:32

Relative to the position in the TStringArray ;)

And remember the array starts from 0, so that'd be 2, not 3

~RM