PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: NemeziS on 13 March, 2005, 10:23:48

Title: Reading from a file randomly
Post by: NemeziS on 13 March, 2005, 10:23:48
Hello,
I'm writing a jokebot ( more info here: _http://board.univ-angers.fr/thread.php?threadid=3812&boardid=11&styleid=1&sid=1c7d4e37ac995663e49444868a745249 )

I have a little problem of reading blocks of jokes randomly.

Example of my file:

------------------
[COLOR=red][I](start of the first joke block)[/I] [/COLOR]
Q: What's the Blonde's cheer?
A: I'm blonde, I'm blonde,
I'm B.L.O.N....ah, oh well..
I'm blonde, I'm blonde, yea yea yea...
[COLOR=red][I](finish of the first joke block)[/I][/COLOR]  
------------------
[COLOR=red][I](start of the second joke block)[/I] [/COLOR]  
Q: Why didn't the blonde want a
window seat on the plane?
A: She'd just blow dried her hair
and she didn't want it blown around too much.
[COLOR=red][I](finish of the second joke block)[/I] [/COLOR]
------------------
[COLOR=red][I](start of the third joke block)[/I] [/COLOR]  
Q: What did the blonde customer
say to the buxom waitress
(reading her nametag) ?
A: 'Debbie'...that's cute. What
did you name the other one ?
[COLOR=red][I](finish of the third joke block)[/I] [/COLOR]
------------------
Each joke block is separated from other joke block by ------------------
So I need to read random joke block on command !showjoke.

Thanx for attention.  ;)

Best regards,
NemeziS