Author Topic: Read Random line in a text file?  (Read 3148 times)

0 Members and 1 Guest are viewing this topic.

DustVixen

  • Youngling
  • *
  • Posts: 11
  • Karma: +2/-0
    • View Profile
  • Twitch Name: twitch.tv/dustvixen
Read Random line in a text file?
« on: January 04, 2016, 09:28:43 PM »
Is there a @command@ that I'm missing whereby DB can read a random line in a text file?

Eg:
!dice
Casting your dice... @readrandline@(C:\Users\Namehere\dice.txt)

Where the .txt files lists many possible outcomes:
$addpoints("$user","1","10","You have won $value $currencyname $user","fail")
$removepoints("$user","1","10","You have lost $value $currencyname $user","fail","false")

Or will I need to run two bots to do this?

Mitch

  • Master
  • ****
  • Posts: 401
  • Karma: +24/-1
  • Took me 20 minutes to change this...
    • View Profile
  • Twitch Name: Mitch619911
:)

DustVixen

  • Youngling
  • *
  • Posts: 11
  • Karma: +2/-0
    • View Profile
  • Twitch Name: twitch.tv/dustvixen
Re: Read Random line in a text file?
« Reply #2 on: January 04, 2016, 09:51:45 PM »
Thanks Mitch, but I can't seen to get @readfile@ to work when there is more than one line in the text file.

Scratch that, I'm an idiot.. for those of you reading this, just make sure you have spelled the whole string correctly *facepalm*
« Last Edit: January 04, 2016, 10:09:23 PM by RavenHexx »