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

Username:   Password: 
 RegisterRegister   
 Problem with Window
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
KukuriChan




PostPosted: Tue Mar 16, 2004 9:14 am   Post subject: Problem with Window

I'm suppose to be doing a dice game during this break but there's something wrong with my program. See, I have a problem with my code. When you choose the play button, it loads the screen instantly but then it goes right to the procedure that tells you how to play and then goes to the next procedure. How do you make it so that the procedure is only active when you choose it? I tried putting it in the conditional loop but there was an error when I did that. Sad If anybody can help me I'll be really happy.


code:

loop
    if Mouse.ButtonMoved ("up") then
        Mouse.ButtonWait ("down", x, y, buttonnumber, buttonupdown)
        if x >= 220 and x <= 300 and y >= 100 and y <= 130 then
            delay (300)
            cls
            Pic.ScreenLoad ("chess-game-carpet600.jpg", 0, 0, picXor)
            exit
        elsif x < 220 and x > 300 and y < 100 and y > 130 then
            return     % goes back to the beginning if out of range of button
        end if
        if x >= 320 and x <= 400 and y >= 100 and y <= 130 then
            exit
        elsif x < 320 and x > 400 and y < 100 and y > 130 then
            return
        end if
        if x >= 420 and x <= 500 and y >= 100 and y <= 130 then
            delay (400)
            Window.Select (helpWindow)
        elsif x < 420 and x > 500 and y < 100 and y < 130 then
            return
        end if
    end if
end loop

drawfillbox (maxx, 0, 600, maxy, grey)
Font.Draw ("Menu", 550, 600, button, 0)
include "proc howtoplay.t"
include "N ame.t"
Sponsor
Sponsor
Sponsor
sponsor
McKenzie




PostPosted: Tue Mar 16, 2004 11:15 am   Post subject: (No subject)

Don't want to be harsh but this sounds more like a riddle than a question.
1. Please give a good topic name ("Trouble with dice game" - the Massey crowd knows what that means)
2. Zip ALL of the files you are using and attach them.
3. Include more comments in your code to indicate what you think is going on.
recneps




PostPosted: Tue Mar 16, 2004 11:15 am   Post subject: (No subject)

First off, you might wanna check out my "Buttons for dummies", and get some purdy GUI Wink (its in tutorial Section) and all you gotta do, is assign the procedure to the button, so say you click "How to play" then itll load the procedure on how to play. and so on and so on for em all.

Edit: Heres my Buttons For Dummies http://www.compsci.ca/v2/viewtopic.php?t=3583

and damn, Mckenzies fast Wink
KukuriChan




PostPosted: Tue Mar 16, 2004 11:22 am   Post subject: (No subject)

K. I attached the file.

Maybe making a GUI button is a good idea but isn't there another way to fix the problem?



Flight.zip
 Description:

Download
 Filename:  Flight.zip
 Filesize:  114.3 KB
 Downloaded:  67 Time(s)


Flight.zip
 Description:
Click on Flight.t to see the actual program.

Download
 Filename:  Flight.zip
 Filesize:  114.3 KB
 Downloaded:  95 Time(s)

Paul




PostPosted: Tue Mar 16, 2004 11:26 am   Post subject: (No subject)

I don't see the file.
As for the GUI buttons, if you want to use them, go ahead. But I usually make my own buttons, cause my teacher says, turing is a learning language where you make everything from scratch, if you wanna do fancy GUI stuff, go learn VB.
recneps




PostPosted: Tue Mar 16, 2004 11:28 am   Post subject: (No subject)

Umm im not seeing something attached :/
and Paul, hes already made his own buttons Wink but for the way hes got it done, GUI is alot easier
Paul




PostPosted: Tue Mar 16, 2004 11:33 am   Post subject: (No subject)

K, I see it now...
there are advantages with GUI buttons, but with your own buttons you can make them look however you want Very Happy instead of the stupid grey stuff.
KukuriChan




PostPosted: Tue Mar 16, 2004 11:35 am   Post subject: (No subject)

I attached it...twice accidentally. Oops.


I've used GUI buttons before but they weren't that good. I mean it's good for having separate procedures but other than that, I didn't know how to use it so that once you click on one button, you can activate another button too. GUI's have a lot of limits.
Paul




PostPosted: Tue Mar 16, 2004 11:39 am   Post subject: (No subject)

Ok I dunno, I don't have much experience with it, but it only ran on my computer after I took out "import GUI" on N ame.t, b4 that it just said syntax error there. Maybe I shouldn't have done it, but I didn't even see a play button... it just went straight to the instructions.
Hehe I use to play this game when I was a kid,
"shuo ming" your saying instructions? like instruction book is "shuo ming shu"?
KukuriChan




PostPosted: Tue Mar 16, 2004 11:46 am   Post subject: (No subject)

yeah, that's my problem. I don't want it to go straight to the instruction page. ^^;;;
Paul




PostPosted: Tue Mar 16, 2004 11:50 am   Post subject: (No subject)

oh I see on the bottom of howtoplay.t you called howtoplay proc, so when you include it, maybe it calls it automatically? so if you take out "howtoplay" at the bottom of the file, it wont run automatically, so in my inexperience, I would itake out the calling of the procedure at the end of the howtoplay.t and then include the file first, then call it with a if/ gui whatever. I took it out, and it didn't go to help file automatically, though its still kinda messed. But at least the quit button and the chart at the bottom left works now...

[edit] I was messing around with it, and at the title screen, after I took out the calling of the help file procedure at the end of the help file, it just automatically goes to the n ame.t file, without letting you choose buttons, I moved the "include n ame.t" somewhere else, I dunno where you want it, and now all the buttons at the beginning works.

If you press play, it goes to the pic, if you press quit, it quits, and if you press help, it goes to help file.

Heres all the changes I made:
1. at the end of howtoplay.t, I took out "howtoplay"
2. moved the "include n ame.t" somewhere else (after the button clicking part)
I might be totally wrong at doing this, but eh, the buttons work for me now.
KukuriChan




PostPosted: Tue Mar 16, 2004 12:06 pm   Post subject: (No subject)

can you attach the file for me Paul? Smile
McKenzie




PostPosted: Tue Mar 16, 2004 12:08 pm   Post subject: (No subject)

Paul is right. The call at the bottom of how to play was a problem, and you need to look at the overall organization before you continue. You have a mish-mash of code that is going to become harder and harder to modify.
Because you are trying to mix GUI with non-GUI you will run into a few problems e.g. The GUI proceseEvent loop at the bottom of your name code takes control of the program until you click quit, then you have a chance to click play.
Paul




PostPosted: Tue Mar 16, 2004 12:13 pm   Post subject: (No subject)

Well since I dunno what your thoughts are, I dunno how to modify it. And I have no experience with GUI. If you want it...
this is at the bottom of the howtoplay.t
before:
code:

end for

end howtoplay
howtoplay

after
code:

end for

end howtoplay

sorry Sad
yes on the flight.t , part of the reason that it won't work was
code:

include "proc howtoplay.t"
include "N ame.t"%<--I dunno, this was interfering somehow.

after:
code:

include "proc howtoplay.t"
%include "N ame.t"%%<---moved to whereever you want, I dunno where.
KukuriChan




PostPosted: Tue Mar 16, 2004 12:14 pm   Post subject: (No subject)

So, if I took out the GUI button and switch the code around, it should solve my problems?
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  [ 25 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: