View unanswered posts | View active topics It is currently Tue Nov 12, 2019 8:26 pm






Reply to topic  [ 4 posts ] 
Return fSuccess? 
Author Message
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
Post Return fSuccess?
Hi, I was looking at posts on the forum about robotc menus and found this post :http://www.robotc.net/forums/viewtopic.php?p=16077
In the menu code void MenuAddChoice it is a bool. I was experimenting with the code as I was wanting to learn how it works and I am not sure what the fSuccess is for but if I remove it it gives a lot of errors. So I was just wondering what it did?

_________________
Thanks!


Tue Jan 06, 2015 12:08 am
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post Re: Return fSuccess?
The variable fSuccess simply stores if you've exceeded the maximum number of menu options or not. If you have, it is false. If you have not, it is true. This value is then returned out of the function. When you say you commented it out, do you mean just the variable declaration, or all of its uses in the function? Did you also comment out the return line? If so, did you change the function's return type to void instead of bool?

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Tue Jan 06, 2015 12:44 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Post Re: Return fSuccess?
The menu.h module allows you to create a menu with a "Title" and then add a number of choices to that menu. Then it allows the user to press the gray arrow buttons on the NXT brick to scroll up and down those choices. Then you can press the orange button to select the choice. The value of the selected choice will be returned to the caller of MenuGetChoice. You can use this menu module to create multiple level of menus. For example, in this year's FTC game, we created the top level "Strategies" menu with 6 different strategies. When the user picked a strategy, that strategy may have other "choices". Then we create another menu for those choices. For example, one of the strategies we have is to run down the ramp, grab the rolling goal, put the balls into it. Then it is an option to drag the rolling goal to the parking zone. After putting the rolling goal to the parking zone, it is another option to find the kick stand and knock it down. So after presenting the "Strategies" choice menu, if the user picks "Score rolling goal" (i.e. run down the ramp and put the balls into the rolling goal), then it pop up another menu asking whether the user wants to push the rolling goal into the parking zone. Then it also pop up a third menu asking if the user wants to knock down the kickstand afterwards.


Tue Jan 06, 2015 1:38 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Post Re: Return fSuccess?
Here is an example of how the menu module works.
https://www.youtube.com/watch?v=R3-2054IrQs


Thu Jan 08, 2015 4:14 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.