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

Username:   Password: 
 RegisterRegister   
 Buttons .... Procedures....more problems
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
goleafsgo123




PostPosted: Sun May 29, 2005 6:33 pm   Post subject: Buttons .... Procedures....more problems

So I'm creating a "Choose-Your-Own Adventure" style game, and I want to make up scenarios, and then the user chooses their answer. I want to incorporate buttons into the game, for each selection, and I am following this Buttons Tutorial:

code:
import GUI

setscreen ("graphics:300;125")

procedure hello
    locate (1, 1)
    put "You coward!"
end hello

procedure hi
    locate (1, 1)
    put "You murderer!"
end hi

var button1 : int := GUI.CreateButton (25, 25, 250, "B) Leave him Alone", hello)
var button2 : int := GUI.CreateButton (25, 50, 0, "A) Kill Him", hi)

loop
    exit when GUI.ProcessEvent
end loop



Now, I incorporated that into my program, but something does not seem to work. It says that I have not declared "Question 1A". Here is the code of my program ....

code:
import GUI

var sign1X : int := 0
var sign2X : int := 480
var font1 : int := Font.New ("Verdana:40:bold")
var font2 : int := Font.New ("Courier New:20:bold")
var font3 : int := Font.New ("Courier New:10:bold")
var font4 : int := Font.New ("Comic Sans MS:30:bold")
var font5 : int := Font.New ("Tahoma:10:bold")
var font6 : int := Font.New ("Tahoma:50:bold")
var keyPressed1 : string (1)
var keyPressed2 : string (1)
var signSwitch : boolean := false
var clr : int := 218 % The color to assign to
var text1 : int := Font.New ("Times New Roman:18:Bold") % First Font
var button1 : int := GUI.CreateButton (25, 25, 250, "A) Jump out of the car.", question1A)
var button2 : int := GUI.CreateButton (25, 25, 250, "B) Wait it out.", question1B)

View.Set ("graphics:1100;550")

View.Set ("offscreenonly")

View.Update

procedure intro
    loop
        colorback (black)
        Text.Cls
        Font.Draw ("Press any key to continue", 260, 25, font3, yellow)
        Font.Draw ("A TCMS Adventure...", sign1X, 500, font1, yellow)
        Font.Draw ("A TCMS Adventure...", sign2X, 100, font1, yellow)
        Font.Draw ("OBJECT", 350, 450, font2, yellow)
        Font.Draw ("Guide your character through a normal school day", 250, 400, font3, yellow)
        Font.Draw ("at TCMS high school by making decisions", 250, 380, font3, yellow)
        Font.Draw ("based on given scenarios.", 250, 360, font3, yellow)
        Font.Draw ("Pressing x at any time exits the game and returns you to this screen", 250, 305, font3, yellow)
        Font.Draw ("This game is created by:", 250, 235, font3, yellow)
        Font.Draw ("Jaspreet Johal", 250, 170, font4, white)
        if sign1X <= 0 then
            signSwitch := true
        elsif sign1X >= 460 then
            signSwitch := false
        end if
        if signSwitch then
            sign1X += 1
            sign2X -= 1
        elsif signSwitch = false then
            sign1X -= 1
            sign2X += 1
        end if
        View.Update
        exit when hasch
        Time.Delay (5)
    end loop
end intro

procedure loadScreen
    colorback (white)
    cls
    for i : 0 .. 39
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div 2) - (Font.Width ("You are being transported to TCMS...", text1) div 2), (maxy div 2) - 9, text1, clr)
        View.Update
        delay (50)
    end for
    delay (1000)
    for decreasing i : 39 .. 0
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div 2) - (Font.Width ("You are being transported to TCMS...", text1) div 2), (maxy div 2) - 9, text1, clr)
        View.Update
        delay (50)
    end for
end loadScreen

procedure question1A
    locate (1, 1)
    put "You died!"
end question1A

procedure question1B
    locate (1, 1)
    put "You were late for class!"
end question1B


intro

loadScreen

colorback (black)
cls
Font.Draw ("Welcome to Town Center Motnessori Private Schools.", 260, 525, font5, yellow)
Font.Draw ("Your father is currently trying to get into the parking lot, but it is jammed.", 260, 490, font5, yellow)
Font.Draw ("You have about 5 minutes until your first period class so you are in a rush. ", 260, 455, font5, yellow)
Font.Draw ("DO YOU:", 325, 360, font6, yellow)

question1A

question1B



