Announcement

Collapse
No announcement yet.

Help with CyInterface().addMessage(), please

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

  • #16
    I haven't the foggiest what eType is supposed to represent.

    I did try 1, 2, and 3. Couldn't detect a difference between them, so I went with 1.

    Thanks for the advice on the icons. That's exactly what I was looking for.

    Now I have hooked this all up to rezaf's Tree Nursery mod, and now get a nice notification that the Tree Nursery has matured.

    CyInterface().addMessage(CyGame().getActivePlayer( ),True,25,'A tree nursery has matured into a Forest!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),iX,iY,True,True)

    Thanks for all the help!

    Comment


    • #17
      Just a tip: you might want to use something like " gc.getInfoTypeForString("COLOR_GREEN") ", rather than use the absolute value of 8, just in case the enum gets updated in the future

      Comment


      • #18
        Originally posted by Calanor
        Just a tip: you might want to use something like " gc.getInfoTypeForString("COLOR_GREEN") ", rather than use the absolute value of 8, just in case the enum gets updated in the future
        Ahh, yes. If only that worked.

        gc.getInfoTypeForString("COLOR_GREEN") doesn't work.

        Nor does ColorTypes.COLOR_GREEN (which I really thought would work).

        So I went with the literal. If anyone can show me how to use the Enum properly, I'd appreciate it.

        Comment


        • #19
          Hmm, it works fine here. Did you cast the result?

          Here's the relevant part in the enslavement (hehe) code I am writing:

          Code:
                              iColor = gc.getInfoTypeForString("COLOR_PLAYER_DARK_YELLOW")
                              CyInterface().addMessage(playerX.getID(), True, 10, msg, 'AS2D_UNITGIFTED', 1, 'Art/interface/buttons/civics/Slavery.dds', ColorTypes(iColor), pLoser.getX(), pLoser.getY(), True, True)
          I suppose that it's obvious that "gc" is "CyGlobalContext()", but I better mention it anyway.

          I did try ColorTypes.XXX as well before you posted the correct syntax here - much like you, I am a bit surprised that it I had to cast an integer for it to work

          Comment


          • #20
            Originally posted by HawaiiFive-O
            I haven't the foggiest what eType is supposed to represent.

            I did try 1, 2, and 3. Couldn't detect a difference between them, so I went with 1.

            Thanks for the advice on the icons. That's exactly what I was looking for.

            Now I have hooked this all up to rezaf's Tree Nursery mod, and now get a nice notification that the Tree Nursery has matured.

            CyInterface().addMessage(CyGame().getActivePlayer( ),True,25,'A tree nursery has matured into a Forest!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),iX,iY,True,True)

            Thanks for all the help!
            Sweet, I was trying to do the same thing and even posted a thread about it, but it failed to garner any replies. Mind if I included this in the mod download for others to enjoy?
            _____
            rezaf

            Check out my Forest planting mod or my Terrain adaption mod

            Comment


            • #21
              Originally posted by Calanor
              Hmm, it works fine here. Did you cast the result?

              Here's the relevant part in the enslavement (hehe) code I am writing:

              Code:
                                  iColor = gc.getInfoTypeForString("COLOR_PLAYER_DARK_YELLOW")
                                  CyInterface().addMessage(playerX.getID(), True, 10, msg, 'AS2D_UNITGIFTED', 1, 'Art/interface/buttons/civics/Slavery.dds', ColorTypes(iColor), pLoser.getX(), pLoser.getY(), True, True)
              I suppose that it's obvious that "gc" is "CyGlobalContext()", but I better mention it anyway.

              I did try ColorTypes.XXX as well before you posted the correct syntax here - much like you, I am a bit surprised that it I had to cast an integer for it to work
              I was using it inline on the addMessage call. I didn't try to explicitly cast it, like you did.

              Thanks for the advice, I think I'll follow your example in the future. The code's a little more readable that way, too.

              Comment


              • #22
                Originally posted by rezaf


                Sweet, I was trying to do the same thing and even posted a thread about it, but it failed to garner any replies. Mind if I included this in the mod download for others to enjoy?
                Of course, feel free.

                Comment


                • #23
                  eType=0 echoes the message to the event log, while eType=1 does not. 2 and 3 also echo, FWIW.

                  Comment


                  • #24
                    Originally posted by eotinb
                    eType=0 echoes the message to the event log, while eType=1 does not. 2 and 3 also echo, FWIW.
                    Ah, good to know! Thanks!

                    Comment


                    • #25
                      A revision to what I know about eType:
                      0: puts the message in the event log temporarily (~10 turns I think, but I didn't count)
                      1: does not echo message to turn log at all
                      2: message permanently added to event log

                      No idea what the point of eType=0 is, other than to frustrate me until I figured out what was going on.

                      Comment


                      • #26
                        heh!

                        Good work getting to the bottom of eType. Much appreciated.

                        Comment


                        • #27
                          Originally posted by eotinb
                          A revision to what I know about eType:
                          0: puts the message in the event log temporarily (~10 turns I think, but I didn't count)
                          1: does not echo message to turn log at all
                          2: message permanently added to event log

                          No idea what the point of eType=0 is, other than to frustrate me until I figured out what was going on.
                          I think the idéa of the eType=0 option is that the event wont show up in the game history that you can play after the game have ended. If you spam the evenlog with to mutch permanet events this "playback" will get a lot of useless information.

                          Comment

                          Working...
                          X