7 Replies Latest reply on May 16, 2007 1:11 PM by Itico

    Dynamic Menu

      Hello everyone, I'm back at it again. I've been away for a while. I'm working on a new talking game. I would like a dynamic text menu in the game that changes depending on the status of the game and so on.

      I was trying to create a string for the menu but when displayed ENTER just added a high-level character to the string and it didn't do what I wanted. :)

      I'm just having block I suppose since I haven't done this in a while.

        • 1. Re: Dynamic Menu
          Applied CD Level 1
          Hmmm ... maybe it's just me but I'm not exactly following what you're trying to do. Do you want a drop down menu with items that change on the fly? A set of buttons whose labels change? Some more detail might help.
          • 2. Re: Dynamic Menu
            Itico Level 1
            Hello there!

            What I'm trying to do is a screen menu that the user clicks on or presses a letter on the keyboard. Continue (If game in progress), New Game, Load Game, Save Game (If game in progress) and so on.

            I want the menu to be readable by screen readers and/or easily converted to speech via SAPI.

            I've been playing with lists, but having issues converting it to text. I've been out doing 3D modelling to much!

            Does that help?


            William D. Hascall
            Misty Media
            • 3. Re: Dynamic Menu
              Applied CD Level 1
              Lol, that helps but I’m afraid I don’t know what the requirements are for the screen readers or SAPI … if all it takes is a string that you can send to SAPI for speech conversion it shouldn’t be too hard to get the string.

              A down and dirty method would be to loop through all sprites and assemble the string using the text property of text sprites and the member name for bitmaps (you’d have to name your members to make sense when spoken), when you get to the last sprite send the string to SAPI

              A much more elegant method would be a behavior that stores the speech text equivalent for each sprite in a property variable; the behavior would return that text string when called either by a key press event (ie, user initiated) or when polled by another handler (lingo initiated). Changing the speech text on the fly shouldn’t be any problem, for example if a sprite contained the score just read the text property of the member into the speech text variable. If you want to read the entire screen just call all sprites and concatenate the strings returned from each … if you want a menu item to announce it has changed without reading the entire screen the handler causing the change could send the speech text.
              • 4. Re: Dynamic Menu
                Itico Level 1
                Yes, to activate SAPI, you just send it a string. What I wanted to do was to make the menu a string too, or a list, that would appear like a menu. I might do the sprite concept later. I would like to get this working for now just to get the thing working. Here is the menu code as I have it now:

                -> Start Lingo
                global gameInProgress

                on formMainMenu
                menuList = []
                if (gameInProgress) then
                appendLine = "C: Continue Game"
                appendLine = "N: New Game"
                end if
                appendLine = "L: Load Game"
                if (gameInProgress) then
                appendLine = "S: Save Game"
                end if
                appendLine = "O: Options"
                appendLine = "A: About and Credits"
                appendLine = "Q: Quit"
                member("Main Menu Display Text").text = menuList
                member("Main Menu Spoken Text").text = menuList
                end formMainMenu
                <- Stop Lingo

                This, of course, crashed on me. I tried using value() too which gave me the same error. Thought I read somewhere that something like this could work.

                If I have to break the menu up into elements and concatinate them, then, I guess I wll.

                Thanks for the help!
                • 5. Re: Dynamic Menu
                  Applied CD Level 1
                  Yeah, you can can’t automatically convert a list of strings to a simple string but it’s not hard to write a function to do it for you. Try this:

                  Change the member lines to this:

                  Member(“Main Menu Display Text “).text = list2string(menuList)
                  Member(“Main Menu Spoken Text “).text = list2string(menuList)

                  Then put the following script in a MOVIE script. This function simply loops through the strings in your list and returns the fully concatenated string:

                  • 6. Re: Dynamic Menu
                    Applied CD Level 1
                    This would be better, it will prevent the leading space:

                    • 7. Re: Dynamic Menu
                      Itico Level 1
                      Thank you very much for your help. I believe that this will greatly help me.