Computer Science Canada

Can anyone help me with this problem?

Author:  135280 [ Thu Jun 05, 2008 11:40 am ]
Post subject:  Can anyone help me with this problem?

I am working on a final project for school and am wondering if anyone knows how to fix this
var font1, font2, font3, font4 : int := 0

var winID1 : int

%welcome screen%
font1 := Font.New ("serif:72")
font2 := Font.New ("serif:12")
Font.Draw ("Pizza Pizza", 75, 250, font1, red)
var Xm, Ym, click : int := 0
loop
mousewhere (Xm, Ym, click)
%drawfillbox (100,50,30,30,black)
Font.Draw ("menu", 50, 30, font2, red)
View.Update

mousewhere (Xm, Ym, click)
%drawfillbox (550,50,585,30,black)
Font.Draw ("order", 550, 30, font2, red)
View.Update

if Xm >= 100 and Xm <= 50 and Ym >= 30 and Ym <= 30 and click = 1 then

elsif Xm >= 100 and Xm <= 50 and Ym >= 30 and Ym <= 30 and click = 1 then
cls


I am trying to get the menu and order tobecome buttons that i can click but it will not alow me to do so if anyone can help me
I would apprecaite it emnsly

Author:  jeffgreco13 [ Thu Jun 05, 2008 11:49 am ]
Post subject:  Re: Can anyone help me with this problem?

135280 wrote:

var font1, font2, font3, font4 int = 0

var winID1 int

%welcome screen%
font1 = Font.New ("serif72")
font2 = Font.New ("serif12")
Font.Draw ("Pizza Pizza", 75, 250, font1, red)
var Xm, Ym, click int = 0
loop
mousewhere (Xm, Ym, click)
%drawfillbox (100,50,30,30,black)
Font.Draw ("menu", 50, 30, font2, red)
View.Update

mousewhere (Xm, Ym, click)
%drawfillbox (550,50,585,30,black)
Font.Draw ("order", 550, 30, font2, red)
View.Update

if Xm >= 100 and Xm <= 50 and Ym >= 30 and Ym <= 30 and click = 1 then

elsif Xm >= 100 and Xm <= 50 and Ym >= 30 and Ym <= 30 and click = 1 then
cls


I am trying to get the menu and order tobecome buttons that i can click but it will not alow me to do so if anyone can help me
I would apprecaite it emnsly


K first things first. BAD SUBJECT. Do not put "help me please" in the subject you have to put something descriptive. and another thing use syntax tags, if u dont know how search it on the forums.

Anywho lets concentrate on this...
Turing:

if Xm >= 100 and Xm <= 50 and Ym >= 30 and Ym <= 30 and click = 1 then


How can Xm be both greater or equal to 100, AND less tahn or equal to 50?

Try adjusting that to maybe greater than 50 and less than 100
this of course applies to Ym, and the next if statement in your code as well. Your logic is incorrect.

Author:  isaiahk9 [ Thu Jun 05, 2008 12:29 pm ]
Post subject:  RE:Can anyone help me with this problem?

@135280 - you should fix the title of this post to something like "Buttons not responding". If I didn't say it, someone else would've.
jeffgreco13 is right.

Author:  Reality Check [ Thu Jun 05, 2008 12:42 pm ]
Post subject:  Re: Can anyone help me with this problem?

jeff is right about both the logic being incorrect and bad title. It'll never enter your if statement. Also, I noticed your elseif statement is the exact same as the if statement. If it doesn't go through the first time, it won't go through the second...

Also, PLEASE use code tags and post your code with proper indenting. It just makes it easier for us to read.


: