Recently I found a line of code within a program that struck me completely and I wonder if it is possible...


Code:

randInt(0,1
If ans=1:"Text here->Str1  ;"Text here" is like some random text
If ans=0:"Text here->Str1
Menu(" "+Str1+" Blah","Possible?",1,"Impossible",0


I think that every time the program runs, on top of the menu, the text or name or phrase changes...

Is this possible?....Still it shocks me, yet i have never seen it in any other programs...
I think it's possible, but I'm not sure if it'll allow you to join the strings within the menu statements. I know you can pass string variables to it [Menu(], so it'll work, just maybe not as you wrote it.
Nice find, Quinn. In the past, I've used that to make dynamic menus. For text RPGs, you can display how much money the player has in the menu header, and different items can be displayed each time. The only thing is that the labels to be jumped to need to catch the fact that menu options change periodically, since those labels remain static.

I don't recall ad hoc concatenations causing problems with Menu(...
Yeah you can use it in menu's directly, though I would use the sub command rather than adding tons of if then statements before it. for example


Code:

:randint(0,1)
:Menu("",sub("impossible  ",2Ans+1, 10),A


however for dynamic menus I would definately use my own menu code rather than the menu( function because that way I could have more than 7 elements, and add cool things like animations, live searching and the ability to use keys like clear,del,mode to cancel etc... I mean if you're going to make a central, dynamic menu you might as well make it as awesome as you can...
Agreed, I'd go with a dynamic menu module for a bigger project. For some of my very small arcade games though, it's not really worth it, so I'd just go with the built-in menu for that.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement