
-----------------------------------
KukuriChan
Tue Mar 16, 2004 9:14 am

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. :( If anybody can help me I'll be really happy.  



loop
    if Mouse.ButtonMoved ("up") then
        Mouse.ButtonWait ("down", x, y, buttonnumber, buttonupdown)
        if x >= 220 and x = 100 and y  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 = 100 and y  400 and y < 100 and y > 130 then
            return
        end if
        if x >= 420 and x = 100 and y  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"


-----------------------------------
McKenzie
Tue Mar 16, 2004 11:15 am


-----------------------------------
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
Tue Mar 16, 2004 11:15 am


-----------------------------------
First off, you might wanna check out my "Buttons for dummies", and get some purdy GUI ;) (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 ;)

-----------------------------------
KukuriChan
Tue Mar 16, 2004 11:22 am


-----------------------------------
K. I attached the file. 

Maybe making a GUI button is a good idea but isn't there another way to fix the problem?

-----------------------------------
Paul
Tue Mar 16, 2004 11:26 am


-----------------------------------
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
Tue Mar 16, 2004 11:28 am


-----------------------------------
Umm im not seeing something attached :/
and Paul, hes already made his own buttons ;) but for the way hes got it done, GUI is alot easier

-----------------------------------
Paul
Tue Mar 16, 2004 11:33 am


-----------------------------------
K, I see it now...
there are advantages with GUI buttons, but with your own buttons you can make them look however you want :D instead of the stupid grey stuff.

-----------------------------------
KukuriChan
Tue Mar 16, 2004 11:35 am


-----------------------------------
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
Tue Mar 16, 2004 11:39 am


-----------------------------------
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
Tue Mar 16, 2004 11:46 am


-----------------------------------
yeah, that's my problem. I don't want it to go straight to the instruction page.  ^^;;;

-----------------------------------
Paul
Tue Mar 16, 2004 11:50 am


-----------------------------------
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
Tue Mar 16, 2004 12:06 pm


-----------------------------------
can you attach the file for me Paul?  :)

-----------------------------------
McKenzie
Tue Mar 16, 2004 12:08 pm


-----------------------------------
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
Tue Mar 16, 2004 12:13 pm


-----------------------------------
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:

end for

end howtoplay
howtoplay

after

end for

end howtoplay

sorry :( 
yes on the flight.t , part of the reason that it won't work was

include "proc howtoplay.t"
include "N ame.t"%