Random Options Inlinks Browse Raw Live Wayback Source Home Archives: pcmedia27
http://www.corel.com/clickandcreate/tips/tip11.htm (PC Media Número 27, 1997-02-17)

[Navigation Bar]

Corel Click & Create

Tip 11 - About Fixed & Alterable Values and Flags

Active Objects are the intelligent components of an application. Active objects have a simple form of memory that allows for the storage of a series of numbers or values. If an object has been cloned, each clone possesses a separate set of values and flags.

There are two types of values to choose from. Fixed values are set to a random value at the start of an application. These values can be read using the Retrieve fixed value function. Fixed values cannot be changed for the duration of an application. Alterable values can be changed at any time, using a series of Set, Add, or Subtract actions. Alterable values are identified using the letters A, B, or C. Fixed and Alterable values can range from the numbers -2000,000,000 to +2000,000,000. They must however, be whole numbers. Fractions such as 5.1, or 10.7 cannot be used.

In addition to the values, each Active Object has a set of thirty-two different Flags, which are numbered between 0 and 31. Flags are used to store ON or OFF values. The meaning of the flag depends on the application. Here are a few examples of what flags can be used for:

  • A door object can be open or shut
  • A card can be dealt or unused
  • An object can be dropped or carried
  • A character can be good or bad

In each case, one of these possibilities would be represented by an ON value, and the other by OFF. You could be set these possibilities using events, and test their contents to choose between the different options in the application. So, a door flag could be ON or OFF. If it was ON, you could let the player select it with the mouse and move to a new location. If it was OFF, you could display a message such as "Can't open door". The player could then "unlock" the door using a key, which could be programmed using Set action to switch the flag to ON.

Flags can be read, tested, or changed at any point in an application. They can be read with the Test Flag function, tested with the Is a flag on? and Is a flag off? conditions, and changed using Set Flag On, Set Flag Off, and Toggle actions.

[Click here for
previous tip][Click here
for next tip]

SEARCH

Click & Create

 


created with Corel WEB.DESIGNEROther useful links:
|
Copyright Information |