Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trivia and button help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Insectoid




PostPosted: Wed May 07, 2008 10:37 am   Post subject: Trivia and button help

Well, a trivia program seemed to easy, so I'm souping it up a bit. I have added buttons to the program, something I just learned ten minutes ago from a friend. As is expected, I do not know nearly everything about buttons, and a problem has occured.

When I click on the 'next question' button, it skips the rest of the program, going straight to the end. I know this has something to do with 'GUI.Quit', but once again, I olny learned this a few minutes ago. Help?

Oh, and excuse the rather disturbing questions, I can be a bit immature at times...

Turing:

import GUI in "%oot/lib/GUI"

var answer : int
var placement : int
var wrong1 : string
var wrong2 : string
var wrong3 : string
var correct : string
var question : string
var score : int := 0
var button1 : int
var button2 : int
var button3 : int
var button4 : int
var continuebutton : int


procedure right
cls
    put "You got it right!"
    locate (1, 70)
    score += 10
    put "Score: ", score
continuebutton := GUI.CreateButton (maxx div 2- 50, 200, 100, "Continue", GUI.Quit)
    end right

procedure incorrect
    put "Wrong!"
    locate (1, 70)
    put "Score: ", score
    continuebutton := GUI.CreateButton (maxx div 2 - 50, 200, 100, "Continue", GUI.Quit)
end incorrect


procedure answerplace

    locate (1, 1)
    put question

    locate (1, 70)
    put "Score: ", score

    placement := Rand.Int (1, 4)
    if placement = 1 then
        button1 := GUI.CreateButton (1, 350, 500, correct, right)
        button2 := GUI.CreateButton (1, 325, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 300, 500, wrong2, incorrect)
        button4 := GUI.CreateButton (1, 275, 500, wrong3, incorrect)
    end if



    if placement = 2 then
        button1 := GUI.CreateButton (1, 325, 500, correct, right)
        button2 := GUI.CreateButton (1, 350, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 300, 500, wrong2, incorrect)
        button4 := GUI.CreateButton (1, 275, 500, wrong3, incorrect)
    end if

    if placement = 3 then
        button1 := GUI.CreateButton (1, 300, 500, correct, right)
        button2 := GUI.CreateButton (1, 350, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 325, 500, wrong2, incorrect)
        button4 := GUI.CreateButton (1, 275, 500, wrong3, incorrect)
    end if

    if placement = 4 then
        button1 := GUI.CreateButton (1, 275, 500, correct, right)
        button2 := GUI.CreateButton (1, 350, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 325, 500, wrong2, incorrect)
        button3 := GUI.CreateButton (1, 300, 500, wrong3, incorrect)
    end if
    loop
        exit when GUI.ProcessEvent
    end loop
end answerplace





question := "What makes up 75% of your turd?"
correct := "Water"
wrong1 := "Brown goo"
wrong2 := "Dead Blood"
wrong3 := "Sardines"
answerplace


question := "What makes the turd slide well along your bumhole?"
correct := "Fiber"
wrong1 := "Oil"
wrong2 := "Sandpaper"
wrong3 := "Dead Blood"
answerplace


question := "What makes poop stink?"
correct := "Bacteria Action!"
wrong1 := "You farting while crapping"
wrong2 := "Your imagination"
wrong3 := "Dead blood"
answerplace

question := "What makes poop brown?"
correct := "Dead Blood"
wrong1 := "Bacteria Action!"
wrong2 := "Ink secreted from anal glands"
wrong3 := "Buttmonkeys"
answerplace

question := "What is not another name for poop?"
correct := "Sponge"
wrong1 := "Blind eel"
wrong2 := "George Bush"
wrong3 := "Brown baby"
answerplace


question := "Can you get sick from eating poo?"
correct := "yes"
wrong1 := "Depends on what you ate last"
wrong2 := "no"
wrong3 := "Untested"
answerplace


question := "Do most people whipe their bums sitting or standing?"
correct := "Sitting"
wrong1 := "Untested"
wrong2 := "Standing"
wrong3 := "Dead Blood"
answerplace


question := "What is the one food that always come out whole?"
correct := "Corn"
wrong1 := "Beans"
wrong2 := "Beets"
wrong3 := "MacDonald's Big Mack"
answerplace


question := "What is this trivia game about"
correct := "Solid excrement"
wrong1 := "Dead Blood"
wrong2 := "Corn"
wrong3 := "Napolean Dynomite"
answerplace

put "Thanks to www.smellypoop.com for all the info!"
Sponsor
Sponsor
Sponsor
sponsor
S_Grimm




PostPosted: Wed May 07, 2008 11:49 am   Post subject: RE:Trivia and button help

That program is absoulutly disguisting.

Use bool operators to determine if you go on or not.
Insectoid




PostPosted: Wed May 07, 2008 3:18 pm   Post subject: Re: Trivia and button help

Quote:
That program is absoulutly disguisting.

Why thank you!


Quote:
Use bool operators to determine if you go on or not.


