Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Program won't run when I click compile

Author
Message
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 13th Feb 2011 00:03 Edited at: 13th Feb 2011 00:03
Hi my program won't run when I hit compile. It doesn't say that there is a syntax error either. It just doesn't load up.

This is the complete code so far:
[/code]
GoSub SetUp
GoSub MainMenu
//*****MainMenu*****
MainMenu:
Do
CLS
Print MouseX()
Print MouseY()
Center Text Screen Width()/2,50,"Main Menu"
Center Text Screen Width()/2,150,"Start!"
Center Text Screen Width()/2,200,"Options!"
Center Text Screen Width()/2,250,"Quit!"
Center Text Screen Width()/2,400,"Created by Jeremy Lyda"
If MouseX()>=295 And MouseY()>=151 And MouseX()<=342 And MouseY()<=160 And Mouseclick()=1 And MouseCheck=0 Then GoSub MainLoop
If MouseX()>=295 And MouseY()>=151 And MouseX()<=342 And MouseY()<=160 Then Center Text Screen Width()/2,165,"Start the game"
If MouseX()>=287 And MouseY()>=201 And MouseX()<=350 And MouseY()<=212 And MouseClick()=1 And MouseCheck=0 Then GoSub Options
If MouseX()>=287 And MouseY()>=201 And MouseX()<=350 And MouseY()<=212 Then Center Text Screen Width()/2,215,"Change difficulty,Name,and view high scores"
If MouseX()>=299 And MouseY()>=251 And MouseX()<=338 And MouseY()<=261 And MouseClick()=1 And MouseCheck()=0 Then End
If MouseX()>=299 And MouseY()>=251 And MouseX()<=338 And MouseY()<=261 Then Center Text Screen Width()/2,265,"Exits the game"
Loop
//******************

//*****MainLoop*****
MainLoop:
Do

Loop
//******************

//*****Subroutines*****
SetUp:
If MouseCheck=0 and MouseClick()=1 Then MouseCheck=1
If MouseCheck=1 Then MouseClick()=0
If MouseClick()=1 And MouseCheck=0 Then MouseClick()=1
If MouseClick()=0 Then MouseCheck=0
Return

Options:
CLS
Center Text Screen Width()/2,50,"Options!"
Wait Key
Return

//*********************


It works until I put in these two If statements:

If MouseX()>=299 And MouseY()>=251 And MouseX()<=338 And MouseY()<=261 And MouseClick()=1 And MouseCheck()=0 Then End
If MouseX()>=299 And MouseY()>=251 And MouseX()<=338 And MouseY()<=261 Then Center Text Screen Width()/2,265,"Exits the game"[code]
I'm not sure what's wrong.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Feb 2011 02:55
Code snips are like this:

[ code ]
Your code here.
[ /code ]

Just remove the spaces between the brackets and you see this:


The problem is you use "MouseCheck()=0" when it should be "MouseCheck=0" without the parenthesis.



BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 13th Feb 2011 03:45
....I can't believe I missed that thank you. I looked over that line atleast 20 times lol.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Feb 2011 08:19
Np.

It's easy to make that mistake since MOUSECLICK() and MouseCheck are similar. I'd swap the words to make CheckMouse instead or CMouse.

Login to post a reply

Server time is: 2024-11-23 03:17:27
Your offset time is: 2024-11-23 03:17:27