Jump to content

Msgbox flag system?


 Share

Recommended Posts

I want to implement a type of system like the function msgbox's first parameter has, where you add up what options you want and it displays it for you. I was wondering what that is called, and/or a link to how to use it.

Or perhaps you guys might have a better idea on how to do what I would like to accomplish.

I have a 2d array that is my game map and it holds what is on each tile (grass, road, building, vehicle(s), and so forth). At the moment, without a system to inturrpret the number, I can only have 1 item on each tile. I don't plan on having hundreds of items on each tile but more then 1 definitely.

Edit: Think I'll just use a 3d array.

Edited by GSM
Link to comment
Share on other sites

Those are bit masked values. Enum makes them easy to manage.

Global Enum Step *2 $GRASS, $ROAD, $BUILDING
Local $aGrid[4][4]

; Populate Grid with Random Data
For $iX = 0 To 3
    For $iY = 0 To 3
        $aGrid[$iX][$iY] = Random(0, 8, 1)
    Next
Next

; Read Grid
For $iX = 0 To 3
    For $iY = 0 To 3
        If BitAND($aGrid[$iX][$iY], $GRASS) Then ConsoleWrite("G")
        If BitAND($aGrid[$iX][$iY], $ROAD) Then ConsoleWrite("R")
        If BitAND($aGrid[$iX][$iY], $BUILDING) Then ConsoleWrite("B")
        ConsoleWrite(@TAB)
    Next
    ConsoleWrite(@CRLF)
Next

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...