The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.

Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old May 29th, 2013, 02:51 AM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Flags, Vars, and Script Tiles

This subject has received more questions and caused more confusion than just about everything else in hacking combined, and we still don't have a guide for it. So, I'm making one. My goal here is to never have to answer another question about these again. So, here we go:

Flags

So, let's begin with flags. Flags are simple: they can be turned on and turned off and are used for the purpose of showing progression of events. Most are used to tell if an event has taken place or not. Fairly simple. However, many flags have special purposes which is what I am going to show you now.

A man named DavidJCobb did some very nice research for us in going through FireRed's engine and scripts and noting every single flag he saw and what it did. So, here is the flag section from his list:

Quote:
Originally Posted by DavidJCobb View Post
Out of boredom, I dug through every single script and OW in a clean FireRed BPRE ROM and wrote down every single flag and variable I could find. My findings are below, and include OW-visibility flags, item ownership flags, and more. (Not trainer or world map flags, though.)

Summarized flag findings:
Flags 0x000 - 0x006, at minimum, are temporary flags and are directly manipulated by the game engine.

Flags 0x011 - 0x01F are used to control the visibility of destructible OWs, i.e. Rock Smash boulders. They are probably cleared by the game engine every time a map is loaded, as no level scripts clear them. Do not use them on standard OWs.

Flag 0x266 appears to be directly manipulated by the game engine. If set, there is an EGG waiting for you in the Four Island Daycare Center. It is unset manually by scripts if you choose to discard the egg.

The game does not use checkitem to see if you have an item; instead, Game Freak scripts will always check for flags that were set as part of the event sequence that gave you the item (or it may even check for the OW-visibility flags if it was a pickup). E.x. the game uses "checkflag 0x271" after manually setting it, not "checkitem ITEM_BICYCLE 0x1".

A similar thing is done with badges. The "champ-in-making" guy that always chills next to a Gym statue doesn't check badge flags directly; there are eight flags (4B0-4B7) that are set along with those flags, which he checks. Redundant...

Not all of the listed OW-visibility flags are set/cleared directly. Most of them correspond to Person IDs in AMap, and are indirectly altered when one uses "hidesprite" on the Persons (referring to them by Person event number rather than ID).

Notable flags:
Flags 0x011 - 0x01F are used to control the visibility of destructible OWs.

Flag 0x266 is set by the game engine if an Egg is in the Daycare.

Flags 0x4B0 - 0x4B7 affect the "champ-in-making" guy's dialogue in Gyms.

Flags 0x4B8 - 0x4BC are set if the player has beaten {whoever} in the Elite Four during their current attempt at it. They're cleared upon entering the Hall of Fame registration room.

Flags 0x500 - 0x700 are trainer flags.

Flags 0x820 - 0x827 are read directly by the game engine and determine Badge acquisition. But we already knew this.

Flag 0x82D is set if you customize your profile by talking to some woman in some PokeCenter. Apparently directly set by the game engine.

If Flag 0x834 is set, then the player knows the name of Bill's PC (as opposed to "Someone's" PC). Don't know if this affects the PC menu, but it affects dialogue shown when receiving a Pokemon and having it sent to the PC.

Flag 0x842 may have something to do with wireless functionality or some minigame. It's checked after healing at a PokeCenter.

Flag 0x844 is set when Celio connects to Lanette -- IOW when you can trade with R/S/E. Don't mistake it for the E4 completion flag like I almost did.

Flag 0x849 is set when you solve the Tanoby Key.

If Flags 0x84A and 0x84B are cleared, the Vermilion City dockworker won't even bother checking for the MysticTicket and AuroraTicket, respectively. You won't be able to use them. I don't know what sets or clears these flags.

Flags 0x890 - 0x8FD are world map flags.

Flags 0x900 and up overlap the RAM used for script variables and hence ARE NOT SAFE TO USE.


Full findings:
Spoiler:
Some of the flags and variables are set by a script that runs once at the start of the game. This script is called by the game engine itself, and shall be referred to as "game start script" in the notes below.

Code:
LIST OF IDENTIFIED IN-GAME FLAGS (FIRERED)

002        Apparent temporary flag.
003        Apparent temporary flag.
004        Apparent temporary flag.
005        Apparent temporary flag.
006        Apparent temporary flag.
011        Used for a CUT tree in VIRIDIAN CITY.
        Used for ROCK SMASH boulders in KINDLE ROAD and ROCK TUNNEL (1.82).
012        Used for CUT trees in
            VIRIDIAN,PEWTER,VERMILION,FUCHSIA;
            2+3 ISLES;
            RTS 8,9,10,12,13,14,16,25;
            BOND BRIDGE, FIVE ISLE MEADOW;
            BERRY FOREST;
            ERIKA's Gym
        Used for ROCK SMASH boulders in
            FOUR ISLAND;
            SEVAULT CANYON;
            CERULEAN CAVE (1.72, 1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.97,99,103,104,105,106,107,108)
013        Used for CUT trees in
            CERULEAN CITY, CELADON CITY, FUCHSIA CITY;
            RTS 1, 8, 10, 14;
            BOND BRIDGE, FIVE ISLE MEADOW;
            BERRY FOREST;
            ERIKA's Gym
        Used for ROCK SMASH boulders in
            KINDLE ROAD, SEVAULT CANYON;
            CERULEAN CAVE (1.72, 1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.97,99,103,104,105,106,108)
014        Used for CUT trees in
            CELADON CITY, FUCHSIA CITY;
            ROUTE 1, ROUTE 10, ROUTE 14;
            BERRY FOREST;
            ERIKA's Gym
        Used for ROCK SMASH boulders in
            CERULEAN CAVE (1.72, 1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.97, 1.99, 1.103, 1.104, 1.105, 1.106)
015        Used for CUT trees in FUCHSIA CITY, ROUTE 1, ROUTE 10, and BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, SEVAULT CANYON;
            CERULEAN CAVE (1.72, 1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.97, 1.99, 1.103, 1.104, 1.105, 1.106)
016        Used for CUT trees in ROUTE 1 and BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, SEVAULT CANYON;
            CERULEAN CAVE (1.72, 1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.97, 1.99, 1.103, 1.106)
017        Used for a CUT tree in BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, SEVAULT CANYON;
            CERULEAN CAVE (1.72, 1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.97, 1.99, 1.106)
018        Used for a CUT tree in BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, CERULEAN CAVE (1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.99)
019        Used for a CUT tree in BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, CERULEAN CAVE (1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.99)
01A        Used for a CUT tree in BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, CERULEAN CAVE (1.73, 1.74), ROCK TUNNEL (1.82), MT. EMBER (1.99)
01B        Used for a CUT tree in BERRY FOREST.
        Used for ROCK SMASH boulders in
            KINDLE ROAD, SEVAULT CANYON;
            CERULEAN CAVE (1.73), ROCK TUNNEL (1.82)
01C        Used for ROCK SMASH boulders in KINDLE ROAD and ROCK TUNNEL (1.82).
01D        Used for ROCK SMASH boulders in KINDLE ROAD and ROCK TUNNEL (1.82).
01E        Used for ROCK SMASH boulders in KINDLE ROAD and ROCK TUNNEL (1.82).
01F        Used for ROCK SMASH boulders in KINDLE ROAD and ROCK TUNNEL (1.82).
028        Controls visibility of the BULBASAUR BALL OW in OAK's Lab.
029        Controls visibility of the CHARMANDER BALL OW in OAK's Lab.
02A        Controls visibility of the SQUIRTLE BALL OW in OAK's Lab.
02B        Controls visibility of the OAK OW in OAK's Lab (PALLET TOWN (4.3)).
            Set by GAME START SCRIPT.
            Cleared after the "Don't go out yet!" OAK Script event.
02C        Controls visibility of the OAK OW in PALLET TOWN (3.0).
            Set by GAME START SCRIPT.
            Set after the wild-battle-with-OAK Script event.
            Set after OAK welcomes the player back to PALLET TOWN (level script).
02D        Controls visibility of GARY's OW in OAK's Lab (PALLET TOWN (4.3)).
02E        Controls visibility of the "You Must Battle Brock" guy in PEWTER CITY.
            Cleared after he escorts you to the Gym.
02F        Controls visibility of DOME FOSSIL OW in MT. MOON (1.3).
            Cleared if you enter MT. MOON (1.3) while 232 is cleared.
030        Controls visibility of HELIX FOSSIL OW in MT. MOON (1.3).
            Cleared if you enter MT. MOON (1.3) while 232 is cleared.
031        Controls visibility of the NUGGET BRIDGE prize-giver OW in ROUTE 24.
            Set after BILL gives the player the S.S. ANNE TICKET.
032        Controls visibility of BILL's mutant OW in his cottage (ROUTE 25 (30.0)).
033        Controls visibility of BILL's OW in his cottage (ROUTE 25 (30.0)).
            Set by GAME START SCRIPT.
            Cleared when the player helps BILL turn back into a human being.
034        Controls visibility of MR. FUJI's OW in POKeMON TOWER (1.94).
035        Controls visibility of MR. FUJI's OW in LAVENDER TOWN (8.2).
            Set by GAME START SCRIPT.
            Cleared after talking to MR. FUJI in POKeMON TOWER.
036        Controls visibility of an item OW in ROCKET HIDEOUT (1.45).
            Set by GAME START SCRIPT.
037        Controls visibility of the item OW (SILPH SCOPE) in ROCKET HIDEOUT (1.45).
            Set by GAME START SCRIPT.
            Cleared after beating GIOVANNI for the first time.
038        Controls visibility of GIOVANNI's OW in ROCKET HIDEOUT (1.45).
039        Controls visibility of the TOWN MAP OW in Daisy's house (PALLET TOWN (4.2)).
03A        Controls visibility of the POKEDEX OWs in OAK's Lab (PALLET TOWN (4.3)).
03B        Controls visibility of the TEAM ROCKET GRUNT OW in CERULEAN CITY.
03C        Controls visibility of the Rival OW in CERULEAN CITY.
            Set by GAME START SCRIPT.
03D        Controls visibility of the Rival OW in S.S. ANNE (1.6).
            Set by GAME START SCRIPT.
            Set every time you enter LAVENDER TOWN.
03E        Controls visibility of the TEAM ROCKET GRUNT OWs in SAFFRON CITY.
            Set after beating TEAM ROCKET at SILPH CO.
03F        Controls visibility of the civilian OWs in SAFFRON CITY and the receptionist OW in SILPH CO. (1.47).
            Set by GAME START SCRIPT.
            Cleared after beating TEAM ROCKET at SILPH CO.
040        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.83).
041        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.83).
042        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.84).
043        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.84).
044        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.85).
045        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.85).
046        Controls visibility of a current-blocking STRENGTH boulder in SEAFOAM ISLANDS (1.86).
047        Controls visibility of a current-blocking STRENGTH boulder in SEAFOAM ISLANDS (1.86).
048        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.86).
049        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.86).
04A        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.86).
04B        Controls visibility of a STRENGTH boulder in SEAFOAM ISLANDS (1.86).
04C        Controls visibility of a current-blocking STRENGTH boulder in SEAFOAM ISLANDS (1.87).
04D        Controls visibility of a current-blocking STRENGTH boulder in SEAFOAM ISLANDS (1.87).
04E        Controls visibility of Gary's OW in SILPH CO. (1.53).
04F        Controls visibility of Gary's OW in ROUTE 22.
            Set by GAME START SCRIPT.
050        Unknown. Cleared after an NPC escorts you to the MUSEUM in PEWTER CITY.
051        Controls visibility of Gary's OW in POKeMON TOWER (1.89).
052        Controls visibility of the MOLTRES OW in MT. EMBER (1.101).
            Cleared if the player enters the map while 2BD is unset (MOLTRES not fainted/0x5'd).
053        Controls visibility of TEAM ROCKET GRUNT OWs in SILPH CO., and of GIOVANNI's OW in SILPH CO..
054        Controls visibility of the SNORLAX OW on ROUTE 12.
            Set immediately before the battle with the SNORLAX on ROUTE 12.
055        Controls visibility of GIOVANNI's OW in VIRIDIAN CITY's Gym.
057        Controls visibility of the EEVEE BALL OW in CELADON CITY (10.11).
058        Controls visibility of a STRENGTH boulder in VICTORY ROAD (1.40).
059        Controls visibility of a STRENGTH boulder in VICTORY ROAD (1.41).
05A        Controls visibility of OAK's OW in POKeMON LEAGUE (1.79).
            Set by GAME START SCRIPT.
05B        Controls visibility of a TEAM ROCKET GRUNT OW in the GAME CORNER.
05C        Controls visibility of the OW that blocks access to CERULEAN CAVE.
            Set after finishing the CELIO/RUBY/SAPPHIRE subplot.
05D        Controls visibility of the ZAPDOS OW in POWER PLANT (1.95).
05E        Controls visibility of a TEAM ROCKET GRUNT in POKeMON TOWER (1.94).
05F        Controls visibility of the TEAM ROCKET GRUNT OWs in CELADON CITY.
        Controls visibility of the SILPH CO. employee OW in CELADON CITY.
            Set after beating GIOVANNI for the first time, in the hideout beneath the GAME CORNER.
060        Controls visibility of the HITMONLEE BALL OW in the FIGHTING DOJO (SAFFRON CITY (14.2)).
061        Controls visibility of the HITMONCHAN BALL OW in the FIGHTING DOJO (SAFFRON CITY (14.2)).
062        Controls visibility of BILL's OW in CINNABAR ISLAND.
            Set by GAME START SCRIPT.
            Cleared after beating CINNABAR ISLAND Gym Leader BLAINE, and after encountering BILL in the CINNABAR 
            ISLAND PokeCenter.
063        Controls visibility of a Player OW in the Union Room (0.4).
064        Controls visibility of a Player OW in the Union Room (0.4).
065        Controls visibility of a Player OW in the Union Room (0.4).
066        Controls visibility of a Player OW in the Union Room (0.4).
067        Controls visibility of a Player OW in the Union Room (0.4).
068        Controls visibility of a Player OW in the Union Room (0.4).
069        Controls visibility of a Player OW in the Union Room (0.4).
06A        Controls visibility of a Player OW in the Union Room (0.4).
06B        Controls visibility of the SEAGALLOP Ferry OW in CINNABAR ISLAND.
            Set by GAME START SCRIPT.
06C        Controls visibility of an OW in SAFFRON's fan club. He responds to your TRAINER CARD stickers.
            Set by GAME START SCRIPT.
06D        Controls visibility of an OW in SAFFRON's fan club. He responds to your TRAINER CARD stickers.
            Set by GAME START SCRIPT.
06E        Controls visibility of an OW in SAFFRON's fan club. She responds to your TRAINER CARD stickers.
            Set by GAME START SCRIPT.
06F        Controls visibility of an OW in SAFFRON's fan club. She responds to your TRAINER CARD stickers.
            Set by GAME START SCRIPT.
070        Controls visibility of green-suit OW in the second floor of all PokeCenters.
            Altered by the Pokemon Center 2F level scripts.
071        Controls visibility of BILL's OW in ONE ISLAND.
072        Controls visibility of BILL's OW in ONE ISLAND's PokeCenter.
073        Controls visibility of CELIO's OW in ONE ISLAND's PokeCenter.
074        Controls visibility of a Biker OW in TWO ISLAND's GAME CORNER.
            Set by GAME START SCRIPT.
075        Controls visibility of LOSTELLE's OW in TWO ISLAND's GAME CORNER.
            Set by GAME START SCRIPT.
076        Controls visibility of LOSTELLE's OW in her home in THREE ISLAND (THREE ISLAND (34.0)).
            Set by GAME START SCRIPT.
079        Controls visibility of Biker OWs in THREE ISLAND and THREE ISLE PORT.
07A        Controls visibility of LOSTELLE's OW in BERRY FOREST.
07B        Controls visibility of a shopper OW in TWO ISLAND.
            Set by GAME START SCRIPT.
            Cleared when the TWO ISLAND shopkeeper hears about Lostelle. (TWO ISLAND level script.)
07C        Controls visibility of a BRUNO-rumor-telling OW in TWO ISLAND.
            Set by GAME START SCRIPT.
            Cleared when the TWO ISLAND shopkeeper hears about Gym progress. (TWO ISLAND level script.)
07D        Controls visibility of a shopper OW in TWO ISLAND.
            Set by GAME START SCRIPT.
            Cleared when the TWO ISLAND shopkeeper hears about E4 progress. (TWO ISLAND level script.)
07E        Controls visibility of anti-Biker OWs in THREE ISLAND.
            Set when entering THREE ISLAND after you've rescued LOSTELLE (2A3 is set).
080        Controls visibility of the SNORLAX OW in ROUTE 16.
            Set immediately before the battle with the SNORLAX on ROUTE 16.
081        Controls visibility of the MEWTWO OW in CERULEAN CAVE (1.74).
082        Controls visibility of the ARTICUNO OW in SEAFOAM ISLANDS (1.87).
083        Controls visibility of a TEAM ROCKET GRUNT in POKeMON TOWER (1.94).
084        Controls visibility of a TEAM ROCKET GRUNT in POKeMON TOWER (1.94).
085        Controls visibility of a VOLTORB in POWER PLANT (1.95).
086        Controls visibility of a VOLTORB in POWER PLANT (1.95).
087        Controls visibility of S.S. ANNE OW in S.S. ANNE (1.4).
088        Controls visibility of TEAM ROCKET GRUNT OWs in FIVE ISLE MEADOW, OUTCAST ISLAND, and ROCKET WAREHOUSE.
            Set if the player has defeated TEAM ROCKET at ROCKET WAREHOUSE.
089        Controls visibility of TEAM ROCKET GRUNT OWs in MT. EMBER (1.97).
08A        Controls visibility of the RUBY OW in MT. EMBER (1.102).
08B        Controls visibility of LORELEI's OW in ICEFALL CAVE (1.113).
08C        Controls visibility of LORELEI's OW in her home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Set after finishing the CELIO/RUBY/SAPPHIRE subplot.
            Cleared after assisting LORELEI in ICEFALL CAVE.
08D        Controls visibility of TEAM ROCKET GRUNT OWs in ICEFALL CAVE (1.113).
08E        Controls visibility of the scientist OW in RUIN VALLEY.
            Set after assisting LORELEI in ICEFALL CAVE.
08F        Controls visibility of the SAPPHIRE OW in DOTTED HOLE (1.120).
090        Controls visibility of the thief OW in DOTTED HOLE (1.120).
            Set by GAME START SCRIPT.
091        Controls visibility of one single Biker OW in THREE ISLAND.
            Set by GAME START SCRIPT.
            Cleared after a brief confrontation with a biker at the TWO ISLAND GAME CORNER.
092        Controls visibility of the Running Shoes guy in PEWTER CITY.
            Set by GAME START SCRIPT.
            Cleared after beating PEWTER CITY Gym Leader BROCK.
093        Controls visibility of SELPHY's OW in LOST CAVE (2.22).
094        Controls visibility of SELPHY's OW in RESORT GORGEOUS.
            Set by GAME START SCRIPT.
            Cleared after rescuing SELPHY from LOST CAVE, before warping to RESORT GORGEOUS.
095        Controls visibility of SELPHY's OW in her home at RESORT GORGEOUS (RESORT GORGEOUS (39.0)).
            Set by GAME START SCRIPT.
            Cleared after rescuing SELPHY from LOST CAVE, after she dismisses you from her front door.
096        Controls visibility of SELPHY's Butler's OW in her home at RESORT GORGEOUS.
            Set by GAME START SCRIPT.
097        Controls visibility of GARY's OW in FOUR ISLAND.
            Set by GAME START SCRIPT.
            Cleared by one FOUR ISLAND level script if another (Gary encounter) is able to run.
098        Controls visibility of GARY's OW in SIX ISLAND's PokeCenter.
099        Controls visibility of the DEOXYS OW in BIRTH ISLAND (2.56).
            Set by GAME START SCRIPT.
            Set when entering the map after 2E4 is set.
09A        Controls visibility of the Triangle OW in BIRTH ISLAND (2.56).
            Set when entering the map after 2E4 is set. Cleared when wnetering when 2E4 is cleared 
            and 2F7 (DEOXYS fainted) is unset.
09B        Controls visibility of the LUGIA OW in NAVEL ROCK (2.38).
            Set when entering the map after 2F2 is set. Cleared when entering when 2F2 is cleared 
            and 2F5 (fainted) is unset.
09C        Controls visibility of the HO-OH OW in NAVEL ROCK (2.37).
            Set when entering the map after 2F3 is set. Cleared when entering when 2F3 is cleared 
            and 2F6 (fainted) is unset.
09D        Controls visibility of certain FAME CHECKER NPCs that spawn in after you beat the Elite Four. It is cleared 
        during a Hall of Rame room level script.
            Set by GAME START SCRIPT.
            Controls visibility of the FUJI fan OW in LAVENDER CITY's PokeCenter.
            Controls visibility of the LANCE fan OW in SAFFRON CITY (near the Trainer Fan Club).
            Controls visibility of the BRUNO fan OW in EMBER SPA.
09E        Controls visibility of two invisible Person events on a bookcase in CELADON CITY (10.8). They contain FAME 
        CHECKER data on ERIKA.
            Set by GAME START SCRIPT.
09F        Unknown.
            Set by GAME START SCRIPT.
0A0        Unknown.
            Set by GAME START SCRIPT.
0A1        Controls visibility of the OAK Assistant OW in VERMILION CITY.
            Set by GAME START SCRIPT.
            Set when entering VERMILION CITY while 2F9 is set.
0A2        Controls visibility of BILL's OW in the CINNABAR ISLAND PokeCenter.
            Set by GAME START SCRIPT.
0A3        Controls visibility of OAK's OW at the INDIGO PLATEAU (3.9).
            Set by GAME START SCRIPT.
0A4        Unknown.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0A5        Controls visibility of a MEOWTH Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0A6        Controls visibility of a CHANSEY Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0A7        Controls visibility of a NIDORANF Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0A8        Controls visibility of a JIGGLYPUFF Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0A9        Controls visibility of a NIDORANM Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0AA        Controls visibility of a FEAROW Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0AB        Controls visibility of a PIDGEOT Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0AC        Controls visibility of a LAPRAS Doll OW in LORELEI's home on FOUR ISLAND.
            Set by GAME START SCRIPT.
            Conditionally cleared by special 1B9.
0AD        Controls visibility of TEAM ROCKET GRUNT OWs in MT. MOON (1.3) and ROCKET HIDEOUT (all).
            Set after beating VIRIDIAN CITY Gym Leader GIOVANNI.
0AE        Unknown.
            Set by GAME START SCRIPT.
154        Controls visibility of an item OW in ROUTE 1.
155        Controls visibility of an item OW in ROUTE 1.
156        Controls visibility of an item OW in VIRIDIAN FOREST.
157        Controls visibility of an item OW in VIRIDIAN FOREST.
158        Controls visibility of an item OW in VIRIDIAN FOREST.
159        Controls visibility of an item OW in MT. MOON (1.1).
15A        Controls visibility of an item OW in MT. MOON (1.1).
15B        Controls visibility of an item OW in MT. MOON (1.1).
15C        Controls visibility of an item OW in MT. MOON (1.1).
15D        Controls visibility of an item OW in MT. MOON (1.1).
15E        Controls visibility of an item OW in MT. MOON (1.1).
15F        Controls visibility of an item OW in MT. MOON (1.3).
160        Controls visibility of an item OW in MT. MOON (1.3).
161        Controls visibility of an item OW in ROUTE 4.
162        Controls visibility of an item OW in ROUTE 24.
163        Controls visibility of an item OW in ROUTE 25.
164        Controls visibility of an item OW in S.S. ANNE (1.13).
165        Controls visibility of an item OW in S.S. ANNE (1.19).
166        Controls visibility of an item OW in S.S. ANNE (1.21).
167        Controls visibility of an item OW in S.S. ANNE (1.25).
168        Controls visibility of an item OW in S.S. ANNE (1.26).
169        Controls visibility of an item OW in S.S. ANNE (1.28).
16A        Controls visibility of an item OW in S.S. ANNE (1.10).
16B        Controls visibility of an item OW in ROUTE 9.
16C        Controls visibility of an item OW in ROCKET HIDEOUT (1.42).
16D        Controls visibility of an item OW in ROCKET HIDEOUT (1.42).
16E        Controls visibility of an item OW in ROCKET HIDEOUT (1.43).
16F        Controls visibility of an item OW in ROCKET HIDEOUT (1.43).
170        Controls visibility of an item OW in ROCKET HIDEOUT (1.43).
171        Controls visibility of an item OW in ROCKET HIDEOUT (1.43).
172        Controls visibility of an item OW in ROCKET HIDEOUT (1.44).
173        Controls visibility of an item OW in ROCKET HIDEOUT (1.44).
174        Controls visibility of an item OW in ROCKET HIDEOUT (1.45).
175        Controls visibility of an item OW in ROCKET HIDEOUT (1.45).
176        Controls visibility of an item OW in ROCKET HIDEOUT (1.45).
177        Controls visibility of an item OW in POKeMON TOWER (1.90).
178        Controls visibility of an item OW in POKeMON TOWER (1.91).
179        Controls visibility of an item OW in POKeMON TOWER (1.91).
17A        Controls visibility of an item OW in POKeMON TOWER (1.91).
17B        Controls visibility of an item OW in POKeMON TOWER (1.92).
17C        Controls visibility of an item OW in POKeMON TOWER (1.93).
17D        Controls visibility of an item OW in POKeMON TOWER (1.93).
17E        Controls visibility of an item OW in ROUTE 12.
17F        Controls visibility of an item OW in ROUTE 12.
180        Controls visibility of an item OW in ROUTE 15.
181        Controls visibility of an item OW in SAFARI ZONE (1.63).
182        Controls visibility of an item OW in SAFARI ZONE (1.64).
183        Controls visibility of an item OW in SAFARI ZONE (1.64).
184        Controls visibility of an item OW in SAFARI ZONE (1.64).
185        Controls visibility of an item OW in SAFARI ZONE (1.64).
186        Controls visibility of an item OW in SAFARI ZONE (1.65).
187        Controls visibility of an item OW in SAFARI ZONE (1.65).
188        Controls visibility of an item OW in SAFARI ZONE (1.66).
189        Controls visibility of the item OW (GOLD TEETH) in SAFARI ZONE (1.66).
18A        Controls visibility of an item OW in SAFARI ZONE (1.66).
18B        Controls visibility of an item OW in SAFARI ZONE (1.66).
18C        Controls visibility of an item OW in SILPH CO. (1.49).
18D        Controls visibility of an item OW in SILPH CO. (1.50).
18E        Controls visibility of an item OW in SILPH CO. (1.50).
18F        Controls visibility of an item OW in SILPH CO. (1.50).
190        Controls visibility of an item OW in SILPH CO. (1.51).
191        Controls visibility of an item OW in SILPH CO. (1.51).
192        Controls visibility of the item OW (CARD KEY) in SILPH CO. (1.52). Set if the player has the CARD KEY.
193        Controls visibility of an item OW in SILPH CO. (1.52).
194        Controls visibility of an item OW in SILPH CO. (1.52).
195        Controls visibility of an item OW in SILPH CO. (1.53).
196        Controls visibility of an item OW in SILPH CO. (1.53).
197        Controls visibility of an item OW in SILPH CO. (1.56).
198        Controls visibility of an item OW in SILPH CO. (1.56).
199        Controls visibility of an item OW in SILPH CO. (1.56).
19A        Controls visibility of an item OW in POWER PLANT (1.95).
19B        Controls visibility of an item OW in POWER PLANT (1.95).
19C        Controls visibility of an item OW in POWER PLANT (1.95).
19D        Controls visibility of an item OW in POWER PLANT (1.95).
19E        Controls visibility of an item OW in POWER PLANT (1.95).
19F        Controls visibility of an item OW in POKeMON MANSION (1.59).
1A1        Controls visibility of an item OW in POKeMON MANSION (1.60).
1A2        Controls visibility of an item OW in POKeMON MANSION (1.61).
1A3        Controls visibility of an item OW in POKeMON MANSION (1.61).
1A4        Controls visibility of an item OW in POKeMON MANSION (1.62).
1A5        Controls visibility of an item OW in POKeMON MANSION (1.62).
1A7        Controls visibility of an item OW in POKeMON MANSION (1.62).
1A8        Controls visibility of the item OW (SECRET KEY) in POKeMON MANSION (1.62).
            Set if the player has the key for CINNABAR ISLAND's Gym.
1A9        Controls visibility of an item OW in VICTORY ROAD (1.39).
1AA        Controls visibility of an item OW in VICTORY ROAD (1.39).
1AB        Controls visibility of an item OW in VICTORY ROAD (1.40).
1AC        Controls visibility of an item OW in VICTORY ROAD (1.40).
1AD        Controls visibility of an item OW in VICTORY ROAD (1.40).
1AE        Controls visibility of an item OW in VICTORY ROAD (1.40).
1AF        Controls visibility of an item OW in VICTORY ROAD (1.41).
1B0        Controls visibility of an item OW in VICTORY ROAD (1.41).
1B1        Controls visibility of an item OW in CERULEAN CAVE (1.72).
1B2        Controls visibility of an item OW in CERULEAN CAVE (1.72).
1B3        Controls visibility of an item OW in CERULEAN CAVE (1.72).
1B4        Controls visibility of an item OW in CERULEAN CAVE (1.73).
1B5        Controls visibility of an item OW in CERULEAN CAVE (1.73).
1B6        Controls visibility of an item OW in CERULEAN CAVE (1.73).
1B7        Controls visibility of an item OW in CERULEAN CAVE (1.74).
1B8        Controls visibility of an item OW in CERULEAN CAVE (1.74).
1B9        Controls visibility of an item OW in FUCHSIA CITY (11.7).
1BA        Controls visibility of an item OW in TWO ISLAND.
1BB        Controls visibility of an item OW in THREE ISLAND.
1BE        Controls visibility of an item OW in VIRIDIAN FOREST.
1BF        Controls visibility of an item OW in MT. MOON (1.3).
1C0        Controls visibility of an item OW in MT. MOON (1.3).
1C1        Controls visibility of an item OW in ROUTE 11.
1C2        Controls visibility of an item OW in ROUTE 9.
1C3        Controls visibility of an item OW in ROCK TUNNEL (1.81).
1C4        Controls visibility of an item OW in ROCK TUNNEL (1.81).
1C5        Controls visibility of an item OW in ROCK TUNNEL (1.81).
1C6        Controls visibility of an item OW in ROCK TUNNEL (1.82).
1C7        Controls visibility of an item OW in ROCK TUNNEL (1.82).
1C8        Controls visibility of an item OW in SILPH CO. (1.54).
1C9        Controls visibility of an item OW in SILPH CO. (1.57).
1CA        Controls visibility of an item OW in POKeMON MANSION (1.59).
1CB        Controls visibility of an item OW in POKeMON MANSION (1.60).
1CC        Controls visibility of an item OW in POKeMON MANSION (1.60).
1CD        Controls visibility of an item OW in VIRIDIAN CITY.
1CE        Controls visibility of an item OW in ROUTE 11.
1CF        Controls visibility of an item OW in ROUTE 11.
1D0        Controls visibility of an item OW in POKeMON TOWER (1.92).
1D1        Controls visibility of an item OW in CELADON CITY.
1D2        Controls visibility of an item OW in ROCKET HIDEOUT (1.44).
1D3        Controls visibility of an item OW in SAFARI ZONE (1.65).
1D4        Controls visibility of an item OW in SEAFOAM ISLANDS (1.83).
1D5        Controls visibility of an item OW in SEAFOAM ISLANDS (1.84).
1D6        Controls visibility of an item OW in SEAFOAM ISLANDS (1.84).
1D7        Controls visibility of an item OW in SEAFOAM ISLANDS (1.85).
1D8        Controls visibility of an item OW in SEAFOAM ISLANDS (1.87).
1D9        Controls visibility of an item OW in FOUR ISLAND.
1DA        Controls visibility of an item OW in FOUR ISLAND.
1DB        Controls visibility of an item OW in KINDLE ROAD.
1DC        Controls visibility of an item OW in KINDLE ROAD.
1DD        Controls visibility of an item OW in KINDLE ROAD.
1DE        Controls visibility of an item OW in FIVE ISLE MEADOW.
1DF        Controls visibility of an item OW in FIVE ISLE MEADOW.
1E0        Controls visibility of an item OW in MEMORIAL PILLAR.
1E1        Controls visibility of an item OW in OUTCAST ISLAND.
1E2        Controls visibility of an item OW in WATER PATH.
1E3        Controls visibility of an item OW in WATER PATH.
1E4        Controls visibility of an item OW in RUIN VALLEY.
1E5        Controls visibility of an item OW in RUIN VALLEY.
1E6        Controls visibility of an item OW in RUIN VALLEY.
1E7        Controls visibility of an item OW in SEVAULT CANYON.
1E8        Controls visibility of an item OW in SEVAULT CANYON.
1E9        Controls visibility of an item OW in SEVAULT CANYON.
1EA        Controls visibility of an item OW in BERRY FOREST.
1EB        Controls visibility of an item OW in BERRY FOREST.
1EC        Controls visibility of an item OW in BERRY FOREST.
1ED        Controls visibility of an item OW in MT. EMBER (1.97).
1EE        Controls visibility of an item OW in MT. EMBER (1.97).
1EF        Controls visibility of an item OW in MT. EMBER (1.97).
1F0        Controls visibility of an item OW in ICEFALL CAVE (1.111).
1F1        Controls visibility of an item OW in ICEFALL CAVE (1.111).
1F2        Controls visibility of an item OW in ICEFALL CAVE (1.112).
1F3        Controls visibility of an item OW in ICEFALL CAVE (1.112).
1F4        Controls visibility of an item OW in ROCKET WAREHOUSE.
1F5        Controls visibility of an item OW in ROCKET WAREHOUSE.
1F6        Controls visibility of an item OW in ROCKET WAREHOUSE.
1F7        Controls visibility of an item OW in ROCKET WAREHOUSE.
1F8        Controls visibility of an item OW in LOST CAVE (2.22).
1F9        Controls visibility of an item OW in LOST CAVE (2.23).
1FA        Controls visibility of an item OW in LOST CAVE (2.24).
1FB        Controls visibility of an item OW in LOST CAVE (2.25).
1FC        Controls visibility of an item OW in LOST CAVE (2.26).
1FD        Controls visibility of an item OW in SEVAULT CANYON (42.0).
1FE        Controls visibility of an item OW in SILPH CO. (1.50).
230        Set if the player received a POTION from the salesman on ROUTE 1.
231        Set if the player has received TM34 SHOCK WAVE from VERMILION CITY Gym Leader LT. SURGE.
232        Set if the player has taken either of the two fossils from MT. MOON.
233        Set if the player helped BILL turn back into a human being.
234        Set if the player received the S.S. ANNE TICKET from BILL.
235        Unknown. Set after BILL gives the player the S.S. ANNE TICKET.
236        Set if the player received TM42 from the bereaved man at MEMORIAL PILLAR.
237        Set if the player received HM01 CUT from the captain of the S.S. ANNE.
238        Set if the player received HM02 FLY from the woman on ROUTE 16 (map 25.0).
239        Set if the player received HM03 SURF from the man in the SAFARI ZONE.
23A        Set if the player received HM04 STRENGTH from the SAFARI ZONE Warden.
23B        Set if the player received HM05 FLASH from one of OAK's assistants on ROUTE 2 (map 15.2).
23C        Set after talking to MR. FUJI in POKeMON TOWER. Allows the player to sneak past a TEAM 
        ROCKET guard in SAFFRON CITY and enter the besieged SILPH CO. skyscraper.
23D        Set if the player received the POKe FLUTE from MR. FUJI at his home in LAVENDER TOWN.
23F        Unknown. If set, the hiker in the burglarized CERULEAN house calms down.
240        Set if the player received the OLD ROD from the fisherman in VERMILION CITY.
241        Set if the player obtained a BIKE VOUCHER from the man in the POKeMON Fan Club.
243        Set if the player received the COIN CASE from a man in CELADON CITY.
            Checked by the internal script that handles hidden item Signposts. (Item ID 0 is 
            treated as a COINS pickup, you see.)
244        Set if the player received the GOOD ROD from the fisherman in FUCHSIA CITY.
245        Set if the player received TM29 PSYCHIC from MR. PSYCHIC in SAFFRON CITY.
246        Set if the player received LAPRAS from the man in SILPH CO.
247        Unknown. Checked when the player enters PROF. OAK's lab.
248        Set if the player traded with a boy on ROUTE 2 (map 15.1).
249        Set if the player purchased a MAGIKARP from the conman on ROUTE 4 (map 16.0).
24A        Set if the player traded with an old man in CERULEAN CITY (map 7.2).
24B        Set if the player traded with a young girl at the UNDERGROUND PATH entrance (map 1.30).
24D        Set if the player traded with a young girl in VERMILION CITY (map 9.4).
24E        Set if the player received TM38 FIRE BLAST from CINNABAR ISLAND Gym Leader BLAINE.
24F        Unknown. Set if the player enters PROF. OAK's lab while 247 is set.
250        Set if the player received the MASTER BALL from the SILPH CO. PRESIDENT.
251        Set if the player traded with a boy on ROUTE 11 (map 22.1).
252        Set if the player received the ITEMFINDER from one of OAK's aides on ROUTE 11 (map 22.1).
253        Set if the player has battled the SNORLAX on ROUTE 12.
254        Set if the player has received TM39 ROCK TOMB from PEWTER CITY Gym Leader BROCK.
255        Set if the player has received the SUPER ROD from the fisherman on ROUTE 12 (map 23.2).
256        Set if the player has received the EXP. SHARE from one of OAK's aides on ROUTE 15 (map 24.1).
257        Set if the player traded with a boy on ROUTE 18 (map 26.1).
258        Set after the first Rival battle. Allows the player to heal at their house in PALLET TOWN.
259        Set if the player has received TM06 TOXIC from FUCHSIA CITY Gym Leader KOGA.
25B        Set if the player has received TM27 RETURN from the bereaved woman on ROUTE 12 (map 23.1).
25E        Set if the player has received OLD AMBER from a man in PEWTER CITY's Museum.
263        Set if the player has received EEVEE from the Poke Ball OW in CELADON CITY (10.11).
264        Unknown. Used as part of the trashcan puzzle in VERMILION CITY's Gym.
265        Unknown. Used as part of the quiz puzzles in CINNABAR ISLAND's Gym.
266        Set if the FOUR ISLAND Daycare has an EGG waiting for the player. Is directly manipulated by 
        the game engine.
26C        Toggles which set of POKeMON MANSION blocked doorways is open.
26D        Set if the player hit the switch behind the poster in the GAME CORNER.
26E        Set if the player received 10 COINS from the fisherman in the GAME CORNER.
26F        Set if the player received 20 COINS from the scientist in the GAME CORNER.
270        Set if the player received 20 COINS from the gentleman in the GAME CORNER.
271        Set if the player received a BICYCLE from CERULEAN CITY's bike salesman.
272        Set if the player chose the DOME FOSSIL (KABUTO) in MT. MOON.
273        Set if the player chose the HELIX FOSSIL (OMANYTE) in MT. MOON.
274        Set if the player traded with an old man in CINNABAR ISLAND (map 12.2).
275        Set if the player traded with a woman in CINNABAR ISLAND (map 12.2).
276        Set if the player traded with a man in CINNABAR ISLAND (map 12.4).
278        Set if the player has taken one of the two prize Pokemon from the SAFFRON CITY FIGHTING DOJO.
27A        SILPH CO. blocked doorway. If set, the door is open.
27B        SILPH CO. blocked doorway.
27C        SILPH CO. blocked doorway.
27D        SILPH CO. blocked doorway.
27E        SILPH CO. blocked doorway.
27F        SILPH CO. blocked doorway.
280        SILPH CO. blocked doorway.
281        SILPH CO. blocked doorway.
282        SILPH CO. blocked doorway.
283        SILPH CO. blocked doorway.
284        SILPH CO. blocked doorway.
285        SILPH CO. blocked doorway.
286        SILPH CO. blocked doorway.
287        SILPH CO. blocked doorway.
288        SILPH CO. blocked doorway.
289        SILPH CO. blocked doorway.
28A        SILPH CO. blocked doorway.
28B        SILPH CO. blocked doorway.
28C        SILPH CO. blocked doorway.
28D        SILPH CO. blocked doorway.
290        Set if the player has spoken to the sticker kid on FOUR ISLAND at least once?
291        Unknown. Checked in a PALLET TOWN level script. Set when the player has chosen a starter.
293        Set if the player has received TM19 GIGA DRAIN from CELADON CITY Gym Leader ERIKA.
294        Set if the player has given LEMONADE to the girl on the CELADON Department Store roof.
            ...in exchange for TM33 REFLECT.
295        Set if the player has given SODA POP to the girl on the CELADON Department Store roof.
            ...in exchange for TM20 SAFEGUARD.
296        Set if the player has given FRESH WATER to the girl on the CELADON Department Store roof.
            ...in exchange for TM16 LIGHT SCREEN.
297        Set if the player has received TM03 WATER PULSE from CERULEAN CITY Gym Leader MISTY.
298        Set if the player has received TM26 EARTHQUAKE from VIRIDIAN CITY Gym Leader GIOVANNI.
29A        Set if the player has received TM04 CALM MIND from SAFFRON CITY Gym Leader SABRINA.
29B        Set after beating Gary at CERULEAN CITY.
29C        Set if the player has shown a MAGIKARP to the fisherman on Route 12 (map 23.2) and had its 
        size recorded.
29D        Set if the TWO ISLAND shopkeeper has told you that his shop is new.
29E        Set if the TWO ISLAND shopkeeper has told you that he now stocks items with help from the 
        islanders now that you've rescued Lostelle.
29F        Set if the TWO ISLAND shopkeeper has told you that he "gives it his best".
2A0        Set if the TWO ISLAND shopkeeper has told you that he now stocks items from distant lands.
2A1        Unknown. If set, the SEVII ISLAND PokeCenters will "now have PC linkage with people in 
        KANTO".
            Set by a level script every time the player enters THREE ISLE PORT (3.49).
2A2        Set when the player enters TWO ISLAND for the first time.
2A3        Set after rescuing LOSTELLE in BERRY FOREST, before warping to her home.
2A5        Set if the palyer picked up the LIFT KEY from the OW (ROCKET HIDEOUT (1.45)).
            If unset, the ROCKET HIDEOUT elevator does not work. ("It appears to need a key.")
2A6        Set if the player has received TEA from the old woman in CELADON CITY.
2AC        If unset, the ROCKET HIDEOUT elevator does not work. ("It appears to need a key.")
2BB        Set if the player has received a POWDER JAR from a man in CERULEAN CITY.
2BC        Set if the MEWTWO battle does not end in an 0x4 (escaped) or 0x5 (?) outcome (special B4).
2BD        Set if the MOLTRES battle does not end in an 0x4 (escaped) or 0x5 (?) outcome (special B4).
2BE        Set if the ARTICUNO battle does not end in an 0x4 (escaped) or 0x5 (?) outcome (special B4).
2BF        Set if the ZAPDOS battle does not end in an 0x4 (escaped) or 0x5 (?) outcome (special B4).
2C0        Set if the ROCK SLIDE Move Tutor has already been used.
2C1        Set if the THUNDER WAVE Move Tutor has already been used.
2C2        Set if the ROCK SLIDE Move Tutor has already been used.
2C3        Set if the EXPLOSION Move Tutor has already been used.
2C4        Set if the MEGA PUNCH Move Tutor has already been used.
2C5        Set if the MEGA KICK Move Tutor has already been used.
2C6        Set if the DREAM EATER Move Tutor has already been used.
2C7        Set if the SOFTBOILED Move Tutor has already been used.
2C8        Set if the SUBSTITUTE Move Tutor has already been used.
2C9        Set if the SWORDS DANCE Move Tutor has already been used.
2CA        Set if the SEISMIC TOSS Move Tutor has already been used.
2CB        Set if the COUNTER Move Tutor has already been used.
2CC        Set if the METRONOME Move Tutor has already been used.
2CD        Set if the player has given a POKe DOLL to the COPYCAT in SAFFRON CITY.
2CE        Set if the BODY SLAM Move Tutor has already been used.
2CF        Unknown. Set when entering PROF. OAK's lab.
2D0        Set if a POWER PLANT ELECTRODE battle doesn't end in an 0x4 or 0x5 outcome (special B4).
2D1        Set if a POWER PLANT ELECTRODE battle doesn't end in an 0x4 or 0x5 outcome (special B4).
2D2        Unknown. Part of the SEAFOAM ISLANDS level scripts that determine whether the fast current is blocked.
            If not set, a Route 20 level script clears 40 and 41, and sets 42 through 47.
2D3        Unknown. Part of the SEAFOAM ISLANDS level scripts that determine whether the fast current is blocked.
            If not set, a Route 20 level script clears 48 through 4B, and sets 4C and 4D.
2D4        Unknown. Affects LORELEI's dialogue at her home on FOUR ISLAND.
2D5        Set if the player has defeated TEAM ROCKET at ROCKET WAREHOUSE.
2D6        If set, the player will be able to enter the ROCKET WAREHOUSE. (The tile will change to one 
        that enables warps.)
2D7        Set if the player earned TM42 from the bereaved man at MEMORIAL PILLAR, but had no room for 
        it. Talking to the man with this flag set will make him remember the player and give the 
        item if there is now room for it.
2D8        Set when the SAPPHIRE is stolen from DOTTED HOLE by TEAM ROCKET. Allows the player to enter 
        both of the necessary passwords to open the door to ROCKET WAREHOUSE.
2D9        Set if the player has shown a HERACROSS to the woman on WATER PATH (map 41.0) and had its 
        size recorded.
2DA        Set if the player received the EGG from the man in the WATER LABYRINTH.
2DB        Set if the player "earned" the EGG from WATER LABYRINTH, but had no room for it at the time. 
        Upon talking to the man again, he'll give them the EGG immediately if this flag is set.
2DC        Set when the player finds the SAPPHIRE at ROCKET WAREHOUSE.
2DD        Set when the player finds the RUBY in MT. EMBER.
2E1        Set if the player has learned a starter-only power move from the woman on CAPE BRINK (40.0).
2E2        Set if the player received a NUGGET from the man in THREE ISLE PATH.
2E3        Set if the door to the ruins in RUIN VALLEY is open. A level script enables the door warp.
2E4        Set if the DEOXYS battle doesn't end in a 1, 4 (escaped), or 5 (?) (special B4).
2EC        Set if the DOME FOSSIL (KABUTO) has been revived.
2ED        Set if the HELIX FOSSIL (OMANYTE) has been revived.
2EE        Set if the OLD AMBER (AERODACTYL) has been revived.
2EF        Set if the player received HM06 ROCK SMASH from the man in EMBER SPA.
2F0        Set if the VERMILION sailor already knows you have the MYSTICTICKET.
2F1        Set if the VERMILION sailor already knows you have the AURORATICKET.
2F2        Set if the LUGIA battle doesn't end in a 1, 4 (escaped), or 5 (?) (special B4).
2F3        Set if the HO-OH battle doesn't end in a 1 (faint), 4 (escaped), or 5 (?) (special B4).
2F5        Unknown. Allows you to rebattle a fainted LUGIA if you beat the ELITE FOUR again?
            Cleared during the Hall of Fame room level script, if the National Dex is already unlocked.
            Set if the LUGIA battle ends with the Pokemon fainting.
2F6        Unknown. Allows you to rebattle a fainted HO-OH if you beat the ELITE FOUR again?
            Cleared during the Hall of Fame room level script, if the National Dex is already unlocked.
            Set if the HO-OH battle ends with the Pokemon fainting.
2F7        Unknown. Allows you to rebattle a fainted DEOXYS if you beat the ELITE FOUR again?
            Cleared during the Hall of Fame room level script, if the National Dex is already unlocked.
            Set if the DEOXYS battle ends with the Pokemon fainting.
2F8        Unknown. Affects the dialogue of the TEA-giving woman in CELADON CITY.
2F9        Set if the player spoke to the OAK assistant in VERMILION CITY. When the player re-enters the map, this flag 
        will be used by a level script to hide the assistant's OW.
2FA        Set if the player received an EVERSTONE from one of OAK's assistants on ROUTE 10 (map 21.0).
2FB        Set if the player received a MOON STONE from the man in the TWO ISLAND GAME CORNER.
2FC        Set if the player received a FULL RESTORE from a thankful THREE ISLAND civilian.
2FD        Set if the player received an AMULET COIN from one of OAK's aides on ROUTE 16 (map 25.2).
2FE        Set if the player earned the MOON STONE from the man in the TWO ISLAND GAME CORNER, but did 
        not have room for it. The player will receive it if they talk to the man again later.
2FF        Used by the game's internal PC script. It is set immediately before the plaer is asked if they want their 
        Pokedex rated, and cleared immediately after (regardless of their selection).
4B0        Champ-in-making guy flag. Set if the player has defeated PEWTER's Gym Leader, BROCK.
            Also affects PokeCenter nurse dialog when she heals your Pokemon after a whiteout. If this flag is not 
            set, she'll offer some advice.
4B1        Champ-in-making guy flag. Set if the player has defeated CERULEAN's Gym Leader, MISTY.
4B2        Champ-in-making guy flag. Set if the player has defeated VERMILION's Gym Leader, LT. SURGE.
4B3        Champ-in-making guy flag. Set if the player has defeated CELADON's Gym Leader, ERIKA.
4B4        Champ-in-making guy flag. Set if the player has defeated FUCHSIA's Gym Leader, KOGA.
4B5        Champ-in-making guy flag. Set if the player has defeated SAFFRON's Gym Leader, SABRINA.
4B6        Champ-in-making guy flag. Set if the player has defeated CINNABAR's Gym Leader, BLAINE.
4B7        Champ-in-making guy flag. Set if the player has defeated VIRIDIAN's Gym Leader, GIOVANNI.
4B8        Set if the player has defeated Lorelei during the current attempt at the E4. Cleared in the Hall of Fame room.
4B9        Set if the player has defeated Bruno during the current attempt at the E4. Cleared in the Hall of Fame room.
4BA        Set if the player has defeated Agatha during the current attempt at the E4. Cleared in the Hall of Fame room.
4BB        Set if the player has defeated Lance during the current attempt at the E4. Cleared in the Hall of Fame room.
4BC        Set if the player has defeated Gary during the current attempt at the E4. Cleared in the Hall of Fame room.

// Flags 500 - 700 are trainer flags. Subtract 0x500 from a normal flag 
// for the equivalent used in trainer flag script commands.

805        Strength has already been used on this map.
807        Set just prior to a wild battle triggered by talking to an OW, and cleared just after. Possibly used as a 
        failsafe for if a player faints during a legendary battle, as that would (I think) terminate script execution.
820        Unknown. Appears to be set if the player has the TEACHY TV when talking to VIRIDIAN Old Man.
820        If set, the player has the BOULDERBADGE.
821        If set, the player has the CASCADEBADGE.
822        If set, the player has the THUNDERBADGE.
823        If set, the player has the RAINBOWBADGE.
824        If set, the player has the SOULBADGE.
825        If set, the player has the MARSHBADGE.
826        If set, the player has the VOLCANOBADGE.
827        If set, the player has the EARTHBADGE.
828        If set, the POKeMON menu is accessible.
829        If set, the POKeDEX menu is accessible.
            Checked by the game's internal PC script.
            Checked by the game's internal linking functions. ("It appears to be undergoing adjustments...")
            If not set, the WIRELESS COMMUNICATION CLUB on PokeCenters 2F is disabled.
            If not set, the MYSTERY GIFT questionnaire in PokeMarts is disabled.
82C        If set, the player has beaten the Elite Four at least once.
            Checked during Bruno's, Agatha's, Lance's, and Gary's Elite Four scripts.
            Checked by the game's internal PC script. 
            If set, DAISY will groom Pokemon.
            Does this get set when you obtain the VS SEEKER?
82D        Set if the player has customized their profile. (Apparently set by the game engine itself?)
82F        Running Shoes
830        Unknown. Set if variable 0x405E == 0x1 when entering ROUTE 16 and ROUTE 18.
834        If set, the player knows the name of BILL's PC. (Unset = "Someone's".)
            This is used both in normal scripts and in the internal script for the PC.
839        UNCONFIRMED: Mystery Gift enabled.
83B        Unknown.
            Set by special 125.
83E        Set when talking to some chick in PALLET TOWN that mimics a sign or whatever.
841        Unknown. Cleared by a level script every time the player enters THREE ISLE PORT (3.49).
            If set, the PC will be unusable ("The usual PC services aren't available...").
842        Unknown. Checked after healing at a PokeCenter.
843        Unknown.
            Read and written to by special 165.
844        Set when CELIO successfully connects to LANETTE -- in other words, when you're allowed to 
        trade to R/S/E.
846        Set when obtaining the RAINBOW PASS.
847        Unknown... Set if the player has no berries, or no BERRY POUCH? (Set by the game engine?)
848        Cleared when entering BIRTH ISLAND when 2E4 is unset and 2F7 (DEOXYS fainted?) is unset.
849        Set if the player has solved TANOBY KEY.
84A        If not set, the VERMILION sailor won't check if you have the MYSTICTICKET. You can't use it.
84B        If not set, the VERMILION sailor won't check if you have the AURORATICKET. You can't use it.
890        World Map Flag (PALLET TOWN).
891        World Map Flag (VIRIDIAN CITY).
892        World Map Flag (PEWTER CITY).
893        World Map Flag (CERULEAN CITY).
894        World Map Flag (LAVENDER TOWN).
895        World Map Flag (VERMILION CITY).
896        World Map Flag (CELADON CITY).
897        World Map Flag (FUCHSIA CITY).
898        World Map Flag (CINNABAR ISLAND).
899        World Map Flag (INDIGO PLATEAU).
89A        World Map Flag (SAFFRON CITY).
89B        World Map Flag (ONE ISLAND).
            If set, OAK welcomes the player back to PALLET TOWN when they enter the town.
89C        World Map Flag (TWO ISLAND).
89D        World Map Flag (THREE ISLAND).
89E        World Map Flag (FOUR ISLAND).
89F        World Map Flag (FIVE ISLAND).
8A0        World Map Flag (SEVEN ISLAND).
8A1        World Map Flag (SIX ISLAND).
8A4        World Map Flag (VIRIDIAN FOREST).
8A5        World Map Flag (MT. MOON (1.1)).
8A6        World Map Flag (S.S. ANNE (1.4)).
8A7        World Map Flag (UNDERGROUND PATH (1.31)).
8A8        World Map Flag (UNDERGROUND PATH (1.34)).
8A9        World Map Flag (DIGLETT'S CAVE (1.37)).
8AA        World Map Flag (VICTORY ROAD (1.39)).
8AB        World Map Flag (ROCKET HIDEOUT (1.42)).
8AC        World Map Flag (SILPH CO. (1.47)).
8AD        World Map Flag (POKeMON MANSION (1.59)).
8AE        World Map Flag (SAFARI ZONE (1.63)).
8AF        World Map Flag (POKeMON LEAGUE (1.75)).
8B0        World Map Flag (ROCK TUNNEL (1.81)).
8B1        World Map Flag (SEAFOAM ISLANDS (1.83)).
8B2        World Map Flag (POKeMON TOWER (1.88)).
8B3        World Map Flag (CERULEAN CAVE (1.72)).
8B4        World Map Flag (POWER PLANT).
8B5        World Map Flag (NAVEL ROCK (2.0)).
8B6        World Map Flag (MT. EMBER (1.97)).
8B7        World Map Flag (BERRY FOREST).
8B8        World Map Flag (ICEFALL CAVE (1.110)).
8B9        World Map Flag (ROCKET WAREHOUSE).
8BA        World Map Flag (TRAINER TOWER (2.10)).
8BB        World Map Flag (DOTTED HOLE (1.115)).
8BC        World Map Flag (LOST CAVE (2.12)).
8BD        World Map Flag (PATTERN BUSH).
8BE        World Map Flag (ALTERING CAVE).
8BF        World Map Flag (MONEAN CHAMBER).
8C0        World Map Flag (THREE ISLE PATH).
8C1        World Map Flag (TANOBY KEY).
8C2        World Map Flag (BIRTH ISLAND (2.56)).
// I have reason to believe that flags 0x890 - 0x8FD 
// are reserved for World Map Flags, even though you 
// can't fly to most of them.


LIST OF IDENTIFIED ITEM HIDDEN IDS (FIRERED)

UNUSED: 07, 10, 18, 28, 2B, 2C, 2D, 2E, 7C, BC, BF, all above.

00        POTION            VIRIDIAN FOREST (1.0)
01        ANTIDOTE        VIRIDIAN FOREST (1.0)
02        MOON STONE        MT. MOON (1.3)
03        ETHER            MT. MOON (1.3)
04        ELIXIR            ROUTE 25 (3.44)
05        ETHER            ROUTE 25 (3.44)
06        ETHER            ROUTE 9 (3.27)
08        HYPER POTION        S.S. ANNE (1.8)
09        SUPER POTION        ROUTE 10 (3.28)
0A        MAX ETHER        ROUTE 10 (3.28)
0B        PP UP            ROCKET HIDEOUT (1.42)
0C        NUGGET            ROCKET HIDEOUT (1.44)
0D        NEST BALL        ROCKET HIDEOUT (1.45)
0E        BIG MUSHROOM        POKeMON TOWER (1.92)
0F        PP UP            ROUTE 13 (3.31)
11        RARE CANDY        ROUTE 17 (3.35)
12        FULL RESTORE        ROUTE 17 (3.35)
13        PP UP            ROUTE 17 (3.35)
14        MAX REVIVE        ROUTE 17 (3.35)
15        MAX ELIXIR        ROUTE 17 (3.35)
16        LEAF STONE        SAFARI ZONE (1.63)
17        REVIVE            SAFARI ZONE (1.66)
19        MAX POTION        SILPH CO. (1.55)
1A        NUGGET            SAFFRON CITY (14.1)
1B        MAX ELIXIR        POWER PLANT (1.95)
1C        THUNDERSTONE        POWER PLANT (1.95)
1D        NUGGET            SEAFOAM ISLANDS (1.86)
1E        WATER STONE        SEAFOAM ISLANDS (1.87)
1F        MOON STONE        POKeMON MANSION (1.59)
20        RARE CANDY        POKeMON MANSION (1.61)
21        ELIXIR            POKeMON MANSION (1.62)
22        FULL RESTORE        ROUTE 23 (3.42)
23        ULTRA BALL        ROUTE 23 (3.42)
24        MAX ETHER        ROUTE 23 (3.42)
25        ULTRA BALL        VICTORY ROAD (1.39)
26        FULL RESTORE        VICTORY ROAD (1.39)
27        ULTRA BALL        CERULEAN CAVE (1.72)
29        ESCAPE ROPE        ROUTE 11 (3.29)
2A        HYPER POTION        ROUTE 12 (3.30)
2F        PP UP            CELADON CITY (3.6)
30        MAX ETHER        VERMILION CITY (3.5)
31        RARE CANDY        CERULEAN CITY (3.3)
32        GREAT BALL        ROUTE 4 (3.22)
33        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
34        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
35        ???????? [0000]        CELADON CITY (10.14) // Amount: $14 -- COINS pickup?!
36        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
37        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
38        ???????? [0000]        CELADON CITY (10.14) // Amount: $14 -- COINS pickup?!
39        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
3A        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
3B        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
3C        ???????? [0000]        CELADON CITY (10.14) // Amount: $28 -- COINS pickup?!
3D        ???????? [0000]        CELADON CITY (10.14) // Amount: $64 -- COINS pickup?!
3E        ???????? [0000]        CELADON CITY (10.14) // Amount: $0A -- COINS pickup?!
3F        CHERI BERRY        SEVAULT CANYON (3.64)
40        HEART SCALE        TANOBY RUINS (3.65)
41        HEART SCALE        TANOBY RUINS (3.65)
42        HEART SCALE        TANOBY RUINS (3.65)
43        HEART SCALE        TANOBY RUINS (3.65)
44        NEST BALL        ROCKET WAREHOUSE (1.114)
45        NET BALL        ROCKET WAREHOUSE (1.114)
46        POTION            UNDERGROUND PATH (1.31)
47        ANTIDOTE        UNDERGROUND PATH (1.31)
48        PARLYZ HEAL        UNDERGROUND PATH (1.31)
49        AWAKENING        UNDERGROUND PATH (1.31)
4A        BURN HEAL        UNDERGROUND PATH (1.31)
4B        ICE HEAL        UNDERGROUND PATH (1.31)
4C        ETHER            UNDERGROUND PATH (1.31)
4D        POTION            UNDERGROUND PATH (1.34)
4E        ANTIDOTE        UNDERGROUND PATH (1.34)
4F        PARLYZ HEAL        UNDERGROUND PATH (1.34)
50        AWAKENING        UNDERGROUND PATH (1.34)
51        BURN HEAL        UNDERGROUND PATH (1.34)
52        ICE HEAL        UNDERGROUND PATH (1.34)
53        ETHER            UNDERGROUND PATH (1.34)
54        TINYMUSHROOM        MT. MOON (1.2)
55        TINYMUSHROOM        MT. MOON (1.2)
56        TINYMUSHROOM        MT. MOON (1.2)
57        BIG MUSHROOM        MT. MOON (1.2)
58        BIG MUSHROOM        MT. MOON (1.2)
59        BIG MUSHROOM        MT. MOON (1.2)
5A        RAZZ BERRY        BERRY FOREST (1.109)
5B        BLUK BERRY        BERRY FOREST (1.109)
5C        NANAB BERRY        BERRY FOREST (1.109)
5D        WEPEAR BERRY        BERRY FOREST (1.109)
5E        ORAN BERRY        BERRY FOREST (1.109)
5F        CHERI BERRY        BERRY FOREST (1.109)
60        CHESTO BERRY        BERRY FOREST (1.109)
61        PECHA BERRY        BERRY FOREST (1.109)
62        RAWST BERRY        BERRY FOREST (1.109)
63        ASPEAR BERRY        BERRY FOREST (1.109)
64        PERSIM BERRY        BERRY FOREST (1.109)
65        PINAP BERRY        BERRY FOREST (1.109)
66        LUM BERRY        BERRY FOREST (1.109)
67        STARDUST        TREASURE BEACH (3.46)
68        STARDUST        TREASURE BEACH (3.46)
69        PEARL            TREASURE BEACH (3.46)
6A        PEARL            TREASURE BEACH (3.46)
6B        ULTRA BALL        TREASURE BEACH (3.46)
6C        ULTRA BALL        TREASURE BEACH (3.46)
6D        STAR PIECE        TREASURE BEACH (3.46)
6E        BIG PEARL        TREASURE BEACH (3.46)
6F        RARE CANDY        CAPE BRINK (3.47)
70        POKe BALL        PEWTER CITY (3.2)
71        ORAN BERRY        ROUTE 3 (3.21)
72        PERSIM BERRY        ROUTE 4 (3.22)
73        PECHA BERRY        ROUTE 24 (3.43)
74        ORAN BERRY        ROUTE 25 (3.44)
75        BLUK BERRY        ROUTE 25 (3.44)
76        SITRUS BERRY        ROUTE 6 (3.24)
77        RARE CANDY        ROUTE 6 (3.24)
78        PECHA BERRY        S.S. ANNE (1.10)
79        CHERI BERRY        S.S. ANNE (1.10)
7A        CHESTO BERRY        S.S. ANNE (1.10)
7B        RARE CANDY        ROUTE 9 (3.27)
7D        PERSIM BERRY        ROUTE 10 (3.28)
7E        CHERI BERRY        ROUTE 10 (3.28)
7F        RAWST BERRY        ROUTE 8 (3.26)
80        LUM BERRY        ROUTE 8 (3.26)
81        LEPPA BERRY        ROUTE 8 (3.26)
82        RARE CANDY        ROUTE 12 (3.30)
83        LEFTOVERS        ROUTE 12 (3.30)
84        LEFTOVERS        ROUTE 16 (3.34)
85        MAX REVIVE        FUCHSIA CITY (3.7)
86        NET BALL        ROCKET HIDEOUT (1.45)
87        ULTRA BALL        SILPH CO. (1.48)
88        PROTEIN            SILPH CO. (1.49)
89        IRON            SILPH CO. (1.50)
8A        PP UP            SILPH CO. (1.51)
8B        CARBOS            SILPH CO. (1.52)
8C        ZINC            SILPH CO. (1.53)
8D        NUGGET            SILPH CO. (1.54)
8E        CALCIUM            SILPH CO. (1.55)
8F        HP UP            SILPH CO. (1.56)
90        REVIVE            SILPH CO. (1.57)
91        LUM BERRY        ROUTE 23 (3.42)
92        SITRUS BERRY        ROUTE 23 (3.42)
93        ASPEAR BERRY        ROUTE 23 (3.42)
94        LEPPA BERRY        ROUTE 23 (3.42)
95        ZINC            ROUTE 14 (3.32)
96        CHESTO BERRY        ROUTE 9 (3.27)
97        NANAB BERRY        ROUTE 10 (3.28)
98        WEPEAR BERRY        ROUTE 7 (3.25)
99        STARDUST        ROUTE 20 (3.38)
9A        PEARL            ROUTE 21 (3.39)
9B        MAX ELIXIR        ROUTE 23 (3.42)
9C        RAZZ BERRY        ROUTE 4 (3.22)
9D        PINAP BERRY        ROUTE 14 (3.32)
9E        FIRE STONE        MT. EMBER (1.97)
9F        SOOTHE BELL        POKeMON TOWER (1.94) // Amount: $81 ?!?
A0        SACRED ASH        NAVEL ROCK (2.37)
A1        PP MAX            CAPE BRINK (3.47)
A2        ULTRA BALL        MT. EMBER (1.97)
A3        NUGGET            THREE ISLE PATH (2.34)
A4        PP UP            THREE ISLAND (3.14)
A5        MAX REPEL        BOND BRIDGE (3.48)
A6        PEARL            BOND BRIDGE (3.48)
A7        STARDUST        BOND BRIDGE (3.48)
A8        PEARL            FOUR ISLAND (3.15)
A9        ULTRA BALL        FOUR ISLAND (3.15)
AA        BIG PEARL        MEMORIAL PILLAR (3.57)
AB        RAZZ BERRY        MEMORIAL PILLAR (3.57)
AC        SITRUS BERRY        MEMORIAL PILLAR (3.57)
AD        BLUK BERRY        MEMORIAL PILLAR (3.57)
AE        NEST BALL        RESORT GORGEOUS (3.54)
AF        STARDUST        RESORT GORGEOUS (3.54)
B0        STAR PIECE        RESORT GORGEOUS (3.54)
B1        STARDUST        RESORT GORGEOUS (3.54)
B2        STAR PIECE        OUTCAST ISLAND (3.58)
B3        NET BALL        OUTCAST ISLAND (3.58)
B4        ULTRA BALL        GREEN PATH (3.59)
B5        ASPEAR BERRY        WATER PATH (3.60)
B6        ORAN BERRY        WATER PATH (3.60)
B7        PINAP BERRY        WATER PATH (3.60)
B8        LEPPA BERRY        SIX ISLAND (3.18)
B9        BIG PEARL        TRAINER TOWER (3.62)
BA        PEARL            TRAINER TOWER (3.62)
BB        NANAB BERRY        TRAINER TOWER (3.62)
BD        MACHO BRACE        VIRIDIAN CITY (5.1) // Amount: $81 ?!?
BE        LAVA COOKIE        S.S. ANNE (1.4)



*Please note that the above list is only for FireRed. There is no list for Ruby or Emerald. Feel free to make one if you wish, however, the flag (and later var) engines are quite similar on all games, so the same general rules that I am about to share do apply to all games.


Now, the above list goes over every single known flag. As you can see, there are quite a few. However, most are temporary or, from what you can see, a lot have descriptions like "Set by GAME START SCRIPT" and "Used for a CUT tree...", which obviously means you can't use these for other purposes. In fact, the only flags you can use are those which are used only by specific events and scripts that you have removed.

For example, flag 250: "Set if the player received the MASTER BALL from the SILPH CO. PRESIDENT". If you removed the script in which the Master Ball is given, then this flag is safe to use.

Another example is flag 03A: "Controls visibility of the POKEDEX OWs in OAK's Lab (PALLET TOWN (4.3)". If you remove the Pokedexes, then this flag is safe to use also.

A very common misconception is that if the flag is not on the list, then it is safe. This is not true. In general, only flags 200-2FF that are not listed are safe. Other than that, if it isn't on the list or you haven't removed the event that uses it; DON'T USE IT.

So, in general, flags that are safe:

Code:
200-2FF
Flags for events that have been removed.

A lot of flags in the 100's are used to control the visibility of items found on the ground. I personally recommend keeping these for new items you want to leave in the ground however, if you do delete that item location, then there is no reason not to use that flag.
The above rules generally work for all games, you just won't have a list to check for RSE.


Unless you have the skill of Knizz, Jambo, or JPAN, then these are all you have to work with. There are ways (with ASM) to repoint flags and make more safe, but that is very advanced and I will not be teaching it. However, Jambo51 may release his code for more flags and vars in the near future, but don't bug him about it.


So, let's explain the reasons why flags outside of those ranges aren't safe:

-Many are temporary. Meaning they get reset every time the map changes.
-500-700 are used for Trainer Flags.
-Flags over 900 take up the same space as variables.

That is pretty much it. Fairly simple, huh?




Vars

Vars are like the X in math. They can be anything up to 0xFFFF which is a little over 65,000. Like flags, they are used to track progression throughout the game, but they are also used to store information.

DavidJCobb also documented all of the variables used by FireRed and identified which ones are safe:

Quote:
Summarized variable findings:
0x4020 - 0x4024 are all pedometers, the first of them controlling REPEL expiration.

0x4036 is used for Selphy's Pokemon-fetching game. (She's the woman at Resort Gorgeous). I don't know what modifies this var -- possibly the game engine itself?

0x403A is used in elevator scripts and is directly modified when special 0xD8 is called. Don't store anything that you want to be permanent in this variable.

Vars 0x4064 through 0x4066 are used as part of the boulder puzzles in Victory Road. They're also cleared upon entering Route 23, along with 0x4067.

0x4069 sets which fossil is being revived in Cinnabar Island, and 0x406A sets the progress (1 = active, 2 = complete).

Code:
LIST OF IDENTIFIED IN-GAME VARS (FIRERED)

4000        Temporary/disposable variable.
            Written to by special E7.
4001        Temporary/disposable variable.
4003        Temporary/disposable variable? Used in TRAINER TOWER.
4006        Temporary/disposable variable? Used in TANOBY KEY.
4008        Temporary/disposable variable? Used in TANOBY KEY.
400E        Temporary/disposable variable? Used in TRAINER TOWER.
400F        Temporary/disposable variable? Used in TRAINER TOWER.
4010        Temporary/disposable variable.
            Written to by (incomplete?) special 142.
4020        Pedometer. It counts down, and upon reaching 0x0000, REPEL expires.
4021        Pedometer. Max value 0x007F; it loops back to 0x0000 after.
4022        Pedometer. Max value 0x0004; it loops back to 0x0000 after.
4023        Pedometer. Max value 0x05DC; it just stays at that value after?
4025        Pedometer? Used for DAISY's script? Haven't seen it in action myself yet.
            Set to 0x01F4 (500) by GAME START SCRIPT.
4031        The starter that the player chose (0, 1, 2).
            Accessed directly by special 129.
4036        Multi-use, for SELPHY's Pokemon-fetching-and-showing game.
            Apparently set to 0x0000 when it's time for a new "round" to start.
            Apparently set to 0xFFFF if you're out of time.
4037        Box that a newly-received (givepokemon) Pokemon was sent to. Is directly manipulated by the game engine 
        itself.
            Read by special 165.
4038        Unknown.
            Read by specials A6 and A9.
            Written to by special A8.
            Used by special AA.
4039        Unknown.
            Written to by specials A6, A7, and A9.
403A        Used in elevator scripts (current floor?). Written to by special 0xD8.
403C        0xXXYY -- the current bank and map, respectively.
403E        Unknown.
            Accessed directly by special 1AC.
4042        Unknown.
            Read by special 167.
4043        Unknown.
            Written to by special 167.
4049        Unknown. Something to do with the sticker kid on FOUR ISLAND.
404A        Unknown. Something to do with the sticker kid on FOUR ISLAND.
404B        Unknown. Something to do with the sticker kid on FOUR ISLAND.
404E        Unknown.
            Written to by special 197.
4050        Unknown or multi-use.
            Set to 0x1 after the "Don't go out yet!" OAK Script event.
            Set to 0x2 during the Hall of Fame room level script, if the National Dex is NOT already unlocked.
            Set to 0x3 after OAK's chat with the player in PALLET TOWN after beating the E4.
4051        Set to 0x2 to disable the "Old Man Needs Coffee" Script event in VIRIDIAN CITY.
4052        Set to 0x1 to disable Script events for Gary in CERULEAN CITY.
4053        Unknown. Set to 0x0 after the player watches the S.S. ANNE depart.
4054        Unknown or multi-use.
            Set to 0x2 to disable Script events for a Rival encounter on ROUTE 22.
            Set to 0x3 after VIRIDIAN CITY Gym Leader GIOVANNI is defeated. Enables next Rival.
            Set to 0x4 to disable Script events for a second Rival encounter on ROUTE 22.
4055        Unknown.
            Is set to 0x0 when the player hasn't encounted PROF. OAK yet.
            Is set to 0x1 when OAK is escorting the player to his lab.
            Is set to 0x2 when the player needs to choose a starter.
            Is set to 0x3 when the player and their Rival have both chosen starters.
            Is set to 0x4 after the player's first battle with their Rival.
            Is set to 0x5 when the player needs to deliver OAK's PARCEL.
            Is set to 0x9 when the player enters PROF. OAK while it is set to 0x8.
            If >= 0x1 and no other events pending, then DAISY comments on a recent Rival battle.
            Set to 0x7 after OAK's chat with the player in PALLET TOWN after beating the E4.
4056        Unknown. If equal to 0x0, "sethealingplace" runs whenever the player enters their bedroom in 
        PALLET TOWN. Another level script then sets the variable to 0x1.
4057        Multi-use.
            Set to 0x1 to disable the OAK's PARCEL level script in VIRIDIAN CITY's PokeMart.
            Set to some other value to enable VIRIDIAN CITY's normal PokeMart script.
4058        Unknown. Checked by DAISY's script in PALLET TOWN. Apparently part of the sequence of events 
        that makes her give away the TOWN MAP.
            Set to 0x2 when DAISY gives away the TOWN MAP.
4059        If != 0x0, then the player beat the Ghost MAROWAK at POKeMON TOWER.
405A        Set to some value to disable the Old Man that blocks the VIRIDIAN CITY Gym.
405B        Multi-use.
            Set to 0x1 to disable Script events for a Rival encounter on the S.S. ANNE.
            Is set to 0x1 when entering LAVENDER TOWN.
405C        If != 0x0, then the player beat Gary at SILPH CO.
405D        If != 0x0, then the player beat Gary at POKeMON TOWER.
405E        Set to 0x0 to disable Script events on the tiles bordering the exits to the CYCLING ROAD 
        gatehouse. Set to 0x1 to disable Script events on the tiles bordering the entrances.
405F        Controls various badge-checking Script events on Route 23.
4060        If >= 0x1, then TEAM ROCKET has left SILPH CO.
4061        Set to 0x1 to disable the Pay-To-Enter Script events in PEWTER CITY's Museum.
4062        Set to 0x1 to disable the thirsty-guard roadblock Script events in the SAFFRON gatehouses.
4064        Unknown or multi-use.
            Reset to 0x0000 when entering Route 23.
            Used as part of the Boulder puzzle scripts in VICTORY ROAD.
4065        Unknown or multi-use.
            Reset to 0x0000 when entering Route 23.
            Used as part of the Boulder puzzle scripts in VICTORY ROAD.
4066        Unknown or multi-use.
            Reset to 0x0000 when entering Route 23.
            Used as part of the Boulder puzzle scripts in VICTORY ROAD.
4067        Unknown. Reset to 0x0000 when entering Route 23.
4068        Set to 0x2 after an Elite Four chamber level script forces the player to walk up. Rechecked 
        later after the E4 battle in that chamber has ended. Reset to 0x0000 in the Hall of Fame room.
4069        Set to 0x1, 0x2, or 0x3 depending on which fossil is being revived at the CINNABAR ISLAND 
        lab.
406A        Fossil revival process. 0x1 means that a revival is in progress. 0x2 means that it is 
        complete.
406B        Set to 0x1 to disable Script events for the Nugget Bridge challenge.
406C        Unknown or multi-use.
            Set to 0x1 to disable the man that traps you in PEWTER until you beat Brock.
            Set to 0x2 to disable Script events for the man that gives Running Shoes at PEWTER.
406E        Safari Zone status.
            Set to 0x0 when not in the SAFARI ZONE.
            Set to 0x1 ...?
            Set to 0x2 after paying to enter the SAFARI ZONE.
406F        I haven't the faintest idea. Used in Pokemon Center 2F level scripts.
4070        Set to 0x1 when talking to some chick in PALLET TOWN that mimics a sign or whatever.
4071        See 408A.
4073        Affects dialogue in the SAFFRON CITY TRAINER FAN CLUB building.
            Is set to 0x1 when the occupants -- your new fans -- swarm you.
4074        Unknown. Checked if != 0x0 in a level script for the woman-who-likes-battles's house (map 
        31.0).
4075        Used in a ONE ISLAND level script. If it equals 0x2, BILL will welcome you to ONE ISLAND, 
        bring you into the PokeCenter to see CELIO, and then the variable will be set to 0x3.
4076        Multi-use, for the RUBY/SAPPHIRE subplot.
            Set to 0x4 if hasn't beaten the ROCKET GRUNTs they eavesdrop on at MT. EMBER?
            Set to 0x5 when the RUBY has been delivered to CELIO on ONE ISLAND.
            Set to 0x6 when the subplot is complete.
            If >= 0x5, VERMILION dockworker acknowledges your RAINBOW PASS. (Travel to SEVII)
            If >= 0x1, VERMILION dockworker acknowledges your TRI-PASS. (Travel to SEVII 1-3)
4078        Affects the commentary and items offered by the shopkeeper on One Island. The variable's 
        value is managed by a TWO ISLAND level script that checks various flags.
            0x4078 == 0x2 means that Lostelle has been rescued.
            0x4078 == 0x3 means that you've beaten all Gyms, but not the Elite Four. (?)
            0x4078 == 0x4 means that the shopkeeper offers items "from distant lands". (Beat E4)
4079        Multi-use, for the LOSTELLE event.
            Set to 0x1 after dealing with a Biker at the TWO ISLAND GAME CORNER.
            Set to 0x2 after rescuing LOSTELLE in BERRY FOREST, before warping to her home.
            Is set to 0x3 when LOSTELLE is reunited with her father.
            Is set to 0x4 when the subplot is complete.
