Reading from a file randomly
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Reading from a file randomly

Started by NemeziS, 13 March, 2005, 10:23:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NemeziS

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
--LUA forever! =)

SMF spam blocked by CleanTalk