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

Username:   Password: 
 RegisterRegister   
 Nothing after cls again?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
yeyavailability




PostPosted: Thu Jun 05, 2008 8:36 pm   Post subject: Nothing after cls again?

Below is the code I'm using to make music selection boxes.

Turing:


% Picture of a fake checkbox
procedure nextpage_tutorial ()
    next := Pic.FileNew ("no_check.bmp")
    Pic.SetTransparentColor (next, white)
    Pic.Draw (next, 15, 18, picCopy)
    Font.Draw ("Go next when you have understood 90% of this information.", 37, 21, F_verdanaN, black)
    Pic.Free (next)
end nextpage_tutorial

%Activates checkmark to go to selected page
procedure click (x1, x2, y1, y2, button, chk1, chk2 : int)
    var mx, my, mb : int
    loop
        Mouse.Where (mx, my, mb)
        if mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = button
                then
            checkmark (chk1, chk2)
            delay (200)
            cls
        end if
        exit when mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = button %Declare end loop conditions
    end loop
end click

%Allows user to select music tracks - checkmark activation
procedure selecttrack_click (x1, x2, y1, y2 : int)
    var mx, my, mb : int
    loop
        Mouse.Where (mx, my, mb)
        if mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = 1
                then
            drawfillbox (8, 468, 12, 472, black) %Creates selection
            drawfillbox (93, 468, 97, 472, white) %From here onward--clears other selections
            drawfillbox (178, 468, 182, 472, white)
            drawfillbox (263, 468, 267, 472, white)
            drawfillbox (348, 468, 352, 472, white)
            drawfillbox (433, 468, 437, 472, white)
            fork music1
        elsif mx >= x1 + 85 and mx <= y1 + 85 and my >= x2 and my <= y2 and mb = 1
                then
            drawfillbox (93, 468, 97, 472, black) %Creates selection
            drawfillbox (8, 468, 12, 472, white) %From here onward--clears other selections
            drawfillbox (178, 468, 182, 472, white)
            drawfillbox (263, 468, 267, 472, white)
            drawfillbox (348, 468, 352, 472, white)
            drawfillbox (433, 468, 437, 472, white)
            fork music2
        elsif mx >= x1 + 170 and mx <= y1 + 170 and my >= x2 and my <= y2 and mb = 1
                then
            drawfillbox (178, 468, 182, 472, black) %Creates selection
            drawfillbox (8, 468, 12, 472, white) %From here onward--clears other selections
            drawfillbox (93, 468, 97, 472, white)
            drawfillbox (263, 468, 267, 472, white)
            drawfillbox (348, 468, 352, 472, white)
            drawfillbox (433, 468, 437, 472, white)
            fork music3
        elsif mx >= x1 + 255 and mx <= y1 + 255 and my >= x2 and my <= y2 and mb = 1
                then
            drawfillbox (263, 468, 267, 472, black) %Creates selection
            drawfillbox (93, 468, 97, 472, white) %From here onward--clears other selections
            drawfillbox (178, 468, 182, 472, white)
            drawfillbox (8, 468, 12, 472, white)
            drawfillbox (348, 468, 352, 472, white)
            drawfillbox (433, 468, 437, 472, white)
            fork music4
        elsif mx >= x1 + 340 and mx <= y1 + 340 and my >= x2 and my <= y2 and mb = 1
                then
            drawfillbox (348, 468, 352, 472, black) %Creates selection
            drawfillbox (93, 468, 97, 472, white) %From here onward--clears other selections
            drawfillbox (178, 468, 182, 472, white)
            drawfillbox (263, 468, 267, 472, white)
            drawfillbox (8, 468, 12, 472, white)
            drawfillbox (433, 468, 437, 472, white)
            fork music5
        elsif mx >= x1 + 425 and mx <= y1 + 425 and my >= x2 and my <= y2 and mb = 1
                then
            drawfillbox (433, 468, 437, 472, black) %Creates selection
            drawfillbox (93, 468, 97, 472, white) %From here onward--clears other selections
            drawfillbox (178, 468, 182, 472, white)
            drawfillbox (263, 468, 267, 472, white)
            drawfillbox (8, 468, 12, 472, white)
            drawfillbox (348, 468, 352, 472, white)
            Music.PlayFileStop
        end if
        exit when mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = 1 or %Declare end loop conditions
            mx >= x1 + 85 and mx <= y1 + 85 and my >= x2 and my <= y2 and mb = 1 or
            mx >= x1 + 170 and mx <= y1 + 170 and my >= x2 and my <= y2 and mb = 1 or
            mx >= x1 + 255 and mx <= y1 + 255 and my >= x2 and my <= y2 and mb = 1 or
            mx >= x1 + 340 and mx <= y1 + 340 and my >= x2 and my <= y2 and mb = 1 or
            mx >= x1 + 425 and mx <= y1 + 425 and my >= x2 and my <= y2 and mb = 1
    end loop
end selecttrack_click

