Announcement

Collapse
No announcement yet.

Calling William Keenan or John P - Need help with flag masks

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

  • Calling William Keenan or John P - Need help with flag masks

    ...or anybody, I'm not fussy.

    Please help.

    I am having difficulty with using flag masks. Note, just masks, not the individual flags. I have those sussed and having no problem with them. However, as soon as I use a mask - nothing happens. I have checked the report.txt produced by the event parser and it shows no errors. In fact the rest of the event actions fires fine, but the FLAG action used with a mask appears to do bugger all. Here is the event I am referring to:

    @IF
    UNITKILLED
    unit=Werewolf
    attacker=ANYBODY
    defender=Firetop Mountain
    @AND
    CHECKFLAG
    who=Firetop Mountain
    flag=2
    state=on
    @THEN
    TEXT
    Congratulations! you have killed the werewolf
    but something has heard you...
    ENDTEXT
    FLAG
    continuous
    who=Firetop Mountain
    mask=0b111111111111111111111111111111111
    state=off
    @ENDIF

    I know the event fires because I see the text, so I know thats not the problem.
    But the events that rely on the setting of all the flags back to off don't. (I am using the flags as a resettable counter).

    Any suggestions? 'cos I'm out. I can get round this by setting 32 individual flags but this takes up 32 events!!!!!!!!

    PS no errors in report.txt
    PPS have tried hex notation
    PPPS have patch
    PPPPS the event is from my upcoming scenario,
    the release date of which is slipping...

  • #2
    I haven't passed this one through the programmers to be sure, but...try it without the Continuous modifier.

    I wasn't as clear about this in the manual as I should have been, but where flags are concerned, Continuous is necessary to preserve an On state; as far as I can determine, it's unnecessary for the Off state, because that's what the flag reverts to at end of turn if there's no Continuous to prevent it.

    Comment


    • #3
      Thanks for that, back in 5.

      Comment


      • #4
        OK, just tried it without the continuous modifier. No joy. Exactly the same thing happens ie nothing. The event fires, I see the text, but the flags are definately not being set.

        As a matter of interest, I put in the following debug event to to fire when the flags are indeed all off:

        @IF
        CHECKFLAG
        who=Firetop Mountain
        mask=0b11111111111111111111111111111111
        state=off
        @THEN
        TEXT
        all flags off
        ENDTEXT
        @ENDIF

        Given the above circumstances, how often do you think this event would fire, considering that the flags do not appear to be reset?
        Just once - after INITFLAG does it's stuff.
        Well no - it actually fires every turn! It's firing on turns where I know at least one of the flags is set to on because there are other events firing because of flags being set to on! What gives?

        What am I doing wrong? anyone else have this trouble? As far I can see flags masks do not work - but I know they do because of the event structures in Midguard etc etc.

        Help me I am losing my mind!.!>!!>"()"&)(&"£

        Comment


        • #5
          Miner: The first thing I noticed was that your Mask had 33 bits, that is to say 33 ones in it. This will cause an overflow, which can cause unpredictable errors. Using hexadecimal notation (0hFFFFFFFF) tends to eliminate those kinds of errors.

          Fix your mask and try it again. If your file still does not work send me your events file.

          Comment


          • #6
            Agh! I should have counted! Good catch. That sure would do it.

            Comment


            • #7
              0b
              1:1
              1:2
              1:3
              1:4
              1:5
              1:6
              1:7
              1:8
              1:9
              1:10
              1:11
              1:12
              1:13
              1:14
              1:15
              1:16
              1:17
              1:18
              1:19
              1:20
              1:21
              1:22
              1:23
              1:24
              1:25
              1:26
              1:27
              1:28
              1:29
              1:30
              1:31
              1:32

              Are you sure?! I just copied & pasted from my prior post, which is itself copied & pasted from events.txt. I only count 32.

              Oh well, I'm off to try knocking one off.

              I will also try the hex notation you gave, although I have already tried hex. Back in 10...

              Comment


              • #8
                Still no joy. I knocked off a 1, and events did compile but the end result is the same.

                I tried the hex notation you gave, but it didn't like the 0h, it wants 0x so the EPD gave an error.

                So I put hex notation back in and it still doesn't work, although it compiles.

                When I put in my 32*1 string, the EPD recognises it as being mask 0xffffffff because it translates it in report.txt. But it still won't work! So, Mr Keenan, events.txt is on it's way to you.

                Comment


                • #9
                  OK YOUR NOT GONNA BELIEVE THIS

                  I got it to work!!!!!!!!!!!!!!!!!!!

                  But I think I have discovered a bug in the flags. I was just in the process of sending the events to Mr Keenan when I tried something else.

                  Instead of setting the mask in the above event, I did this instead:

                  @IF
                  UNITKILLED
                  unit=Werewolf
                  attacker=ANYBODY
                  defender=Firetop Mountain
                  @AND
                  CHECKFLAG
                  who=Firetop Mountain
                  flag=2
                  state=on
                  @THEN
                  TEXT
                  Congratulations! you have killed the werewolf
                  but something has heard you...
                  ENDTEXT
                  GIVETECHNOLOGY
                  technology=88
                  receiver=Firetop Mountain
                  @ENDIF

                  coupled with

                  @IF
                  RECEIVEDTECHNOLOGY
                  receiver=Firetop Mountain
                  technology=88
                  @THEN
                  FLAG
                  who=Firetop Mountain
                  state=off
                  mask=0xffffffff
                  TAKETECHNOLOGY
                  whom=Firetop Mountain
                  technology=88
                  TEXT
                  victory all flags should now be off
                  ENDTEXT
                  @ENDIF

                  A bit long winded perhaps, but worth a try.
                  And guess what? it works, the following events that rely on the flags being reset do now work!

                  I conclude that there is somekind of bug in the events. Be warned.

                  Comment


                  • #10
                    I'm tempted to think that it's a bad interaction between checking flags in the trigger and setting flags in the action.

                    Waitaminute...(leafing through manual)....aha!

                    Page 213, under Flag and CheckFlag: "The flag and mask parameters are mutually exclusive; you can only use one or the other in any single event." (bold added).

                    Notice that it doesn't say "in any one trigger or action". That's the problem; you can't mix flag and mask parameters in the same event, no matter where in the event they are. So the "flag=2" in your trigger and the "mask..." in your action cannot coexist.

                    Comment


                    • #11
                      Nice try John! But Mick's example from the Midgard scenario contradicts your theory.

                      @IF
                      CHECKFLAG
                      WHO=EVERYBODY
                      mask=0x00180000
                      count=2
                      state=on
                      @THEN
                      JUSTONCE
                      DELAYPERFLAG
                      randomize
                      basedelay=50
                      perflagdelay=20
                      mask=0x000003FF
                      TEXT
                      Yet another weakening of Volsang's magical bonds occurs; all of the races
                      begin to exhibit real fear now. Can anyone stop Volsang before he breaks
                      completely free?
                      ENDTEXT
                      CHANGETERRAIN
                      terraintype=9
                      map=0
                      exceptionmask=0x0620
                      maprect
                      44,98,86,98,86,152,44,152
                      PLAYAVIFILE
                      Scene9b.avi
                      FLAG
                      continuous
                      flag=21
                      state=on
                      @ENDIF

                      Comment


                      • #12
                        Hmm...sure seems to. That Mick, always showing me up.

                        Comment


                        • #13
                          The moral of this story is:

                          quote:


                          don't believe what you read, even if you wrote it


                          [This message has been edited by William Keenan (edited February 16, 2000).]

                          Comment


                          • #14
                            For those reading this entertaining thread but who have wisely not posted, WK is now examining the original events.txt to check my logic and ensure that there really is a bug and that I haven't just posted this nonsense for nothing.

                            Comment

                            Working...
                            X