Any help is appreciated...
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun May 29, 2005 10:13 pm   Post subject: (No subject)

Turing GUI is horrid like that.
You can create your button streams at the onset of your programme, but you'll have to wait until after their associated fucntions are done to initialize them.
So...

Turing:

var button1 : int
%...

procedure question1A
%....
end question1A

%...
button1 := GUI.CreateButton (25, 25, 250, "A) Jump out of the car.", question1A)


In that order.
goleafsgo123




PostPosted: Mon May 30, 2005 5:24 am   Post subject: (No subject)

Thanks for that Delos, but now I got another problem Sad

I got the buttons to show up when I wanted to, but there is NO way for the user to click on the buttons in the output. The GUI does not seem to allow the user to click on it Confused

Here's my updated code, and again, all help is greatly appreciated...

code:

import GUI

var sign1X : int := 0
var sign2X : int := 480
var font1 : int := Font.New ("Verdana:40:bold")
var font2 : int := Font.New ("Courier New:20:bold")
var font3 : int := Font.New ("Courier New:10:bold")
var font4 : int := Font.New ("Comic Sans MS:30:bold")
var font5 : int := Font.New ("Tahoma:10:bold")
var font6 : int := Font.New ("Tahoma:50:bold")
var keyPressed : string (1)
var signSwitch : boolean := false
var clr : int := 218 % The color to assign to
var text1 : int := Font.New ("Times New Roman:18:Bold") % First Font
var button1 : int
var button2 : int

View.Set ("graphics:1200;650")

View.Set ("offscreenonly")
View.Update

procedure intro
    loop
        colorback (black)
        Text.Cls
        Font.Draw ("Press any key to continue", 260, 25, font3, yellow)
        Font.Draw ("A TCMS Adventure...", sign1X, 500, font1, yellow)
        Font.Draw ("A TCMS Adventure...", sign2X, 100, font1, yellow)
        Font.Draw ("OBJECT", 350, 450, font2, yellow)
        Font.Draw ("Guide your character through a normal school day", 250, 400, font3, yellow)
        Font.Draw ("at TCMS high school by making decisions", 250, 380, font3, yellow)
        Font.Draw ("based on given scenarios.", 250, 360, font3, yellow)
        Font.Draw ("Pressing x at any time exits the game and returns you to this screen", 250, 305, font3, yellow)
        Font.Draw ("This game is created by:", 250, 235, font3, yellow)
        Font.Draw ("Jaspreet Johal", 250, 170, font4, white)
        if sign1X <= 0 then
            signSwitch := true
        elsif sign1X >= 460 then
            signSwitch := false
        end if
        if signSwitch then
            sign1X += 1
            sign2X -= 1
        elsif signSwitch = false then
            sign1X -= 1
            sign2X += 1
        end if
        View.Update
        exit when hasch
        Time.Delay (5)
    end loop
end intro

procedure loadScreen
    colorback (white)
    cls
    for i : 0 .. 39
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div 2) - (Font.Width ("You are being transported to TCMS...", text1) div 2), (maxy div 2) - 9, text1, clr)
        View.Update
        delay (50)
    end for
    delay (1000)
    for decreasing i : 39 .. 0
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div 2) - (Font.Width ("You are being transported to TCMS...", text1) div 2), (maxy div 2) - 9, text1, clr)
        View.Update
        delay (50)
    end for
end loadScreen

procedure question1A
    locate (1, 1)
    put "You died!"
    button1 := GUI.CreateButton (165, 250, 250, "A) Jump out of the car.", question1A)
end question1A

procedure question1B
    locate (1, 1)
    put "You were late for class!"
    button2 := GUI.CreateButton (25, 25, 250, "B) Wait it out.", question1B)
end question1B

intro

loadScreen


colorback (white)
cls
Font.Draw ("Welcome to Town Center Motnessori Private Schools.", 260, 525, font5, black)
Font.Draw ("Your father is currently trying to get into the parking lot, but it is jammed.", 260, 490, font5, black)
Font.Draw ("You have about 5 minutes until your first period class so you are in a rush. ", 260, 455, font5, black)
Font.Draw ("DO YOU:", 325, 360, font6, black)

question1A

question1B
MysticVegeta




PostPosted: Mon May 30, 2005 7:31 am   Post subject: (No subject)

you have to add
code:
loop
exit when GUI.ProcessEvent
end loop

in the end. But you have to figure out where you need to put. Cant put it for you now cause i am in the library.
goleafsgo123




