TyranoBuilder 1.7---Get Random From Array Using JS

1 min read

Deviation Actions

8oni's avatar
By
Published:
2.7K Views
Hi

Watch video tutorial here :


Just really simple ways to use Java Script to get random text from array.
Here is full code :
var myArray = [
  "Bob",
  "Killua",
  "Gon",
  "Phoebe",
  "Amy",
  "Maya",
  "Akira"
];

var randomItem = myArray[Math.floor(Math.random()*myArray.length)];

[loadjs storage="fruit.js"]
[eval exp="f.randomfruit=randomItem"]
#8oni
Hi [emb exp="f.randomfruit"]! It's nice to meet you!


Documentation :
css-tricks.com/snippets/javasc…
tyranobuilder.com/tyranoscript…
© 2018 - 2024 8oni
Comments0
Join the community to add your comment. Already a deviant? Log In