Remove Random Function

Asked Oct 30, 2023·1 reply·Last activity 2 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hello everyone,

I just need some simple help.

I use this code:

$(user) $(eval a=$(urlfetch json https://pastebin.com/raw/***).split(#); a[Math.floor(Math.random()*a.length)])

What i want to change / remove in this code is the "random" function.

In the Pastebin file there are over a hundred lines and I want them to show up one by one and not randomly when the command triggered.

Any help would be greatly appreciated.

Thank you!

1 reply

Hey @Frosty Duck!

For that we'll use the $(count) variable and the remainder operator:

$(eval a=`$(urlfetch json https://pastebin.com/raw/PASTE_ID)`.split(`#`); a[parseInt('$(count)') % a.length];)

It'll likely skip the first line for the first lap, but once it'll come back around, it'll start with the first line; don't alter your paste to get the first line to show up on the first lap.