%Allows user to select music tracks - The checkboxes
procedure selecttrack_boxes
    % Track 1
    drawfillbox (5, 465, 15, 475, black)
    drawfillbox (6, 466, 14, 474, white)
    Font.Draw ("Track 1", 25, 466, F_verdanaNS, black)
    % Track 2
    drawfillbox (90, 465, 100, 475, black)
    drawfillbox (91, 466, 99, 474, white)
    Font.Draw ("Track 2", 110, 466, F_verdanaNS, black)
    % Track 3
    drawfillbox (175, 465, 185, 475, black)
    drawfillbox (176, 466, 184, 474, white)
    Font.Draw ("Track 3", 195, 466, F_verdanaNS, black)
    % Track 4
    drawfillbox (260, 465, 270, 475, black)
    drawfillbox (261, 466, 269, 474, white)
    Font.Draw ("Track 4", 280, 466, F_verdanaNS, black)
    % Track 5
    drawfillbox (345, 465, 355, 475, black)
    drawfillbox (346, 466, 354, 474, white)
    Font.Draw ("Track 5", 365, 466, F_verdanaNS, black)
    % End all Music
    drawfillbox (430, 465, 440, 475, black)
    drawfillbox (431, 466, 439, 474, white)
    Font.Draw ("Stop Music", 450, 466, F_verdanaNS, black)
end selecttrack_boxes

%Allows user to access both the slide and the tracks at the same time
procedure tutorial_optionselect (x1, x2, y1, y2 : int)
    selecttrack_boxes %Music (selection)
    nextpage_tutorial
    var mx, my, mb : int
    loop
        Mouse.Where (mx, my, mb)
        if mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 85 and mx <= y1 + 85 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 170 and mx <= y1 + 170 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 255 and mx <= y1 + 255 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 340 and mx <= y1 + 340 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 425 and mx <= y1 + 425 and my >= x2 and my <= y2 and mb = 1
                then
            selecttrack_click (5, 465, 15, 475)
        elsif mx >= 15 and mx <= 32 and my >= 13 and my <= 30 and mb = 1
                then
            click (15, 13, 32, 30, 1, 8, 11)
            exit when mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = 1 or %Declare end loop conditions
                mx >= x1 + 85 and mx <= y1 + 85 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 170 and mx <= y1 + 170 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 255 and mx <= y1 + 255 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 340 and mx <= y1 + 340 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 425 and mx <= y1 + 425 and my >= x2 and my <= y2 and mb = 1 or
                mx >= 15 and mx <= 13 and my >= 32 and my <= 30 and mb = 1
        end if
    end loop
end tutorial_optionselect

% Allows user to operate on both procedures without completing the one or the other first
procedure quiz_optionselect (x1, x2, y1, y2 : int)
    selecttrack_boxes %Music (selection)
    var mx, my, mb : int
    loop
        Mouse.Where (mx, my, mb)
        if mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 85 and mx <= y1 + 85 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 170 and mx <= y1 + 170 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 255 and mx <= y1 + 255 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 340 and mx <= y1 + 340 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 425 and mx <= y1 + 425 and my >= x2 and my <= y2 and mb = 1
                then
            selecttrack_click (5, 465, 15, 475)
        elsif mx >= 15 and mx <= 32 and my >= 13 and my <= 30 and mb = 1
                then
            click (15, 13, 32, 30, 1, 8, 11)
            exit when mx >= x1 and mx <= y1 and my >= x2 and my <= y2 and mb = 1 or %Declare end loop conditions
                mx >= x1 + 85 and mx <= y1 + 85 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 170 and mx <= y1 + 170 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 255 and mx <= y1 + 255 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 340 and mx <= y1 + 340 and my >= x2 and my <= y2 and mb = 1 or
                mx >= x1 + 425 and mx <= y1 + 425 and my >= x2 and my <= y2 and mb = 1 or
                mx >= 15 and mx <= 13 and my >= 32 and my <= 30 and mb = 1
        end if
    end loop
end quiz_optionselect



For example, I am on slide 1. I want to go to slide 2 after clicking a box.

Turing:


procedure slide_2
put "ugh"
end slide_2

procedure slide_1
put "blah"
tutorial_optionselect (5, 465, 15, 475) % Selects music and goes to the next page
slide_2 % Destination of next page
end slide_1



The problem is that when I click the checkbox, it goes into a blank screen. When I had this problem before, it was because I'd forgotten the exit when function to end the loop. I'm sure that I've put every possible way to end the loop in that situation.

Once when I'd deleted tutorial_optionselect from the slide procedure, it functioned like normal and was able to successfully go to the next slide. I don't understand what is blocking it from doing so with tutorial_optionselect.

Code of a slide that works, without the music selection:

Turing:


procedure slide_2
put "ugh"
end slide_2

procedure slide_1
put "blah"
nextpage_tutorial %Creates the checkbox
click (15, 13, 32, 30, 1, 8, 11) %Activates the checkmark
slide_2 % Destination of next page
end slide_1



I may be blind, but blind it is that disables me from seeing problems with the first code. I need to use the music selection procedure. Thankyou if you can tell me what's wrong.
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Fri Jun 06, 2008 6:24 am   Post subject: Re: Nothing after cls again?

When you switch a slide, you are using the checkbox. You need an if statement to determine if the mouse location is on that box, and if a button is pressed. Then it would call up the procedure you need.
yeyavailability




PostPosted: Fri Jun 06, 2008 7:05 am   Post subject: Re: Nothing after cls again?

Apparently I messed two coordinates of the last exit when, so this is resolved now. Thankyou to anyone who helped!
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  [ 3 Posts ]
Jump to:   


Style:  
Search: