Special Jokebot
 

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

Special Jokebot

Started by NemeziS, 05 March, 2005, 17:28:12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NemeziS

Hi!

I have a text file with some jokes this scheme:
---------------------
Joke1 text
Joke1 text
- La la la, - told person2
- Bla, Bla, Bla, - told person1
Joke1 text. Joke end.
---------------------
Joke2 text
Joke2 text
Joke2 text. Joke end.
---------------------
- La la la, - told person2
- Bla, Bla, Bla, - told person1
Joke3 text
Joke3 text
Joke3 text. Joke end.
---------------------

In the text file each joke is separated from other joke by "---------------------"
So I need a script that will read a joke randomly from a file on +showjoke command.
I tried JokeBot by Cloud but nothing worked good.
Could somebody write a script for showing jokes from a file with jokes separated from each other?

The joke must look like this:
[19:05:42]   [U]Random joke from jokelist:[/U]

      Joke1 text
      Joke1 text
        - La la la, - told person2
        - Bla, Bla, Bla, - told person1
      Joke1 text. Joke end.

I don't need a timer functoin. But jokes must be shown on +showjoke command.

Thanx a lot. :)

Best regards,
NemeziS
--LUA forever! =)

bastya_elvtars

You might want to use an array with jokes, in the following format:

Jokes={
[[Joke1 text

Joke1 text

- La la la, - told person2

- Bla, Bla, Bla, - told person1

Joke1 text. Joke end.]],

}

etc.

and use
SendToAll(Jokes[(math.random(getn)Jokes)])

or like this.
Everything could have been anything else and it would have just as much meaning.

NemeziS

#2
I'm afraid it is not an easy way. I've got too many jokes. It's more than 7000. I don't think it is a good idea.  :(

My text file is rather big. It's size in Mb is ~= 6 Mb (I'm not sure.)

Best regards,
NemeziS
--LUA forever! =)

bastya_elvtars

Yeah, then we have to find a way to insert to an array from file. Gonna see later.
Everything could have been anything else and it would have just as much meaning.

NemeziS

I tried to get some strings from Jumble game script. But I didn't get success.  :(  Maybe you can try too.

Best regards,
NemeziS
--LUA forever! =)

NemeziS

#5
Hi, bastya_elvtars!
Have you tryed to write this one yet?  :P ( [in lua4 wanted] )

Please help!  :(
Best regards,
NemeziS
--LUA forever! =)

SMF spam blocked by CleanTalk