Eliseen
02-21-2021, 02:22 PM
So I'm trying to make a script for "role playing". I call it joke. the command would be ;joke subject. So if you entered ;joke critter it would branch to a routine that would randomly select 1 of 10 random jokes. Here is a snipet:
if joke_script =~ /critter/
joke_critter = rand(10)
fput "say What is red small monster thas a pink spotted head, sixteen hairy legs and four big eyes on finger like things? I don’t know either but there is one crawling up your back!" if joke crittter == 0
fput "say :forceful What is big, yellow and prickly, has three eyes and eats rocks? A big, yellow, prickly three eyed rock eater!" if joke_critter == 1
etc.
fput "joke 9" if joke_critter == 9
end
My problem is there will be multiple sections one for each subject, I Tried an reg_ex to allow the proper section to generate a random joke, I know that part works as I've used the random expression in the past. How do I get the script to execute that one section among all the others?
Any help would be appreciated.
if joke_script =~ /critter/
joke_critter = rand(10)
fput "say What is red small monster thas a pink spotted head, sixteen hairy legs and four big eyes on finger like things? I don’t know either but there is one crawling up your back!" if joke crittter == 0
fput "say :forceful What is big, yellow and prickly, has three eyes and eats rocks? A big, yellow, prickly three eyed rock eater!" if joke_critter == 1
etc.
fput "joke 9" if joke_critter == 9
end
My problem is there will be multiple sections one for each subject, I Tried an reg_ex to allow the proper section to generate a random joke, I know that part works as I've used the random expression in the past. How do I get the script to execute that one section among all the others?
Any help would be appreciated.