Parse and sort variables in a list



  • So lets say I parse this list by ticking "recursive": [0, 1 / 1, 0, 0, 106, 0, 0, 0, 0, 0, 0, 0]
    I only want the third, the fifth and the ninth variable.
    How do I sort them out of the list and give them each a name?


  • Mod

    Hi @sowow
    Screen what it shows you in recursive and as its I show you



  • https://imgur.com/LtnvFzi
    It's a list and , is the seperator


  • Mod

    Hi @sowow,
    According to your screen
    I wrote to you in private to explain to you try to pass as if you don't arrive come in private it will go faster
    Your capture : [3, 17 / 315, 105 / 94, 0, 2,7 k, 41, 2, 36, 40, 86, 0, 1]
    I'll show you how I would try and tell me
    Third value (315) :
    LS : [3, 17 /
    RS : , 105 / 94, 0, 2,7 k, 41, 2, 36, 40, 86, 0, 1] or try this ,
    The fifth value (94):
    LS : [3, 17 / 315, 105 /
    RS : , 0, 2,7 k, 41, 2, 36, 40, 86, 0, 1] or try ,
    The ninth value(41) :
    LS : [3, 17 / 315, 105 / 94, 0, 2,7 k,
    RS: , 2, 36, 40, 86, 0, 1] or try this ,



  • Since the source of values is a LIST, then the fist value of the list should be "3", second value "17/315" and so on, so taking this in consideration the
    Third value is "105/94"
    Fifth value is "2"
    Ninth value is "36"
    but he need to clarified what is the third value for him
    anyway I wrote a Crazy Advance LoliScript WTF 😂 to get those values

    PARSE "LIST" LR "" "" -> VAR "Variables" ## Source Of values "LIST"
    #UTILITY_INDEX UTILITY File "INDEX.txt" ReadLines -> VAR "INDEXWANT" ## Index of Value need it for this case third =2, Fifth=5 and Ninth=8
    #UTILITY_Length UTILITY List "INDEXWANT" Length -> VAR "Lenght" ## Lenght of Index to control the LOOP
    SET VAR "INDEX" "0"
    WHILE "<INDEX>" LessThan "<Lenght>" ## LOOP
    PARSE "<Variables[<INDEXWANT[<INDEX>]>]>" LR "" "" -> VAR "MyCapture" ##Crazy Advance LoliScript WTF
    FUNCTION Compute "<INDEX>+1" -> VAR "INDEX" ## Increment of Index
    ENDWHILE
    

    @Ruri Could you optimize this peace of code when you get a chance to replace (#UTILITY_INDEX UTILITY File "INDEX.txt" ReadLines -> VAR "INDEXWANT") to use FUNCTION Block or something instead of ReadLine->File. ^-^
    CaptureListValue.PNG


  • Admin

    You could have used a translate function, but anyways i don't think this is what the guy wanted to achieve 🤔



  • Alright I'll be a bit c learer.
    So in this list [0, 1 / 1, 52/50, 0, 106, 0, 0, 0, 75, 0, 0, 0], 52/50 is the third value.
    106 is the fifth value.
    75 is the ninth value.
    I would like to sort these out of the list so that they're on their own, and so that I possibly could make them the capture.
    The list numbers can be anything, so trying to sort by index or using the actual list as LR won't work.
    Maybe its just not possible?


  • Admin

    Why can't you just use something like UTILITY List "list" RemoveValues EqualTo "0" -> VAR "list"



  • @Ruri Well the numbers in the list will be different each time, so 0 might not be present.
    Also, 0 might be the third, fifth or ninth value, which I wanna capture.


  • Admin

    You can access the list through <list[index]> so for example for the 3rd value you just do <list[2]> since it starts counting from 0. You can grab the 3 values you need like that and write them to a constant string for example, through a function -> constant block like <list[2]> | <list[4]> | <list[8]>



  • Hmm that doesn't seem to work.
    The function only returns the whole list.
    I made a config that simulates the list, though the numbers could be anything.
    Should I link it here?

    EDIT: Hold on, I'm stupid. I'll get back to you, let me just try something.
    EDIT2: That worked! Awesome, thanks Ruri!


  • Mod

    Okay so the soluce for this problem is i just to put the correct variable "<listname[x(number)]>" in a constant function block to capture the value you want


Log in to reply