407B        Unknown or multi-use.
            Set to 0x2 to enable the first Script events for the Bikers in THREE ISLAND?
            Set to 0x3 to disable the first Script events for the Bikers in THREE ISLAND.
            Set to 0x4 to disable the second Script events for the Bikers. (They leave.)
407C        Unknown or multi-use.
            Set to 0x1 to ...?
            Set to 0x2 to disable the Pokemon Center 2F level script (TEALA's tutorial).
407D        Set to 0x1 to disable the ROCKET GRUNT Script events behind the broken home in CERULEAN.
407E        Unknown or multi-use.
            Is set to 0x1 after the player helps the S.S. ANNE's captain.
            Is set to 0x2 when the player is stepping out of a boat and into VERMILION CITY or the S.S. ANNE harbor.
            Is set to 0x3 when the S.S. ANNE has departed VERMILION CITY.
407F        Set to 0x2 after a Script event on MT. EMBER, in which the player hears ROCKET GRUNTs talk.
4080        Set to 0x1 after a Script event in ICEFALL CAVE, in which the player assists LORELEI.
4081        Set to 0x1 to disable a Script event blocking access to the Pokemon in the FIGHTING DOJO.
4082        Multi-use.
            Set to 0x0 to enable a Script event at the TRAINER TOWER counter. (A level script 
            on the tower's exterior (Map 3.62) does this.)
            Set to 0x1 to disable a Script event at the TRAINER TOWER counter.
4083        Set to 0x1 upon entering the LOST CAVE room with the lost woman.
4084        Multi-use, for the SELPHY event.
            Set to 0x1 upon rescuing SELPHY from LOST CAVE, before warping to RESORT GORGEOUS.
            Set to 0x2 upon being promptly dismissed from her front door (level script).
4085        Unknown. Used in two level scripts for INDIGO PLATEAU (3.9). Does something if it equals 1.
4086        Set to 0x1 to disable a FOUR ISLAND level script (Gary encounter without battle).
4088        Set to 0x1 to disable Script events in ROCKET WAREHOUSE.
4089        Set to 0x1 to disable a SIX ISLAND (37.0) level script (Gary encounter without battle).
408A        Multi-use, for an event where you meet BILL at CINNABAR ISLAND's PokeCenter, and he leaves on 
        a boat.
            Set to 0x1 upon meeting BILL in the PokeCenter. The same script makes you both leave.
            Is set to 0x1 when used in level scripts that show BILL's departure from the island.
408B        Set to 0x1 to disable the Script events for the fossil guy in MT. MOON.
...
5EF4 - 7FFF    CONFIRMED UNSAFE! In PC box space!
Quote:
Originally Posted by DavidJCobb View Post
Variables under 4000 can't be used because:
  • They overlap RAM used for flags
  • Most script commands don't recognize them as variables
    • Most commands basically do this: "If argument > 0x3FFF, then find the value of variable number argument and use that value. Else, use argument itself as a value."
Some of them have been confirmed unsafe since I last updated that document. The rest are a mystery and could be safe or unsafe.
  • Variables 0x4100 to 0x417F (inclusive) overlap the RAM used for a special data type called "hidden variables" -- a set of 64 dwords used by certain script commands whose purpose is unknown.
  • Variables 0x5084 to 0x55CC overlap RAM used for seemingly-arbitrary data. I haven't noticed any ill effects from overwriting this data, but it changes frequently, so the variables themselves are unreliable.
  • Variables 0x56F4 - 0x5EF3 appear to also overlap RAM used for the PC. This doesn't match with JPAN's findings (the 0x5EF4 figure is from him) so either one of us is wrong, or this variable range overlaps non-essential parts of the PC data.
My suspicion -- an unconfirmed one -- is that the only safe variables are those from 0x4000 to 0x40FF (inclusive), excluding variables in that range that are set or read by the core game engine (as opposed to those used by scripts that can be safely removed).

Basically, you're better off keeping your variables to a minimum. If you find yourself running short on variables, see if flags (or perhaps key items) could be used instead of variables to track the player's progression through different scripts.
In general, only vars 0x4011-0x40FF are the safe. All others overlap different RAM such as PC Boxes or flags, or they are temporary/disposable. That being said, some of the ones in that range are also temporary or used by the games engine. So, just like with flags, you have to be careful. Check the lists, run some tests, delete old events; these are the only ways to truly know of they are safe. Outside of that range; forget about it, you'll end up ruining other events or causing bad eggs.

(Once again, these general rules apply to RSE too, you just won't have a list.)

Script Tiles

This is probably the most confusing thing for a beginner: how to use those green s-tiles in A-map.

Essentially, these tiles will activate the script, which you put in the Script Offset box in the settings, when stepped on. However, it isn't that simple. Look at the picture below:

Spoiler:


You will notice that I circled the boxes for "Var Number" and "Var Value". These are pretty cool. What they allow you to do is prevent a script from running again. As we learned above, vars can be any value up to a little over 65,000. So, what do these have to do with a script running? Well, it is quite simple:

The script will run, if and only if, the var in the box is equal to the value


So, let's say you put the var 0x4050 in the space for a var and 0 in the space for the value. Can you guess what happens? If you said that the script will only run if the var 0x4050 is 0, then you are correct.

Even if you want the script to run every time you step on it, you have to provide a valid var. If you leave the var space blank or at 0, then the script won't run. Just make sure that nothing else changes the var and you will be good.

Now, if you only want your script to run the first time you step on it, or to not run again, just add this line to the end of your script:

Code:
setvar 0x[valid var] 0x[another number other than the one in the value box]
(Remember, all vars that haven't ever been used will be at 0 to begin with.)

So, if we take the situation above where we had the var as 0x4050 and the value at 0 and we don't want the script to run again, simply add this to the end of your script:

Code:
setvar 0x4050 0x1
Make sense?

Now, one last thing: the Unknown. As you can see in the image, the Unknown is set to 0003. This is not necessary. I almost never use it, but most people do use it simply for continuity. It is something that Game Freak, or their compiler for that matter, inserted that has no real purpose that has been identified. It is simply a constant whose use is just personal preference.

Edit: Yeah, I'm awesome and identified the purpose:

Spoiler:
Okay, so today, I finally decided to look into the "unknown" in script tile and person event making in A-Map. You know, the one that everyone says should be 3, if nothing but for consistency's sake? Well, here is the routine that deals with it for script tiles:

r0= First thing, it gets the byte in question loaded to it.
r4= Offset of data for script tile. +4 is the byte in question.
r5= Same as r4.
r6= Nothing (00000000).
r7= 00000003 <- Number of script tiles on map, I believe.
r8= 00000003 <- Compared to r0.

ROM:0806DDF8 LDRB R0, <R4,#4>
ROM:0806DDFA CMP R0, R8
ROM:0806DDFC BEQ loc_806DE02
ROM:0806DDFE CMP R0, #0
ROM:0806DE00 BNE loc_806DE0C
ROM:0806DE02
ROM:0806DE02 loc_806DE02 ; CODE XREF: sub_806DDC0+3Cj
ROM:0806DE02 MOVS R0, R5
ROM:0806DE04 BL sub_806DD80
ROM:0806DE08 CMP R0, #0
ROM:0806DE0A BNE loc_806DE18
ROM:0806DE0C
ROM:0806DE0C loc_806DE0C ; CODE XREF: sub_806DDC0+30j
ROM:0806DE0C ; sub_806DDC0+36j ...
ROM:0806DE0C ADDS R4, #0x10
ROM:0806DE0E ADDS R5, #0x10
ROM:0806DE10 ADDS R6, #1
ROM:0806DE12 CMP R6, R7
ROM:0806DE14 BLT loc_806DDEC

If you can read this, you will see that if the byte is set to 0 or 3, it goes to the exact same place. This place is some code at 0806DD80 which reads the rest of the data, like the var value and script offset and runs them accordingly.

If it is anything but 03 or 00, it jumps ahead to 0806DE0C prematurely, adds 10 to r4 and r5, (which had the offset of the event data). Event data is 10 bytes long, so guess what, it just reads the next event in line.Tongue I haven't actually tested that his happens, but it is a possibility. This belief is reinforced by the two lines at 0806DE12, which only allow the loop to run if there are script tiles remaining to be run.

So, in all reality, it makes no difference if you change this byte at all, just as long as you only change it to 03 if you do change it. Hope this clears some things up!





So, let's recap:


Safe Flags:
->200-2FF
->Flags from events or OWs that have been removed


Safe Vars:
->0x4011-0x40FF
->Make sure you check the list! Some vars have specific functions!


Script Tiles
->Used to make a script run when you step on a specific tile.
->You must provide a var.
->The script will only run if var = value
->To prevent the script from running again, set the var to something else in your script.


If I was unclear about anything or there is something that is still confusing, feel free to leave a message and ask. I will be happy to clear up things and improve this guide!

Credits:

DavidJCobb- for his massive amount of work dealing with flags and vars and what they control.

Jambo51- for helping me understand what is wrong with flags over 0x900 and exactly what vars are safe.

Until next time!
~karatekid552
__________________

Paired with Simba

Last edited by karatekid552; July 20th, 2013 at 05:08 PM.
Reply With Quote
  #2    
Old May 29th, 2013, 04:50 AM
Elaitenstile
I am legend
 
Join Date: Feb 2013
Send a message via Skype™ to Elaitenstile
Yey, I was the second person (after karatekid) to view this thread! Heads up to 2 views!

This is IMMENSELY useful. I'm saying this, because I had a confusion about going-out-of-map-resetting flags. This is what I need.

And vars is something I used to avoid when I was a beginner, and only recently discovered the magic of script-tile vars.

But I do think there is SOME use of the Unknown? Or is there? I'm just really curious.

I'm gonna constantly check this for safe flags/variables.

But can you tell me more about the trainer flags which are 500-700. I want to know if they're safe with JPAN's Hacked FireRed Engine.
__________________
~
Reply With Quote
  #3    
Old May 29th, 2013, 06:15 AM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by ★Hoenn★ View Post
Yey, I was the second person (after karatekid) to view this thread! Heads up to 2 views!

This is IMMENSELY useful. I'm saying this, because I had a confusion about going-out-of-map-resetting flags. This is what I need.

And vars is something I used to avoid when I was a beginner, and only recently discovered the magic of script-tile vars.

But I do think there is SOME use of the Unknown? Or is there? I'm just really curious.

I'm gonna constantly check this for safe flags/variables.

But can you tell me more about the trainer flags which are 500-700. I want to know if they're safe with JPAN's Hacked FireRed Engine.
I'm going to write this big so that people scrolling through will notice it, not because I'm yelling at you.:p

JPAN's engine does NOT make any flags or vars safe.

In fact, it only makes vars not safe because some of its features restrict certain vars to doing certain things.

On regards to the trainer flags, there is flag for each trainer. Just add 0x500 to the trainer's number in A-Trainer to get the flag associated with it. When you beat a trainer, its flag is automatically set by the game. So, the only safe flags in that section are flags for trainers which you will not use, or don't exist.

I'm glad this helped you, hopefully it will help others. The unknown, is just that, unknown. There are quite a bit of things like this in the coding and are often called fillers or constants and they don't do anything other than separate data.
__________________

Paired with Simba
Reply With Quote
  #4    
Old May 30th, 2013, 05:48 AM
kearnseyboy6's Avatar
kearnseyboy6
Aussie's Toughest Mudder
 
Join Date: Dec 2008
Awesome tut! So this means if you plan your script tiles you should only need a single var for 65000 events... mind blown!

Also how do script tiles world with strength boulders? They are used in tanoby key but overworlds don't trigger scripts do they..?
__________________
HOLIDAYING CURRENTLY!!
Reply With Quote
  #5    
Old May 30th, 2013, 06:05 AM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by kearnseyboy6 View Post
Awesome tut! So this means if you plan your script tiles you should only need a single var for 65000 events... mind blown!

Also how do script tiles world with strength boulders? They are used in tanoby key but overworlds don't trigger scripts do they..?
If all of the events take place in order, then why not? Jambo told me that he has only used 3 vars for Platinum Origins so far.

Overworlds do trigger scripts, they are a type of person event.
__________________

Paired with Simba
Reply With Quote
  #6    
Old May 30th, 2013, 01:53 PM
Dragonflye's Avatar
Dragonflye
 
Join Date: Dec 2009
Gender: Male
Can you make a List for Emerlad pls. Thats very nice Work thx.
__________________



Reply With Quote
  #7    
Old May 30th, 2013, 04:22 PM
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com (WIP!)
Community Supporter
 
Join Date: Nov 2012
Location: Earth
Age: 16
Gender: Male
Nature: Quiet
Congrats, I hate to admit it, but I probably jacked up my roms. I've been using flags 1000 all the way to 103E! I'm going to have to do major rearanging...
__________________
Reply With Quote
  #8    
Old May 30th, 2013, 04:49 PM
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
Awesome tutorial!
just a few things i'm wondering though
i opened up the script for the tree in viridian city and it didn't have flag0x011.
also could someone explain to me what the variables from 8000 and above do? they weren't on the list of variables. I've guessed what some of them do, but for others i'm clueless. Help?
Reply With Quote
  #9    
Old May 30th, 2013, 05:18 PM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by Dragonflye View Post
Can you make a List for Emerlad pls. Thats very nice Work thx.
No. I'm sorry but I do not have the time. I have my own hack to worry about, I am still pushing for the community hack, I write many amazing tutorials(:p), I am researching particle effects for moves, I have a life, I play sports, I do volunteer work, I am still in school, and, well, I don't hack Emerald. Why don't you make a list?

Quote:
Originally Posted by pikapoke33 View Post
Awesome tutorial!
just a few things i'm wondering though
i opened up the script for the tree in viridian city and it didn't have flag0x011.
also could someone explain to me what the variables from 8000 and above do? they weren't on the list of variables. I've guessed what some of them do, but for others i'm clueless. Help?
Thank you!

Variables over 8000 are completely temporary. Simple as that. Some have special functions, like one (the number escapes me at the moment) keeps track of the last sprite you talked to, and 0x800D is used as LASTRESULT which is the main var used by ASM to return temporary items.

The flag for the tree goes in its Person ID to keep it hidden after you cut it, but once you leave the map, the flag gets reset and the tree appears again.
__________________

Paired with Simba
Reply With Quote
  #10    
Old May 30th, 2013, 05:28 PM
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
Quote:
Originally Posted by karatekid552 View Post
Thank you!

Variables over 8000 are completely temporary. Simple as that. Some have special functions, like one (the number escapes me at the moment) keeps track of the last sprite you talked to, and 0x800D is used as LASTRESULT which is the main var used by ASM to return temporary items.

The flag for the tree goes in its Person ID to keep it hidden after you cut it, but once you leave the map, the flag gets reset and the tree appears again.
I see. Thank you!
And this might be a stupid question, but would it be possible to change the person id of a tree or rock and thus change the flag it corresponds to?
Reply With Quote
  #11    
Old May 30th, 2013, 05:49 PM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by pikapoke33 View Post
I see. Thank you!
And this might be a stupid question, but would it be possible to change the person id of a tree or rock and thus change the flag it corresponds to?
Simple answer: yes. But it still has to be a temp flag or it won't reset.
__________________

Paired with Simba
Reply With Quote
  #12    
Old May 30th, 2013, 06:28 PM
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
Quote:
Originally Posted by Dragonflye View Post
Can you make a List for Emerlad pls. Thats very nice Work thx.
try going here http://www.pokecommunity.com/showthr...light=worldmap
Reply With Quote
  #13    
Old May 31st, 2013, 02:45 AM
robin22gongon's Avatar
robin22gongon
 
Join Date: Sep 2012
Location: Want to know? VM me.
Age: 16
Gender: Male
Nature: Quirky
Send a message via Windows Live Messenger to robin22gongon
Yay! Finally! I can keep a copy of a tutorial (that never existed before) to keep from forgetting those things! Great job again, karatekid552!
__________________
LET'S PARTY!
Reply With Quote
  #14    
Old July 20th, 2013, 05:08 PM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Okay, so today, I finally decided to look into the "unknown" in script tile and person event making in A-Map. You know, the one that everyone says should be 3, if nothing but for consistency's sake? Well, here is the routine that deals with it for script tiles:

r0= First thing, it gets the byte in question loaded to it.
r4= Offset of data for script tile. +4 is the byte in question.
r5= Same as r4.
r6= Nothing (00000000).
r7= 00000003 <- Number of script tiles on map, I believe.
r8= 00000003 <- Compared to r0.

ROM:0806DDF8 LDRB R0, <R4,#4>
ROM:0806DDFA CMP R0, R8
ROM:0806DDFC BEQ loc_806DE02
ROM:0806DDFE CMP R0, #0
ROM:0806DE00 BNE loc_806DE0C
ROM:0806DE02
ROM:0806DE02 loc_806DE02 ; CODE XREF: sub_806DDC0+3Cj
ROM:0806DE02 MOVS R0, R5
ROM:0806DE04 BL sub_806DD80
ROM:0806DE08 CMP R0, #0
ROM:0806DE0A BNE loc_806DE18
ROM:0806DE0C
ROM:0806DE0C loc_806DE0C ; CODE XREF: sub_806DDC0+30j
ROM:0806DE0C ; sub_806DDC0+36j ...
ROM:0806DE0C ADDS R4, #0x10
ROM:0806DE0E ADDS R5, #0x10
ROM:0806DE10 ADDS R6, #1
ROM:0806DE12 CMP R6, R7
ROM:0806DE14 BLT loc_806DDEC

If you can read this, you will see that if the byte is set to 0 or 3, it goes to the exact same place. This place is some code at 0806DD80 which reads the rest of the data, like the var value and script offset and runs them accordingly.

If it is anything but 03 or 00, it jumps ahead to 0806DE0C prematurely, adds 10 to r4 and r5, (which had the offset of the event data). Event data is 10 bytes long, so guess what, it just reads the next event in line.Tongue I haven't actually tested that his happens, but it is a possibility. This belief is reinforced by the two lines at 0806DE12, which only allow the loop to run if there are script tiles remaining to be run.

So, in all reality, it makes no difference if you change this byte at all, just as long as you only change it to 03 if you do change it. Hope this clears some things up!
__________________

Paired with Simba
Reply With Quote
  #15    
Old August 21st, 2013, 04:55 AM
freddy f1shf1nger's Avatar
freddy f1shf1nger
 
Join Date: Jun 2013
Location: Melbourne Australia
Gender: Male
Thanks, I knew that somewhere somebody would be able to tell me what the badges flags were, cause I needed this for the new gym leaders in my game
Reply With Quote
  #16    
Old August 29th, 2013, 03:30 AM
vongerbys10's Avatar
vongerbys10
 
Join Date: Jun 2013
Gender: Male
Send a message via Skype™ to vongerbys10
How do you identify the free flag and free vars? BTW I am hacking Pokemon Ruby
Reply With Quote
  #17    
Old August 29th, 2013, 04:41 AM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by vongerbys10 View Post
How do you identify the free flag and free vars? BTW I am hacking Pokemon Ruby
You have to go through every single script in the game and write down all flags and vars used. It is super time consuming, but it has been done, as referenced by this guid.
__________________

Paired with Simba
Reply With Quote
  #18    
Old August 29th, 2013, 11:21 AM
NarutoActor's Avatar
NarutoActor
The rocks cry out to me
Community Supporter
 
Join Date: Jan 2009
Location: Brooklyn/Marlboro
Age: 21
Gender: Female
Nature: Bashful
Send a message via AIM to NarutoActor Send a message via Windows Live Messenger to NarutoActor
This is a very good tutorial I will recommend it to any beginners who come to me asking for advice, I wish this thread was around when I first started hacking, vars and flags were very confusing when I first started out.
__________________
~There are those people who understand hex, F the rest
Reply With Quote
  #19    
Old November 4th, 2013, 12:57 PM
AkameTheBulbasaur's Avatar
AkameTheBulbasaur
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place
Age: 17
Gender: Female
Nature: Relaxed
So, what exactly happens if/when you use flags over 0x900, because I used a bunch over that and nothing happened to my ROM yet.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
Reply With Quote
  #20    
Old November 5th, 2013, 07:51 AM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by AkameTheBulbasaur View Post
So, what exactly happens if/when you use flags over 0x900, because I used a bunch over that and nothing happened to my ROM yet.
Nothing happens, until you try to use vars. Flags over 0x900 are stored in the exact same ram location as vars 0x4000 and up. Do you see the issue? And then, all vars above 0x40FF are in PC Box space. There are 8 flags per byte, and two bytes per var, so, that is 0xFF x 16d, which is 0xFF0. So, that + 0x900 flags, is flag 0x18F0. That will be the first flag that will corrupt the pokemon in your PC, but you don't know which slot or pokemon it will be due to DMA shifting, if I remember correctly.

So:
flags 0->0x8FF are flags.

flags 0x900->0x18F0 are in the same area as vars 0x4000->0x40FF

and finally:

vars 0x40FF+ and vars 0x18F0+ are in the same place as the pokemon in your PC.


You may no notice the effects yet, but once you want to use vars for events, you will find that flags become unset and other issues will arise.
__________________

Paired with Simba
Reply With Quote
  #21    
Old November 5th, 2013, 01:53 PM
AkameTheBulbasaur's Avatar
AkameTheBulbasaur
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place
Age: 17
Gender: Female
Nature: Relaxed
Okay thanks! So if I don't have any vars, then it'll be fine. My hack is 99.9% complete so I didn't want to have to do a bunch of rearranging if I didn't have to. I ever knew how to use vars well anyway. Again, thanks for clearing that up.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
Reply With Quote
  #22    
Old November 5th, 2013, 05:39 PM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by AkameTheBulbasaur View Post
Okay thanks! So if I don't have any vars, then it'll be fine. My hack is 99.9% complete so I didn't want to have to do a bunch of rearranging if I didn't have to. I ever knew how to use vars well anyway. Again, thanks for clearing that up.
but, but, vars are sooo much more useful. Umm, some vars, like 0x4000->0x4005 are temporary, meaning that area of ram resets on warp. So, those flags will also reset. Also, certain events are solely controlled by vars, so be careful and so some math to see which var you are corrupting.
__________________

Paired with Simba
Reply With Quote
  #23    
Old November 8th, 2013, 03:33 PM
mf91
 
Join Date: Sep 2013
Hi

Im browsing around, trying to learn about vars, flags and all this stuff. I totally get the whole idea behind your tutorial, but I have some tiny questions about how it works.

setvar 0x4050 0x1 <-- What happens with the var here?? Does the 0x1 change the var number, or is it like a "toggle" inside the variable? The var value you set, is that what you set the variable to, or is it what you set the game to check the variable for? Or rather, with 0000 in this box, and you play the game - is the variable now set to 0x0, or does it compare the variable to 0x0 (because you entered 0000)? And is it a default value for this?

I hope what Im asking is not too confusing its just the basic functionality that Im missing.
Reply With Quote
  #24    
Old November 8th, 2013, 04:50 PM
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote:
Originally Posted by mf91 View Post
Hi

Im browsing around, trying to learn about vars, flags and all this stuff. I totally get the whole idea behind your tutorial, but I have some tiny questions about how it works.

setvar 0x4050 0x1 <-- What happens with the var here?? Does the 0x1 change the var number, or is it like a "toggle" inside the variable? The var value you set, is that what you set the variable to, or is it what you set the game to check the variable for? Or rather, with 0000 in this box, and you play the game - is the variable now set to 0x0, or does it compare the variable to 0x0 (because you entered 0000)? And is it a default value for this?

I hope what Im asking is not too confusing its just the basic functionality that Im missing.
A var always starts at 0x0000. If you have ever programmed, you have used vars. If you have ever done algebra, you have used vars. Vars are variables. They can be anything. In high-level programming, they have names like "place_to_store_stuff" and you can set it to whatever you want. In math, it is almost always X.

Now, a variable is a memory location that you use to store data in. Here, these are two byte data locations accessed by their number, which in this case is 0x4050. So, by doing setvar 0x4050 0x1, you are storing 01 at the location of var 0x4050 for later access. Think of the var number like a book cover on an encyclopedia. Most of the time with encyclopedia volumes, all there is, is a name and a number on the cover. inside is what counts. So here, setvar 0x4050 0x1, is essentially changing the pages of that book.

Understand?
__________________

Paired with Simba
Reply With Quote
  #25    
Old November 8th, 2013, 11:34 PM
mf91
 
Join Date: Sep 2013
Quote:
Originally Posted by karatekid552 View Post
A var always starts at 0x0000. If you have ever programmed, you have used vars. If you have ever done algebra, you have used vars. Vars are variables. They can be anything. In high-level programming, they have names like "place_to_store_stuff" and you can set it to whatever you want. In math, it is almost always X.

Now, a variable is a memory location that you use to store data in. Here, these are two byte data locations accessed by their number, which in this case is 0x4050. So, by doing setvar 0x4050 0x1, you are storing 01 at the location of var 0x4050 for later access. Think of the var number like a book cover on an encyclopedia. Most of the time with encyclopedia volumes, all there is, is a name and a number on the cover. inside is what counts. So here, setvar 0x4050 0x1, is essentially changing the pages of that book.

Understand?
Thanks for reply

I have had some basic Java and C++, so I know what a variable is.. Very basic tough! But yeah, I think I get it now! Just to be 100% sure, you could say setvar 0x4050 0x1 would be int 4050 = 1 basically? And everything from 0x0000 to 0xFFFF are variables the game can use?

I guess what made me a bit confused is the random use of 1 and 4 numbers as the value, which probably is very common in languages I havent used yet. What is the value set to; 0x0001 or 0x1000?
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 12:17 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.