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
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.
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
Yeah, then we have to find a way to insert to an array from file. Gonna see later.
I tried to get some strings from Jumble game script. But I didn't get success. :( Maybe you can try too.
Best regards,
NemeziS
Hi, bastya_elvtars!
Have you tryed to write this one yet? :P ( [in lua4 wanted] )
Please help! :(
Best regards,
NemeziS