Announcement

Collapse
No announcement yet.

Help with CyInterface().addMessage(), please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with CyInterface().addMessage(), please

    OK, I'm going batty trying to make this work.

    Here's the Python API reference, FWIW.

    VOID addMessage(INT ePlayer, BOOL bForce, INT iLength, STRING szString, STRING szSound, INT eType, STRING szIcon, ColorType eFlashColor, INT iFlashX, INT iFlashY, BOOL bShowOffScreenArrows, BOOL bShowOnScreenArrows)

    Displays an on-screen message


    I think I'm getting hung up on the parameters:

    STRING szSound
    and
    INT eType
    and
    STRING szIcon

    because I have no idea what my choices are. Where are the constant references?

    Regardless, what I really want is someone to post an example that works. I can monkey it from there.

    Any help? Thanks in advance.

  • #2
    I have the same problem.

    It seems like the first szString argument is a tuple however.

    Comment


    • #3
      One thing you guys could try is to use empty arguments, like "" for strings and 0 for ints.

      -Martin
      Civ2 military advisor: "No complaints, Sir!"

      Comment


      • #4
        Originally posted by Martin Gühmann
        One thing you guys could try is to use empty arguments, like "" for strings and 0 for ints.

        -Martin
        It throws an exception, sadly.

        I also can't seem to get ColorTypes.COLOR_RED to work, but that's probably me not importing the right thing. Playing with that now, but fixing that won't help with the other things.

        Comment


        • #5
          Where are you seeing that you are getting an exception? I've been working with this function as well and seems I'm even more in the dark than you are. For szSound try "AS2D_DISCOVERBONUS" -- that is a known valid argument to CyAudioGame().Play2DSound() and since it's the sound played when a new resource message is displayed, it should work fine with this function. Look in Assets\XML\Audio for more options.

          But there must be some way to pass empty arguments for both szSound and szIcon because the game generates messages that have neither sounds nor icons.

          Comment


          • #6
            You can try using () as a blank argument. I've seen that in a few of their python files. It may be the python equivalent of null.

            Comment


            • #7
              Originally posted by eotinb
              Where are you seeing that you are getting an exception? I've been working with this function as well and seems I'm even more in the dark than you are. For szSound try "AS2D_DISCOVERBONUS" -- that is a known valid argument to CyAudioGame().Play2DSound() and since it's the sound played when a new resource message is displayed, it should work fine with this function. Look in Assets\XML\Audio for more options.

              But there must be some way to pass empty arguments for both szSound and szIcon because the game generates messages that have neither sounds nor icons.
              Have you turned on your Python debug messages in the _Civ4Config file?

              ; Set to 1 for no python exception popups
              HidePythonExceptions = 0

              I'm going to try that sound string, thanks!

              Comment


              • #8
                I still have problem with the first szString. The documentations says that addMessage have addMessage(INT , BOOL, INT, STRING, STRING, INT, STRING, ColorType, INT, INT, BOOL, BOOL) as argument but the debugger says following:
                Code:
                addMessage(class CyInterface {lvalue}, int, bool, int, class std::basic_string,class std::allocator >, char const *, int, char const *, enum ColorTypes, int, int, bool, bool)
                Im begining to det desperate here..

                Edit: I must use the code tag so the forum would show the debugger code correct

                Edit2: This forum are still removing some of the code the debugger shows
                Last edited by Hernadir; November 13, 2005, 19:47.

                Comment


                • #9
                  Originally posted by Andrew1999
                  You can try using () as a blank argument. I've seen that in a few of their python files. It may be the python equivalent of null.
                  I gave it a try, no dice.

                  Thanks for the idea, though.

                  I'll keep trying until I get it working.

                  Comment


                  • #10
                    Holy crap, I just got it working.

                    Try this:

                    CyInterface().addMessage(CyGame().getActivePlayer( ),True,25,'Message string here','AS2D_DISCOVERBONUS',1,'',ColorTypes(1),iX,i Y,True,True)

                    I'm going to play with it some more.

                    Comment


                    • #11
                      Okey got it to work now and i found that i was doing wrong. I used gc.getInfoTypeForString("COLOR_WHITE") to get the color but that didt work. Using direct reference to the color works.

                      Thanks for the help all

                      Comment


                      • #12
                        What are you using for your icon?

                        I'm not happy with the default 'Black Exclamation' point.

                        Comment


                        • #13
                          Try None. That's the standard Python "blank argument" value.

                          Comment


                          • #14
                            I see you are using 1 for eType. Any idea what this actually represents?

                            Also, if you change the last two to false, I suspect the icon will never appear (assuming the icon is what appears in the arrow)

                            Comment


                            • #15
                              Good job! To use an icon, use the path to the "button" you wish to use. For instance, " 'Art/Interface/Buttons/TerrainFeatures/Forest.dds' " would show the icon used when forests expand.

                              As for eType, I am curious about that as well - I guess some experimentation might reveal something, now that things are actually working, though.

                              Comment

                              Working...
                              X