AutoGram, Alyce's MadLib mod.

new BookmarkLockedFalling
JackWebb
Junior Member
**

JackWebb Avatar

Posts: 69

Post by JackWebb on Aug 6, 2009 16:28:54 GMT -5

This was my first RB project. It all started when Alyce was having a problem with her MadLib program. I decided to take it on and found that the input statement was not functioning properly when "RUN"ed from another program. My solution was to replace INPUT with TEXTBOX for user input. It worked, but of course I got carried away and kept modifying the code and this was the result. I even added a tell a friend script at the end. Kudos to Alyce for the concept, I always thought MadLib was a cool little program. It was a fun beginner project, thanks Alyce! :)

Jack



MyUrl$ = "http://yourhomepage.com"
ApplicationPath$ = "/seaside/go/runbasicpersonal?app=AutoGram"
SmtpServer$ = "your-smtp-server.com"
SmtpPassword$ = "yourpassword"

DIM Answer$(11)
FOR n = 1 to 11
READ Answer$(n)
NEXT

DIM StoryLine$(25)

Person$ = "Bob"
DefaultGender$ = "Male"

[Edit]
CLS
HTML "<body bgcolor='azure'>"
HTML "<font color='blue' size='5'>"
HTML "<center>Fill in your own answers, then read the story...</center>"
HTML "</font>"
HTML "<br>"
HTML "<br>"

HTML "<font face='verdana' color='black'>"
TEXTBOX #a, Answer$(1)
PRINT " Type the name of a game."
TEXTBOX #b, Answer$(2)
PRINT " Type the name of a color."
TEXTBOX #c, Answer$(3)
PRINT " Type an adjective describing size."
TEXTBOX #d, Answer$(4)
PRINT " Type an adverb describing speed."
TEXTBOX #e, Answer$(5)
PRINT " Type the name of a part of the body."
TEXTBOX #f, Answer$(6)
PRINT " Type the name of a food."
TEXTBOX #g, Answer$(7)
PRINT " Type the name of a piece of sports equipment."
TEXTBOX #h, Answer$(8)
PRINT " Type the name of a piece of clothing."
TEXTBOX #i, Answer$(9)
PRINT " Type the name of an animal."
TEXTBOX #j, Answer$(10)
PRINT " Type the name of a piece of furniture."
TEXTBOX #k, Answer$(11)
PRINT " Type a transitive verb. A transitive verb is one that requires a subject and an object."
TEXTBOX #person, Person$
PRINT " Enter the first name of a person."
HTML "<br>"
PRINT " "
PRINT "Is this person a Male or Female?."
radiogroup #MaleOrFemale, "Male,Female", DefaultGender$
PRINT " "
HTML "</font>"

BUTTON #submit, "Submit", [DisplayStory]
HTML "</body>"
WAIT

[DisplayStory]
CLS

Answer$(1) = #a contents$()
Answer$(2) = #b contents$()
Answer$(3) = #c contents$()
Answer$(4) = #d contents$()
Answer$(5) = #e contents$()
Answer$(6) = #f contents$()
Answer$(7) = #g contents$()
Answer$(8) = #h contents$()
Answer$(9) = #i contents$()
Answer$(10) = #j contents$()
Answer$(11) = #k contents$()