PostPosted: Mon May 30, 2005 11:45 am   Post subject: (No subject)

Yeah, I know about those loops, but whenever I put them in the program, the program either refuses to load, or crashes after the run screen, depending on where I put them.

So is there any other place where I can put that loop ... ?
MysticVegeta




PostPosted: Mon May 30, 2005 3:36 pm   Post subject: (No subject)

code:
import GUI

var sign1X : int := 0
var sign2X : int := 480
var font1 : int := Font.New ("Verdana:40:bold")
var font2 : int := Font.New ("Courier New:20:bold")
var font3 : int := Font.New ("Courier New:10:bold")
var font4 : int := Font.New ("Comic Sans MS:30:bold")
var font5 : int := Font.New ("Tahoma:10:bold")
var font6 : int := Font.New ("Tahoma:50:bold")
var keyPressed : string (1)
var signSwitch : boolean := false
var clr : int := 218 % The color to assign to
var text1 : int := Font.New ("Times New Roman:18:Bold") % First Font
var button1, button2, b3 : int

View.Set ("graphics:1200;650")
View.Set ("offscreenonly")
View.Update

procedure intro
    loop
        colorback (black)
        Text.Cls
        Font.Draw ("Press any key to continue", 260, 25, font3, yellow)
        Font.Draw ("A TCMS Adventure...", sign1X, 500, font1, yellow)
        Font.Draw ("A TCMS Adventure...", sign2X, 100, font1, yellow)
        Font.Draw ("OBJECT", 350, 450, font2, yellow)
        Font.Draw ("Guide your character through a normal school day", 250, 400, font3, yellow)
        Font.Draw ("at TCMS high school by making decisions", 250, 380, font3, yellow)
        Font.Draw ("based on given scenarios.", 250, 360, font3, yellow)
        Font.Draw ("Pressing x at any time exits the game and returns you to this screen", 250, 305, font3, yellow)
        Font.Draw ("This game is created by:", 250, 235, font3, yellow)
        Font.Draw ("Jaspreet Johal", 250, 170, font4, white)
        if sign1X <= 0 then
            signSwitch := true
        elsif sign1X >= 460 then
            signSwitch := false
        end if
        if signSwitch then
            sign1X += 1
            sign2X -= 1
        elsif signSwitch = false then
            sign1X -= 1
            sign2X += 1
        end if
        View.Update
        exit when hasch
        Time.Delay (5)
    end loop
end intro

