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 :)

  • VioneT@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 months 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 
    
    • allo@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 months 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!