Person$ = CapFirst$(#person contents$())

Gender$ = #MaleOrFemale selection$()
DefaultGender$ = Gender$ '-- Preserve radiobutton status on edit

HisHer$ = "his"
HimHer$ = "him"
HeShe$ = "he"

IF Gender$ = "Female" THEN
HisHer$ = "her"
HimHer$ = "her"
HeShe$ = "she"
END IF

StoryLine$(1) = Person$ + " decided to clean out " + HisHer$ + " closet."
StoryLine$(2) = " "
StoryLine$(3) = "As soon as " + HeShe$ + " opened the door, a " + Answer$( 7 ) + " fell onto " + HisHer$ + " " + Answer$( 5 ) + "!"
StoryLine$(4) = CapFirst$( HisHer$ ) + " " + Answer$( 5 ) + " turned a bright shade of " + Answer$( 2 ) + ". " + Person$ + " was NOT happy. "
StoryLine$(5) = " "
StoryLine$(6) = CapFirst$( HeShe$ ) + " set the " + Answer$( 7 ) + " aside and " + Answer$( 4 ) + " reached into the closet and extracted a " + Answer$( 9 ) + "."
StoryLine$(7) = Person$ + " wondered how THAT got into the closet. " + CapFirst$( HeShe$ ) + " didn't recall placing it there."
StoryLine$(8) = " "
StoryLine$(9) = CapFirst$( HeShe$ ) + " returned to the task and grabbed " + Answer$( 6 ) + " from the top shelf."
StoryLine$(10) = "That made " + Person$ + " hungry, so " + HeShe$ + " started to walk to the kitchen."
StoryLine$(11) = CapFirst$( HeShe$ ) + " thought better of it and tossed the " + Answer$( 6 ) + " onto the " + Answer$( 10 ) + " and"
StoryLine$(12) = "continued cleaning the closet."
StoryLine$(13) = " "
StoryLine$(14) = Person$ + " crouched down to inspect the pile of stuff on the floor of the closet."
StoryLine$(15) = CapFirst$( HeShe$ ) + " was shocked to find a " + Answer$( 8 ) + ", which " + HeShe$ + " " + Answer$( 4 ) + " dragged into the room."
StoryLine$(16) = CapFirst$( HeShe$ ) + " hadn't worn that " + Answer$( 8 ) + " in many years and " + HeShe$ + " wondered if it still fit."
StoryLine$(17) = " "
StoryLine$(18) = "The " + Answer$( 8 ) + " was " + Answer$( 3 ) + ". " + CapFirst$( HeShe$ ) + " decided to try it on " + HisHer$ + " pet " + Answer$( 9 ) + "."
StoryLine$(19) = "The " + Answer$( 9 ) + " looked silly wearing the " + Answer$( 8 ) + " so " + Person$ + " went to the window"
StoryLine$(20) = "so " + HeShe$ + " could " + Answer$( 11 ) + " the " + Answer$( 8 ) + "."
StoryLine$(21) = " "
StoryLine$(22) = Person$ + " slammed the closet door and said to " + HimHer$ + "self,"
StoryLine$(23) = "That's enough cleaning for today! I'm going to play " + Answer$( 1 ) + "."
StoryLine$(24) = " "
StoryLine$(25) = " "

HTML "<body bgcolor='azure'>"
HTML "<font color='blue' size='5'>"
HTML "<center> Here is your story... </center>"
HTML "</font>"
HTML "<br>"
PRINT " "

HTML "<font face='verdana' color='black'>"
FOR n = 1 TO 25
PRINT StoryLine$(n)
NEXT
HTML "</font>"
HTML "<br>"

BUTTON #send, "Send To " + Person,ドル [TellAfriend]
BUTTON #edit, "Edit Story", [Edit]
HTML "</body>"
WAIT

[TellAfriend]
CLS
HTML "<body bgcolor='azure'>"

HTML "<font color='blue' size='5'>"
HTML "<center>Send This Story To " + Person$ + ".</center>"
HTML "</font>"
HTML "<br>"
PRINT " "

HTML "<center>"
HTML "<font face='verdana' color='black'>Your Email</font>"
HTML "<br>"
textbox #FromAddr, "", 30 : #FromAddr setfocus()
HTML "<br>"

HTML "<font face='verdana' color='black'>" + Person$ + "'s Email</font>"
HTML "<br>"
textbox #ToAddr, "", 30
HTML "<br>"

HTML "<font face='verdana' color='black'>Subject</font>"
HTML "<br>"
textbox #Subject, "Hey " + Person$ + ", I found this funny story about you.", 30
HTML "<br>"
PRINT " "

HTML "<font color='blue' size='3'>"
HTML "<center>Share This Story With Others Who Know " + Person$ + ".</center>"
HTML "</font>"
HTML "<br>"
PRINT " "

HTML "<font face='verdana' color='black'>Enter Up To 3 Email's</font>"
HTML "<br>"
TEXTBOX #ReferalA, "", 30
HTML "<br>"

TEXTBOX #ReferalB, "", 30
HTML "<br>"

TEXTBOX #ReferalC, "", 30
HTML "<br>"
PRINT " "

BUTTON #send, "Send", [SendEmail]
BUTTON #cancel, "Cancel", [GoHome]
HTML "</center>"
HTML "</body>"
WAIT

[SendEmail]
From$ = #FromAddr contents$()
ToAd$ = #ToAddr contents$()

RefA$ = #ReferalA contents$()
RefB$ = #ReferalB contents$()
RefC$ = #ReferalC contents$()
Recip$ = ToAd$ + "," + From$ + "," + RefA$ + "," + RefB$ + "," + RefC$

IF RIGHT$(Recip,ドル 2) = ",," THEN
Recip$ = LEFT$(Recip,ドル LEN(Recip$) -2)
END IF

Subj$ = #Subject contents$()

FOR n = 1 TO 25
Message$ = Message$ + StoryLine$(n) + CHR$(13)
NEXT
Message$ = Message$ + CHR$(13) + CHR$(13) + "See It Yourself.. " + MyUrl$ + ApplicationPath$ + CHR$(13)

SMTPSENDER #aSender, SmtpServer$
#aSender password(SmtpPassword$)
#aSender send(From,ドル Recip,ドル Subj,ドル Message$)

[GoHome]
EXPIRE MyUrl$ + ApplicationPath$
END

FUNCTION CapFirst$(Word$)
FirstLetter$ = UPPER$(MID$(Word,ドル 1, 1))
Remainder$ = RIGHT$(Word,ドル LEN(Word$) - 1)
CapFirst$ = FirstLetter$ + Remainder$
END FUNCTION

DATA "checkers", "red", "huge", "slowly", "nose", "broccoli", "baseball bat", "mitten", "cow", "chair", "throw"



Last Edit: Aug 6, 2009 16:30:30 GMT -5 by JackWebb
Live to code, code to live!
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

Post by Alyce on Aug 7, 2009 5:59:18 GMT -5

Jack, that's cool! I love belonging to a community where people share so freely. We all profit AND have fun.

For the record, Jerry Muelver suggested the mad lib concept to me. He uses it as a teaching method when he helps out at his school district. Sometimes, I think there is NOTHING Jerry hasn't imagined. ;)
-Alyce
JackWebb
Junior Member
**

JackWebb Avatar

Posts: 69

Post by JackWebb on Aug 7, 2009 23:38:21 GMT -5

Thanks Alyce,

That's very sweet of you :) And yes, Jerry is definately a thinker. The body of his lifes work is impressive! And I've only seen a small part of it.. I enjoyed reading his IDO website. I've never even heard of IDO but I was still able to read and actually comprehend alot of it. Great stuff!

Ok so..

Kudos to Jerry for the concept
Kudos to Alyce for implementation (proof of concept)
Kudos to me for modification

All is right with the world, now I can goto bed. 8-)


Jack




Live to code, code to live!