procedure loadScreen
    colorback (white)
    cls
    for i : 0 .. 39
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div 2) - (Font.Width ("You are being transported to TCMS...", text1) div 2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
    delay (1000)
    for decreasing i : 39 .. 0
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div 2) - (Font.Width ("You are being transported to TCMS...", text1) div 2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
end loadScreen

procedure question1A
    locate (1, 1)
    put "You died!"
end question1A

procedure question1B
    locate (1, 1)
    put "You were late for class!"
end question1B


proc load2
    View.Set ("nooffscreenonly")
    colorback (white)
    cls
    Font.Draw ("Welcome to Town Center Motnessori Private Schools.", 260, 525, font5, black)
    Font.Draw ("Your father is currently trying to get into the parking lot, but it is jammed.", 260, 490, font5, black)
    Font.Draw ("You have about 5 minutes until your first period class so you are in a rush. ", 260, 455, font5, black)
    Font.Draw ("DO YOU:", 325, 360, font6, black)
    GUI.Show (button2)
    GUI.Show (button1)
    GUI.Show (b3)
    GUI.Enable (button2)
    GUI.Enable (button1)
    GUI.Enable (b3)
end load2


intro
loadScreen

button2 := GUI.CreateButton (25, 25, 250, "B) Wait it out.", question1B)
button1 := GUI.CreateButton (165, 250, 250, "A) Jump out of the car.", question1A)
b3 := GUI.CreateButton (205, 150, 250, "Exit", GUI.Quit)

load2

loop
    exit when GUI.ProcessEvent
end loop


There you go.
MysticVegeta




PostPosted: Mon May 30, 2005 3:37 pm   Post subject: (No subject)

You have to position the declaration of the buttons properly (which i did) Also the "offscreenonly" was interfering with the GUI. You shoul have "nooffscreenonly" in every procedure you show/enable a GUI button or other interface.
goleafsgo123




PostPosted: Thu Jun 02, 2005 7:26 pm   Post subject: (No subject)

Darn, I seem to have run into a roadblock with the program. So I got the button to go to the next screen to work, but once it goes to the next screen ..... you can't click on the buttons.

I can't seem to recognize the problem, seeing as the code is exactly the same for both button screens, yet there is a problem.

Any help is appreciated!

code:
import GUI

var sign1X : int := 0
var sign2X : int := 480
var font1 : int := Font.New ("Verdana:40:bold")
var font2 : int := Font.New ("Courier New:20:bold")
var font3 : int := Font.New ("Courier New:10:bold")
var font4 : int := Font.New ("Comic Sans MS:30:bold")
var font5 : int := Font.New ("Tahoma:10:bold")
var font6 : int := Font.New ("Tahoma:50:bold")
var keyPressed : string (1)
var signSwitch : boolean := false
var clr : int := 218 % The color to assign to
var text1 : int := Font.New ("Times New Roman:18:Bold") % First Font
var button1A, button1B, button1C, button1Next, button2A, button2B,
    button2C, button2Next : int

View.Set ("graphics:1200;650")

View.Set ("offscreenonly")
View.Update

procedure intro
    loop
        colorback (black)
        Text.Cls
        Font.Draw ("Press any key to continue", 260, 25, font3, yellow)
        Font.Draw ("A TCMS Adventure...", sign1X, 500, font1, yellow)
        Font.Draw ("A TCMS Adventure...", sign2X, 100, font1, yellow)
        Font.Draw ("OBJECT", 350, 450, font2, yellow)
        Font.Draw ("Guide your character through a normal school day",
            250, 400, font3, yellow)
        Font.Draw ("at TCMS high school by making decisions", 250,
            380, font3, yellow)
        Font.Draw ("based on given scenarios.", 250, 360, font3, yellow)
        Font.Draw ("Press the EXIT button to stop the program, and then just close the window.", 250, 305, font3, yellow)
        Font.Draw ("This game is created by:", 250, 235, font3, yellow)
        Font.Draw ("Jaspreet Johal", 250, 170, font4, white)
        if sign1X <= 0 then
            signSwitch := true
        elsif sign1X >= 460 then
            signSwitch := false
        end if
        if signSwitch then
            sign1X += 1
            sign2X -= 1
        elsif signSwitch = false then
            sign1X -= 1
            sign2X += 1
        end if
        View.Update
        exit when hasch
        Time.Delay (5)
    end loop
end intro

procedure loadScreen
    colorback (white)
    cls
    for i : 0 .. 39
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div
            2) - (Font.Width ("You are being transported to TCMS...", text1) div
            2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
    delay (1000)
    for decreasing i : 39 .. 0
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div
            2) - (Font.Width ("You are being transported to TCMS...", text1) div
            2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
end loadScreen

procedure question1A
    locate (1, 1)
    Font.Draw ("Your courageous decision resulted in you getting in class 2 minutes early. Congrats!", 260, 175, font5, yellow)
end question1A

procedure question1B
    locate (1, 1)
    Font.Draw ("You ended up being 5 minutes late for class. :(", 260, 175, font5, yellow)
end question1B

procedure question1C
    locate (1, 1)
    Font.Draw ("There was a large van with elementary kids in the side entrance, and you were stuck behind it. You were 2 minutes late for Period 1.", 260, 175, font5, yellow)
end question1C

proc scene1
    View.Set ("nooffscreenonly")
    colorback (black)
    cls
    Font.Draw ("Welcome to Town Center Montessori Private Schools.", 260, 525, font5, yellow)
    Font.Draw ("Your father is currently trying to get into the parking lot, but it is jammed.", 260, 490, font5, yellow)
    Font.Draw ("You have about 5 minutes until your first periodclass so you are in a rush. ", 260, 455, font5, yellow)
    Font.Draw ("DO YOU:", 325, 360, font6, yellow)
    GUI.Show (button1A)
    GUI.Show (button1B)
    GUI.Show (button1C)
    GUI.Show (button1Next)
    GUI.Enable (button1A)
    GUI.Enable (button1B)
    GUI.Enable (button1C)
    GUI.Enable (button1Next)
    Font.Draw ("Press the NEXT SCREEN button to continue.", 260, 150, font5, yellow)
end scene1

procedure question2A
    locate (1, 1)
    Font.Draw ("Your courageous decision resulted in you getting in class 2 minutes early. Congrats!", 260, 175, font5, yellow)
end question2A

procedure question2B
    locate (1, 1)
    Font.Draw ("You ended up being 5 minutes late for class. :(", 260, 175, font5, yellow)
end question2B

procedure question2C
    locate (1, 1)
    Font.Draw ("There was a large van with elementary kids in the side entrance, and you were stuck behind it. You were 2 minutes late for Period 1.", 260, 175, font5, yellow)
end question2C

proc scene2
    View.Set ("nooffscreenonly")
    colorback (black)
    cls
    Font.Draw ("You are in your Period 1 Class.", 260, 525, font5, yellow)
    Font.Draw ("Your teacher asks you if you are ready for the surprise quiz.", 260, 490, font5, yellow)
    Font.Draw ("You forgot all about it, and now are screwed for the quiz. ", 260, 455, font5, yellow)
    Font.Draw ("DO YOU:", 325, 360, font6, yellow)
    GUI.Show (button2A)
    GUI.Show (button2B)
    GUI.Show (button2C)
    GUI.Show (button2Next)
    GUI.Enable (button2A)
    GUI.Enable (button2B)
    GUI.Enable (button2C)
    GUI.Enable (button2Next)
    Font.Draw ("Press the NEXT SCREEN button to continue.", 260, 150, font5, yellow)
end scene2

/* Main */

intro

loadScreen

button1A := GUI.CreateButton (300, 250, 250, "A) Jump out of the car.", question1A)
button1B := GUI.CreateButton (300, 225, 250, "B) Wait for your father to park.", question1B)
button1C := GUI.CreateButton (300, 200, 250, "C) Tell him to use the side entrance.", question1C)
button1Next := GUI.CreateButton (300, 100, 250, "Next Screen...", GUI.Quit)

scene1

loop
    exit when GUI.ProcessEvent
end loop

button2A := GUI.CreateButton (300, 250, 250, "A) Tell teacher you are ready, and choose random answers.", question2A)
button2B := GUI.CreateButton (300, 225, 250, "B) Ask teacher for an extension.", question2B)
button2C := GUI.CreateButton (300, 200, 250, "C) Tell teaher you are ready, and sit beside the smartest person, so you can copy answers.", question2C)
button2Next := GUI.CreateButton (300, 100, 250, "Next Screen...", GUI.Quit)

loop
    exit when GUI.ProcessEvent
end loop

scene2

Sponsor
Sponsor
Sponsor
sponsor
goleafsgo123




PostPosted: Fri Jun 03, 2005 5:24 pm   Post subject: (No subject)

Anyone?
MysticVegeta




PostPosted: Fri Jun 03, 2005 7:28 pm   Post subject: (No subject)

You dont need 2 exit when GUI.ProcessEvent, You could simply make more procedures, and then clear the screen on every procedure. and you will have to ->
code:
GUI.Disable(prevbutton)
GUI.Hide(prebutton)

GUI.Show(newbutton)
GUI.Enable(newbutton)
goleafsgo123




PostPosted: Fri Jun 03, 2005 8:28 pm   Post subject: (No subject)

Thanks for all the help, Mystic Vegeta, but I still need one more critical thing ...

For my procedure scene1, the user can perfectly click on the buttons, and the appropriate text appears.

But, for scene2, even though the code is the same as scene1, I can NOT click the buttons at all...
MysticVegeta




PostPosted: Sat Jun 04, 2005 9:01 am   Post subject: (No subject)

well, did you modify the code according to the post? If you did try to modify and didnt get anywhere, post the modified code, i will try to fix it
goleafsgo123




PostPosted: Sat Jun 04, 2005 12:11 pm   Post subject: (No subject)

Ok, so I added the GUI.Disable, and GUI.Hide code for each previous button. I was a little unsure about where to put it, but I decided to put it in the procedure for scene2

Even with that, you still can't click the buttons on scene2, even though you can see them fine.

Here's the code:

code:

import GUI

var sign1X : int := 0
var sign2X : int := 480
var font1 : int := Font.New ("Verdana:40:bold")
var font2 : int := Font.New ("Courier New:20:bold")
var font3 : int := Font.New ("Courier New:10:bold")
var font4 : int := Font.New ("Comic Sans MS:30:bold")
var font5 : int := Font.New ("Tahoma:10:bold")
var font6 : int := Font.New ("Tahoma:50:bold")
var keyPressed : string (1)
var signSwitch : boolean := false
var clr : int := 218 % The color to assign to
var text1 : int := Font.New ("Times New Roman:18:Bold") % First Font
var button1A, button1B, button1C, button1Next, button2A, button2B,
    button2C, button2Next : int

View.Set ("graphics:1200;650")

View.Set ("offscreenonly")
View.Update

procedure intro
    loop
        colorback (black)
        Text.Cls
        Font.Draw ("Press any key to continue", 260, 25, font3, yellow)
        Font.Draw ("A TCMS Adventure...", sign1X, 500, font1, yellow)
        Font.Draw ("A TCMS Adventure...", sign2X, 100, font1, yellow)
        Font.Draw ("OBJECT", 350, 450, font2, yellow)
        Font.Draw ("Guide your character through a normal school day",
            250, 400, font3, yellow)
        Font.Draw ("at TCMS high school by making decisions", 250,
            380, font3, yellow)
        Font.Draw ("based on given scenarios.", 250, 360, font3, yellow)
        Font.Draw ("Press the EXIT button to stop the program, and then just close the window.", 250, 305, font3, yellow)
        Font.Draw ("This game is created by:", 250, 235, font3, yellow)
        Font.Draw ("Jaspreet Johal", 250, 170, font4, white)
        if sign1X <= 0 then
            signSwitch := true
        elsif sign1X >= 460 then
            signSwitch := false
        end if
        if signSwitch then
            sign1X += 1
            sign2X -= 1
        elsif signSwitch = false then
            sign1X -= 1
            sign2X += 1
        end if
        View.Update
        exit when hasch
        Time.Delay (5)
    end loop
end intro

procedure loadScreen
    colorback (white)
    cls
    for i : 0 .. 39
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div
            2) - (Font.Width ("You are being transported to TCMS...", text1) div
            2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
    delay (1000)
    for decreasing i : 39 .. 0
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div
            2) - (Font.Width ("You are being transported to TCMS...", text1) div
            2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
end loadScreen

procedure question1A
    locate (1, 1)
    Font.Draw ("Your courageous decision resulted in you getting in class 2 minutes early. Congrats!", 260, 175, font5, yellow)
end question1A

procedure question1B
    locate (1, 1)
    Font.Draw ("You ended up being 5 minutes late for class. :(", 260, 175, font5, yellow)
end question1B

procedure question1C
    locate (1, 1)
    Font.Draw ("There was a large van with elementary kids in the side entrance, and you were stuck behind it. You were 2 minutes late for Period 1.", 260, 175, font5, yellow)
end question1C

proc scene1
    View.Set ("nooffscreenonly")
    colorback (black)
    cls
    Font.Draw ("Welcome to Town Center Montessori Private Schools.", 260, 525, font5, yellow)
    Font.Draw ("Your father is currently trying to get into the parking lot, but it is jammed.", 260, 490, font5, yellow)
    Font.Draw ("You have about 5 minutes until your first periodclass so you are in a rush. ", 260, 455, font5, yellow)
    Font.Draw ("DO YOU:", 325, 360, font6, yellow)
    GUI.Show (button1A)
    GUI.Show (button1B)
    GUI.Show (button1C)
    GUI.Show (button1Next)
    GUI.Enable (button1A)
    GUI.Enable (button1B)
    GUI.Enable (button1C)
    GUI.Enable (button1Next)
    Font.Draw ("Press the NEXT SCREEN button to continue.", 260, 150, font5, yellow)
end scene1

procedure question2A
    locate (1, 1)
    Font.Draw ("Your courageous decision resulted in you getting in class 2 minutes early. Congrats!", 260, 175, font5, yellow)
end question2A

procedure question2B
    locate (1, 1)
    Font.Draw ("You ended up being 5 minutes late for class. :(", 260, 175, font5, yellow)
end question2B

procedure question2C
    locate (1, 1)
    Font.Draw ("There was a large van with elementary kids in the side entrance, and you were stuck behind it. You were 2 minutes late for Period 1.", 260, 175, font5, yellow)
end question2C

proc scene2
    View.Set ("nooffscreenonly")
    colorback (black)
    cls
    Font.Draw ("You are in your Period 1 Class.", 260, 525, font5, yellow)
    Font.Draw ("Your teacher asks you if you are ready for the surprise quiz.", 260, 490, font5, yellow)
    Font.Draw ("You forgot all about it, and now are screwed for the quiz. ", 260, 455, font5, yellow)
    Font.Draw ("DO YOU:", 325, 360, font6, yellow)
    GUI.Disable (button1A)
    GUI.Disable (button1B)
    GUI.Disable (button1C)
    GUI.Disable (button1Next)
    GUI.Hide (button1A)
    GUI.Hide (button1B)
    GUI.Hide (button1C)
    GUI.Hide (button1Next)
    GUI.Show (button2A)
    GUI.Show (button2B)
    GUI.Show (button2C)
    GUI.Show (button2Next)
    GUI.Enable (button2A)
    GUI.Enable (button2B)
    GUI.Enable (button2C)
    GUI.Enable (button2Next)
    Font.Draw ("Press the NEXT SCREEN button to continue.", 260, 150, font5, yellow)
end scene2

/* Main */

intro

loadScreen

button1A := GUI.CreateButton (300, 250, 250, "A) Jump out of the car.", question1A)
button1B := GUI.CreateButton (300, 225, 250, "B) Wait for your father to park.", question1B)
button1C := GUI.CreateButton (300, 200, 250, "C) Tell him to use the side entrance.", question1C)
button1Next := GUI.CreateButton (300, 100, 250, "Next Screen...", GUI.Quit)

scene1

loop
    exit when GUI.ProcessEvent
end loop

button2A := GUI.CreateButton (300, 250, 250, "A) Tell teacher you are ready, and choose random answers.", question2A)
button2B := GUI.CreateButton (300, 225, 250, "B) Ask teacher for an extension.", question2B)
button2C := GUI.CreateButton (300, 200, 250, "C) Tell teaher you are ready, and sit beside the smartest person, so you can copy answers.", question2C)
button2Next := GUI.CreateButton (300, 100, 250, "Next Screen...", GUI.Quit)

scene2

loop
    exit when GUI.ProcessEvent
end loop


Again, thanks so much for everything, MysticVegeta! Very Happy
goleafsgo123




PostPosted: Sun Jun 05, 2005 12:29 pm   Post subject: (No subject)

....anyone?
MysticVegeta




PostPosted: Sun Jun 05, 2005 1:33 pm   Post subject: (No subject)

code:

import GUI

var sign1X : int := 0
var sign2X : int := 480
var font1 : int := Font.New ("Verdana:40:bold")
var font2 : int := Font.New ("Courier New:20:bold")
var font3 : int := Font.New ("Courier New:10:bold")
var font4 : int := Font.New ("Comic Sans MS:30:bold")
var font5 : int := Font.New ("Tahoma:10:bold")
var font6 : int := Font.New ("Tahoma:50:bold")
var keyPressed : string (1)
var signSwitch : boolean := false
var clr : int := 218 % The color to assign to
var text1 : int := Font.New ("Times New Roman:18:Bold") % First Font
var button1A, button1B, button1C, button1Next, button2A, button2B,
    button2C, button2Next : int

View.Set ("graphics:1200;650")

View.Set ("offscreenonly")
View.Update

procedure intro
    loop
        colorback (black)
        Text.Cls
        Font.Draw ("Press any key to continue", 260, 25, font3, yellow)
        Font.Draw ("A TCMS Adventure...", sign1X, 500, font1, yellow)
        Font.Draw ("A TCMS Adventure...", sign2X, 100, font1, yellow)
        Font.Draw ("OBJECT", 350, 450, font2, yellow)
        Font.Draw ("Guide your character through a normal school day",
            250, 400, font3, yellow)
        Font.Draw ("at TCMS high school by making decisions", 250,
            380, font3, yellow)
        Font.Draw ("based on given scenarios.", 250, 360, font3, yellow)
        Font.Draw ("Press the EXIT button to stop the program, and then just close the window.", 250, 305, font3, yellow)
        Font.Draw ("This game is created by:", 250, 235, font3, yellow)
        Font.Draw ("Jaspreet Johal", 250, 170, font4, white)
        if sign1X <= 0 then
            signSwitch := true
        elsif sign1X >= 460 then
            signSwitch := false
        end if
        if signSwitch then
            sign1X += 1
            sign2X -= 1
        elsif signSwitch = false then
            sign1X -= 1
            sign2X += 1
        end if
        View.Update
        exit when hasch
        Time.Delay (5)
    end loop
end intro

procedure loadScreen
    colorback (white)
    cls
    for i : 0 .. 39
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div
            2) - (Font.Width ("You are being transported to TCMS...", text1) div
            2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
    delay (1000)
    for decreasing i : 39 .. 0
        RGB.SetColor (clr, 0, 0, i / 39)
        Font.Draw ("You are being transported to TCMS...", (maxx div
            2) - (Font.Width ("You are being transported to TCMS...", text1) div
            2), (maxy div 2) - 9, text1, clr)
        View.Update
        %delay (50)
    end for
end loadScreen

procedure question1A
    locate (1, 1)
    Font.Draw ("Your courageous decision resulted in you getting in class 2 minutes early. Congrats!", 260, 175, font5, yellow)
end question1A

procedure question1B
    locate (1, 1)
    Font.Draw ("You ended up being 5 minutes late for class. :(", 260, 175, font5, yellow)
end question1B

procedure question1C
    locate (1, 1)
    Font.Draw ("There was a large van with elementary kids in the side entrance, and you were stuck behind it. You were 2 minutes late for Period 1.", 260, 175, font5, yellow)
end question1C

proc scene1
    View.Set ("nooffscreenonly")
    colorback (black)
    cls
    Font.Draw ("Welcome to Town Center Montessori Private Schools.", 260, 525, font5, yellow)
    Font.Draw ("Your father is currently trying to get into the parking lot, but it is jammed.", 260, 490, font5, yellow)
    Font.Draw ("You have about 5 minutes until your first periodclass so you are in a rush. ", 260, 455, font5, yellow)
    Font.Draw ("DO YOU:", 325, 360, font6, yellow)
    GUI.Show (button1A)
    GUI.Show (button1B)
    GUI.Show (button1C)
    GUI.Show (button1Next)
    GUI.Enable (button1A)
    GUI.Enable (button1B)
    GUI.Enable (button1C)
    GUI.Enable (button1Next)
    Font.Draw ("Press the NEXT SCREEN button to continue.", 260, 150, font5, yellow)
end scene1

procedure question2A
    locate (1, 1)
    Font.Draw ("Your courageous decision resulted in you getting in class 2 minutes early. Congrats!", 260, 175, font5, yellow)
end question2A

procedure question2B
    locate (1, 1)
    Font.Draw ("You ended up being 5 minutes late for class. :(", 260, 175, font5, yellow)
end question2B

procedure question2C
    locate (1, 1)
    Font.Draw ("There was a large van with elementary kids in the side entrance, and you were stuck behind it. You were 2 minutes late for Period 1.", 260, 175, font5, yellow)
end question2C

proc scene2
    View.Set ("nooffscreenonly")
    colorback (black)
    cls
    Font.Draw ("You are in your Period 1 Class.", 260, 525, font5, yellow)
    Font.Draw ("Your teacher asks you if you are ready for the surprise quiz.", 260, 490, font5, yellow)
    Font.Draw ("You forgot all about it, and now are screwed for the quiz. ", 260, 455, font5, yellow)
    Font.Draw ("DO YOU:", 325, 360, font6, yellow)
    GUI.Disable (button1A)
    GUI.Disable (button1B)
    GUI.Disable (button1C)
    GUI.Disable (button1Next)
    GUI.Hide (button1A)
    GUI.Hide (button1B)
    GUI.Hide (button1C)
    GUI.Hide (button1Next)
    GUI.Show (button2A)
    GUI.Show (button2B)
    GUI.Show (button2C)
    GUI.Show (button2Next)
    GUI.Enable (button2A)
    GUI.Enable (button2B)
    GUI.Enable (button2C)
    GUI.Enable (button2Next)
    Font.Draw ("Press the NEXT SCREEN button to continue.", 260, 150, font5, yellow)
end scene2

/* Main */

intro
loadScreen

button1A := GUI.CreateButton (300, 250, 250, "A) Jump out of the car.", question1A)
button1B := GUI.CreateButton (300, 225, 250, "B) Wait for your father to park.", question1B)
button1C := GUI.CreateButton (300, 200, 250, "C) Tell him to use the side entrance.", question1C)
button1Next := GUI.CreateButton (300, 100, 250, "Next Screen...", scene2)
button2A := GUI.CreateButton (300, 250, 250, "A) Tell teacher you are ready, and choose random answers.", question2A)
button2B := GUI.CreateButton (300, 225, 250, "B) Ask teacher for an extension.", question2B)
button2C := GUI.CreateButton (300, 200, 250, "C) Tell teaher you are ready, and sit beside the smartest person, so you can copy answers.", question2C)
button2Next := GUI.CreateButton (300, 100, 250, "Next Screen...", GUI.Quit)

scene1

loop
    exit when GUI.ProcessEvent
end loop
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 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: