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.

Dark GDK / return confusions

Author
Message
chan
12
Years of Service
User Offline
Joined: 14th Nov 2011
Location:
Posted: 22nd Nov 2011 10:04
i made a test if im doing a "return" right, but its obviously i didnt, here is the codes.

main


return


so here what i wanted to do is, whenever i press space, the phase will return 1 (1 is the default). and whenever i click mouse it will return 2.

but what happened is it is continuously changing from one phase to another whenever i click or press.

so confused. i was trying to solve it myself but took me hours already and don't want to waste time.

-Excellence deals with weak people-
Orac
17
Years of Service
User Offline
Joined: 16th May 2006
Location: Billingham
Posted: 22nd Nov 2011 13:22
You have defined your function open_phase() to return a value int open_phase(phase) but if neither condition is satisfied you are not returning anything. You should modify it to something like:


Also in your main function when you call open_phase() you are not assigning the return value to anything. You should do something like:


Of all the things I've lost .. I miss my marbles most of all.
Orac
17
Years of Service
User Offline
Joined: 16th May 2006
Location: Billingham
Posted: 22nd Nov 2011 13:24
I just noticed that the HTML tags don't appear to work inside a code snippet, just ignore the bold/endbold tags.

Of all the things I've lost .. I miss my marbles most of all.
chan
12
Years of Service
User Offline
Joined: 14th Nov 2011
Location:
Posted: 22nd Nov 2011 13:33
thanks for the help!

it works now.

-Excellence deals with weak people-
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 22nd Nov 2011 16:15
Or even cleaner:



JTK

Login to post a reply

Server time is: 2024-04-26 17:15:18
Your offset time is: 2024-04-26 17:15:18