Announcement

Collapse
No announcement yet.

Will someone please explain flags to me?????

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

  • Will someone please explain flags to me?????

    What's the go with flags, and why isn't there a design tip on it? I want to know what flags are, how, when, and where to use them. Can someone please tell me?

    ------------------
    http://www.alladvantage.com/home.asp?refid=HES908 - Click here if you want, I'm not spamming
    http://www.epipo.com/signup_form.asp?Ringo_Starr - Click here if you want, I'm not spamming.

    http://modasylum.cjb.net
    "And well might we say 'may God save the Queen because nothing will save the governor general'"
    Gough Whitlam - November 11 1975 on Parliament House steps.



  • #2
    I thought William Keenan was going to write something up about this.

    Seriously, we went over flags pretty well in a thread in this forum about a month ago. Search through a ways and you should be able to find it. If you still have questions after reading that, I'll try...

    Comment


    • #3
      well ... they're made of canvas and come in many colors ...

      Comment


      • #4
        Here is a excerpt from my upcoming tip on flags,
        Everyone is familiar with the decimal number system, the base ten number system we use every day. The decimal number system is composed of ten digits: 0; 1; 2; 3; 4; 5; 6; 7; 8; and 9.

        One digit in the decimal system can express ten different values, from 0 to 9.
        Two digits together can express one hundred values - from 00 to 99.

        Computers use the binary number system, the base two number system. The binary number system is composed of two digits: 0 and 1.

        One digit in the binary system can express two different values, from 0 to 1.
        Two digits together can express four values - 00, 01, 10, and 11.

        Q. What is a Flag?
        A. A flag is one binary digit.

        Q. Why call it a flag?
        A. It's a programmer lingo thing. It's on or off like a flag is up or down.

        Q. What is a Mask?
        A. A mask is two or more binary digits. 1100 is a mask made up of four flags.

        Q. Why call it a mask?
        A. Since programmers tend to hide behind their binary digits they decided to call them masks.
        Well, the truth is that the above is not an excerpt ... it is the entire work in progress. The small amount of progress have made on this paper is probably due to the fact that I find writing about binary digits slightly more exciting then poking myself in the eye.

        Comment


        • #5
          ummmmm guess I'll be checking the dummies version for this one..... Correct me If I'm wrong but my understanding of flags allows you to combine events in a game. Say I want a unit built when three cities have been conquered. City 1 will be called Rome, city 2 called Paris and 3 called Toronto.

          To begin creating this event I would start by turning on a flag.

          @IF
          CITYTAKEN
          city=Rome
          attacker=YOu
          defender=HIM
          @THEN
          TURNFLAG 000000001
          @ENDIF

          @IF
          CITYTAKEN
          city=Paris
          @THEN
          TURNFLAG 000000010
          @ENDIF

          @IF
          CITYTAKEN
          city=Toronto
          @THEN
          TURNFLAG 000000100
          @ENDIF

          Though this isn't in correct format in dealing with TOT, the picture is clear. It's been set up.

          The last part would be something like this.

          @IF
          FLAG
          000000111
          @THEN
          CREATEUNIT
          unit=Mario
          homeecity=?
          location
          11,33
          233,44
          ENDLOCATIONs
          @ENDIF


          SO binary thing. 0= OFF 1= ON

          Is this sorta right?

          I haven't tried it yet as TOT is off my system for now, working with FW scenario but is that right. Someone correct me If i'm wrong.... Thankx

          Civfan........
          Civfan (Warriorsoflight)

          Comment


          • #6
            You definately have the concept right Civfan. The syntax of the statements is off but the concept is correct.

            The correct syntax would be as follows

            @IF
            CITYTAKEN
            city=Rome
            attacker=YOU
            defender=HIM
            @THEN
            FLAG
            who=YOU
            state=On ; 0000000000000001
            flag=0 ; this flag turned ON ^
            @ENDIF

            @IF
            CITYTAKEN
            city=Paris
            attacker=YOU
            defender=HIM
            @THEN
            FLAG
            who=YOU
            state=On ; 0000000000000010
            flag=1 ;this flag turned ON ^
            @ENDIF

            @IF
            CITYTAKEN
            city=Toronto
            attacker=YOU
            defender=HIM
            @THEN
            FLAG
            who=YOU
            state=On ; 0000000000000100
            flag=2 ;this flag turned ON ^
            @ENDIF

            @IF
            CHECKFLAG
            Who=You
            Mask=0b0000000000000111
            Count=3
            State=On
            @THEN
            CREATEUNIT
            unit=Mario
            homecity=Civfanville
            LOCATIONS
            11,33
            233,44
            ENDLOCATIONS
            @ENDIF

            And, yes the binary thing. 0= OFF 1= ON
            also
            0 = False 1 = True
            0 = Clear 1 = Set

            In the begining of the mask you will see that there is a 0b in front of it. This tells the computer that the number after the 0b is binary. The 0b is required and is not part of the 32 digit number itself. The reason for this is because the computer will also except hexidecimal (0x) and octal (0o) number systems.

            Comment


            • #7
              Thanks guys. I hope to implement this in my upcoming title. I look forward to seeing the design tip :-)

              Comment


              • #8
                Thanks William for clearing that one up. One question though about the flags. It says theres 32 flags for each Civ (I think thats right) what does that mean? I know theres 16 binary digits in the flag and *2 =32 but does that mean I can use that example above, say for all 7 Civs? If 0000000000000111 was turned on, I can create a unit for each?

                Thanks..
                CIvfan....

                P.S. Wait a minute.... Just going over your comment again. "WHO=You" 00000000000000001
                means I can use each flag per civ right?
                So If I had something I like this.


                Turn on Flag
                WHO=Romans
                FLAG 0000000000000001
                would create a unit in Germany

                TURN oN FLAG
                WHO=Russsians
                FLag 0000000000000001
                Could give the Russians a new technology.

                is that right? 00000000000000001 FLAG if used can mean different things for each civs. If thats right, damn the possiblities are endless...... and would make this the best purchase I made since Warcraft II
                [This message has been edited by Civfan (edited December 17, 1999).]
                Civfan (Warriorsoflight)

                Comment


                • #9
                  Yes there are 32 flags for each civ and each flag is one binary digit. I did a shorthand above that has confused you, the mask should look like this:

                  @IF
                  CHECKFLAG
                  Who=You
                  Mask=0b00000000000000000000000000000111
                  Count=3
                  State=On
                  @THEN
                  CREATEUNIT
                  unit=Mario
                  homecity=Civfanville
                  LOCATIONS
                  11,33
                  233,44
                  ENDLOCATIONS
                  @ENDIF

                  with 32 positions. Because the first 16 were zeros I left them off, which is fine by the computer. Like the decimal number system leading zeros are not necessary, for example you could write the number one hundred like this 00000100, but we don't we just type 100. The same is true of binary.

                  Each civ has it's own set of 32 flags, including the barbarians. That means eight sets of 32 flags.

                  I agree with your closing remark
                  If thats right, damn the possiblities are endless ...... and would make this the best purchase I made since Warcraft II

                  Comment


                  • #10
                    ummmm searching here for that CD........... Found it..... installing now.... TOT is back on line..... Now thinking of what to create with so much possibilities..... another day though
                    Civfan (Warriorsoflight)

                    Comment

                    Working...
                    X