I haven't a clue as to how boolean operators work. I want the program to continue weather you got the question right or not (as in, you only get one shot per question)

This is about buttons. The buttons only work for the first question. This is bad.
Insectoid




PostPosted: Thu May 08, 2008 10:40 am   Post subject: RE:Trivia and button help

Okay, new problem! The thing works fine until about halfway through, then the right/wrong answers get all messed up. Does it have anything to do with me using the same button, just changing it's location and question?

code:

import GUI in "%oot/lib/GUI"

var answer : int
var placement : int
var wrong1 : string
var wrong2 : string
var wrong3 : string
var correct : string
var question : string
var score : int := 0
var button1 : int
var button2 : int
var button3 : int
var button4 : int
var continuebutton : int
var mousex : int
var mousey : int
var mousebutton : int

procedure hidebutton
    GUI.Hide (button1)
    GUI.Hide (button2)
    GUI.Hide (button3)
    GUI.Hide (button4)
end hidebutton

procedure showbutton
    GUI.Show (button1)
    GUI.Show (button2)
    GUI.Show (button3)
    GUI.Show (button4)
end showbutton

procedure right
    cls
    put "You got it right!"
    locate (1, 70)
    score += 10
    put "Score: ", score
    continuebutton := GUI.CreateButton (maxx div 2 - 50, 200, 100, "Continue", GUI.Quit)
end right

procedure incorrect
    put "Wrong!"
    locate (1, 70)
    put "Score: ", score
    %continuebutton := GUI.CreateButton (maxx div 2 - 50, 200, 100, "Continue", GUI.Quit)
end incorrect


procedure answerplace
    GUI.ResetQuit
    locate (1, 1)
    put question

    locate (1, 70)
    put "Score: ", score

    placement := Rand.Int (1, 4)
    if placement = 1 then
        button1 := GUI.CreateButton (1, 350, 500, correct, right)
        button2 := GUI.CreateButton (1, 325, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 300, 500, wrong2, incorrect)
        button4 := GUI.CreateButton (1, 275, 500, wrong3, incorrect)




    elsif placement = 2 then
   
        button1 := GUI.CreateButton (1, 325, 500, correct, right)
        button2 := GUI.CreateButton (1, 350, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 300, 500, wrong2, incorrect)
        button4 := GUI.CreateButton (1, 275, 500, wrong3, incorrect)


    elsif placement = 3 then
        button1 := GUI.CreateButton (1, 300, 500, correct, right)
        button2 := GUI.CreateButton (1, 350, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 325, 500, wrong2, incorrect)
        button4 := GUI.CreateButton (1, 275, 500, wrong3, incorrect)


    elsif placement = 4 then
        button1 := GUI.CreateButton (1, 275, 500, correct, right)
        button2 := GUI.CreateButton (1, 350, 500, wrong1, incorrect)
        button3 := GUI.CreateButton (1, 325, 500, wrong2, incorrect)
        button3 := GUI.CreateButton (1, 300, 500, wrong3, incorrect)

    end if
    loop
        exit when GUI.ProcessEvent
    end loop
end answerplace




%procedure game
question := "What makes up 75% of your turd?"
correct := "Water"
wrong1 := "Brown goo"
wrong2 := "Dead Blood"
wrong3 := "Sardines"
answerplace


hidebutton
question := "What makes the turd slide well along your bumhole?"
correct := "Fiber"
wrong1 := "Oil"
wrong2 := "Sandpaper"
wrong3 := "Dead Blood"
answerplace
showbutton

hidebutton
question := "What makes poop stink?"
correct := "Bacteria Action!"
wrong1 := "You farting while crapping"
wrong2 := "Your imagination"
wrong3 := "Dead blood"
answerplace
showbutton

hidebutton
question := "What makes poop brown?"
correct := "Dead Blood"
wrong1 := "Bacteria Action!"
wrong2 := "Ink secreted from anal glands"
wrong3 := "Buttmonkeys"
answerplace
showbutton

hidebutton
question := "What is not another name for poop?"
correct := "Sponge"
wrong1 := "Blind eel"
wrong2 := "George Bush"
wrong3 := "Brown baby"
answerplace
showbutton

hidebutton
question := "Can you get sick from eating poo?"
correct := "yes"
wrong1 := "Depends on what you ate last"
wrong2 := "no"
wrong3 := "Untested"
answerplace
showbutton

hidebutton
question := "Do most people whipe their bums sitting or standing?"
correct := "Sitting"
wrong1 := "Untested"
wrong2 := "Standing"
wrong3 := "Dead Blood"
answerplace
showbutton

hidebutton
question := "What is the one food that always come out whole?"
correct := "Corn"
wrong1 := "Beans"
wrong2 := "Beets"
wrong3 := "MacDonald's Big Mack"
answerplace
showbutton

hidebutton
question := "What is this trivia game about"
correct := "Solid excrement"
wrong1 := "Dead Blood"
wrong2 := "Corn"
wrong3 := "Napolean Dynomite"
answerplace
showbutton

%end game
put "Thanks to www.smellypoop.com for all the info!"



Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: