Select by index glitch? or am i just using it wrong?

Hey so i’m using this function like this
image
image
Idk whi it’s not working, i wanna select the 17 option from that index.
image

[Executing block Select by Index] RuntimeBinderException: The best overloaded method match for 'RuriLib.Blocks.Puppeteer.Elements.Methods.PuppeteerSelectByIndex(RuriLib.Models.Bots.BotData, RuriLib.Functions.Puppeteer.FindElementBy, string, int, int)' has some invalid arguments

I think its thinking day “17” as a string instead of integer, try to convert it from string to int then try it

1 Like

Yes exactly, what is happening is that things that are coming from the data line (with input prefix) cannot be casted directly to another type, you need to put them in another variable first and then pass that one.

So basically add a constant string block and pass input.DAY to it, then pass the new variable to the select by index block and it will work

2 Likes

yeah i thought so, thanks for explaining btw :slight_smile:

1 Like

The technical explanation:

input is an ExpandoObject and its properties are a bit weird (it exploits the Dynamic Runtime Library). The ExpandoObject is used to have dynamic properties since the number of fields that are coming from the wordlist data line and their name (a.k.a. the slices) are not known at compile time. The other option would have been to use a dictionary but the syntax would have been much uglier (input["YEAR"] instead of input.YEAR) so I decided to go with the ExpandoObject.

In the case of an ExpandoObject property, only an explicit cast would work (i.e. (int)input.YEAR) not what I am using currently which is input.YEAR.AsInt()). I use the second version because the first one would fail since in C# you cannot just cast a string to an int, you have to call int.Parse() which is what the AsInt() method really does in the background.

Hope I was clear ^^

1 Like