hi. nuublet here.

`let x = “PerchanceListA”

[x]`

how do i have it retrieve PerchanceListA instead of a list named x?

I bet it’s something simple like some evaluateScript thing but i don’t know because I’m a noob :)

  • alloOP
    link
    English
    1
    edit-2
    21 days ago

    ty tho maybe i missexplained.

    let xx = "Bright"; alert(root[xx])

    in normal javascript, this would access root.Bright. (interesting about ‘root’. didnt kno that)

    The above is what I’m trying to do. I have the word for the name of the list on a variable. Hao access list from variable?

    I have the variable xx storing the string “Bright”. Hao maek alert say a list item from the list named “Bright”?

    • VioneTM
      link
      English
      221 days ago

      For example on the /minimal generator we have the list:

      listnames
        animal
        adjective
        verb
        location
      

      then on the javascript:

      let x = listnames; // you can also use listnames.selectOne, if you only want it to have a single item and you have to reload the page to randomize it again.
      // This would get a 'random' value from the `listnames`.
      alert((y = x.selectOne) + ':' + root[y]);
      // would give a random item from any of the list 
      
      • alloOP
        link
        English
        120 days ago

        Thank you! the root thing worked. turns out i had a capital letter where there shouldnt have been one and that’s why my list wasn’t being translated from the string correctly. silly and my fault and nothing about language. thanks for the help tho!