Results 1 to 3 of 3

Thread: need help with script

  1. #1

    Default need help with script

    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.

  2. #2

    Default

    Assuming your subject has already been put into the joke_script variable, what you have would work (though not really how I would write it... you might want to look into Ruby's "case" statement for better organization). What you have is only going execute everything up to the "end" when "joke_script =~ /critter/" evaluates to true. If joke_script = town, foir example, it would run any of those statements. What is your full script and what part isn't working the way you want?

  3. #3

    Default

    Like always I messed up on the syntax. I changed the initial if joke_script parenthesis and it works now. Now all I have to do is come up with a lot of jokes for different occasions.

Similar Threads

  1. Learn how to script with this simple hunting script
    By Tgo01 in forum The Lich Project
    Replies: 69
    Last Post: 08-24-2020, 03:20 PM
  2. adding a custom script to my script folder
    By sentral in forum The Lich Project
    Replies: 1
    Last Post: 08-09-2016, 10:05 AM
  3. Replies: 19
    Last Post: 02-03-2010, 09:49 PM
  4. In Search of COL Script and a Huntin Script...
    By Gizmo in forum Scripting Discussion
    Replies: 5
    Last Post: 01-13-2005, 06:15 PM
  5. Pookas: Smart cone script and 906 bolt script.
    By J-Tech in forum Scripting Discussion
    Replies: 27
    Last Post: 01-15-2004, 03:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •