(Scene opens on a shot of the Flynn-Fletcher house.)
Gretchen: (offscreen) So we all need to be...
(Cut to the backyard where Gretchen is making a presentation to Phineas, Baljeet, Ferb, and Buford with a diagram on an easel and a pointer.)
Gretchen (cont'd): ...prepared. You'll want to find a safe place and establish a defensive perimeter.
Baljeet: Like in the basement?
Gretchen: No! You never go in the basement!
Candace: What is going on here?
Gretchen: It's just our bi-monthly Zombie Apocalypse preparedness lecture.
Phineas: Yeah! You're welcome to join us. Ya might learn something.
Candace: Puh-leez, Phineas. There's nothing about zombies that I don't know.
Ferb: Did you know there's one standing behind you?
Candace: AAH!! ...Very funny.
Phineas: Ha! Good one, bro.
Isabella: Phineas, Pinky's missing!
Phineas: Aw, that's too bad, Isabella.
Buford: Chihuahuas, that's the first thing zombies go for.
Phineas: Uh, we moved past zombies, Buford.
Isabella: He's been gone all morning! He didn't even touch his breakfast burrito. What am I going to do?
Gretchen: We could put up posters.
Buford: We could do nothing.
Phineas: We could make a portable positronic canine detector using the olfactory receptors that Ferb and I were gonna use for our milligram scale purification study.
Isabella: Let's do that one!
Candace: You kids have fun. Really, I wish I could stay and bust you but I have a lunch date with Jeremy down at City Hall.
Baljeet: City Hall serves lunch?
Buford: I thought they only served subpoenas! (pause) Oh, come on! What's a guy gotta do to get a rimshot around here?!
(Baljeet groans and walks away.)
Candace: For your information, I'm going down to City Hall because Jeremy's working the Slushy Dawg concession stand at the food court there. And we're gonna have lunch...together. But don't worry, Isabella. I'm sure Pinky'll turn up. Perry always does. Speaking of which, where is Perry?
Isabella: And where's Pinky?
Buford: And where's that breakfast burrito? (Baljeet plays a rimshot on the drums.) Ah, there's my guy!

(Cut to Agent P's lair. Perry lands in his chair next to a familiar looking canine agent already seated there.)
Major Monogram: Ah, Agent P. I believe you know Agent Pinky. (Cut to a shot of Agent Pinky, shaking, next to Agent P.) Agent Pinky informs us that Doof intends to steal the deed to the Tri-State Area from the City Hall archives. It seems he's discovered that whoever has the deed automatically becomes the ruler. It's an old law from a simpler time. You'll find that Agent Pinky is quite an asset, Agent P. He's good with computers, covert ops, and, quite frankly, he needs the hours. So get out there and stop Doofenshmirtz! Good luck, Agents P and, uh...P! (Agents P and Pinky leave) I guess you're just two "P's" in a pod. (chuckles) Carl, where's my rimshot?
Carl: (offscreen) It's right in front of you.
Major Monogram: (picks up a flyer with the words "Ba-Dum Crash" and a picture of a snare drum on it) How did you do that?!

(Cut to City Hall. Cut to inside to reveal Candace reading a directory.)
Candace: Now I am here, but the best way to the food court is...
Tour Guide: Is by taking the mandatory city hall tour!
Candace: But—
Tour Guide: Wouldn't want a bunch of uninformed people wandering around City Hall!
Candace: But—
Tourist: You can't fight it. I've been on this tour since this morning and I've been caught trying to escape twice!
Tour Guide: (strictly) No talking back there! (enthusiastically) Now, follow me to a world of bureaucratic action and adventure!

(Cut to outside the building. Perry and Pinky parachute down. Pinky gets practically buried in his own parachute when he lands. Perry pulls him from under the parachute and slams open the door and sees a very long line of people waiting. The agents approach Doof who is standing in line with a box in his hands.)
Doofenshmirtz: Perry the Platypus? No way! What a coincidence! (to the person behind him) Excuse me, if you and your mullet would just take one step to the... Thank you. (to Perry) Oh, look! You brought your little dog, too! How cute! Oh, FYI, I don't think they allow dogs in here. So, y'know, watch out for that. Anyway, I bet you're wondering why I'm in City Hall, right? Well, I plan to go down into the secret City Hall vault and steal the— Oh, y-you know that, right. (huffs) Right, right, of course. That's probably why you're here. To stop me, right? (opening his box) What you probably don't know is how I will get into the vault without being noticed. (takes out an inator helmet from the box) Behold! My Blend-Into-The-Background-intaor. I will be able to search the vault and steal the hidden deed, because, like they say, it's easier to find a hidden object when you're hidden as well. Right. Th-Th-Th-That's the thing. They say that. Anyway, (puts helmet on) I place the inator on my head, like so, I press this button and, now I'm here (disappears) and I'm blended in (becomes visible again) I'm here, (disappears) I'm gone! (reappears) I'm here, I'm go— Oh, my head! I hope there's no long-term damage from this, but—ugh! Anyway, I bet you think I forgot to trap you. Well, surprise! You're already bureaucracy! You see, you don't have a number, Perry the Platypus, so by the time you and your little dog get into the archives, I will already be ruler (disappears) of the Tri-State Area!! (He laughs and exits)
(Perry slides up to the door.)
Female Bureaucrat: I'm sorry, you cannot go in there without a number, sir. (Pinky slides behind him.) Oh, please don't tell me you brought your dog!

(Cut to the backyard. Baljeet and Isabella are watching as Phineas and Ferb lower a helmet shaped like a dog's head onto Buford.)
Phineas: Behold, the Dog Sensomatic Helmet! It will amplify Buford's senses to those of a dog. (The helmet drops onto Buford's head.) So, Buford, uh, what do you smell now?
Buford: I think I can smell the future!
Phineas: It's working!
Isabella: Do you smell Pinky yet?
Buford: I smell somethin'! (sniffs) I smell... (sniffs and runs off) I smell bacon!
Baljeet and Isabella: No, Buford, wait!
Phineas: Uh-oh.

(Song: "Watchin' and Waitin'" (instrumental))
(Cut to Candace on the tour.)
Tour Guide: Now, this is a very old painting depicting John P. Tristate and Otto H. Adjacent
Candace: Excuse me, I just need to get to the food court.
Tour Guide: Please hold all your questions to the end. Those are the rules. (Candace walks backwards) Also, please refrain from gum chewing and there are no pets allowed on the tour. Also there are no cutsies or halfsies for funsies. (Candace attempts to unhook one of the velvet ropes.) And absolutely no crossing the stanchions, please! ¡No cruzar la cuerda por favor!

(Cut to invisible Doof going to the elevator and pushing down.)
Doofenshmirtz: To the basement! (a man walks up to the buttons and attempts to press up) Aah! Quit it! Fresh! (looks at the buttons) Alright, lessee, garage, basement, catacombs, pessimistic humanoid underground dwellings...Ah! Here it is: gift shop and secret vault! (Pushes the button.)
(Cut to a shot from under the elevator to reveal laser beams turning off. The elevator goes down.)

(Cut to Isabella rubbing a bone on Buford's belly.)

Isabella: Who's a good boy?!
Who's a good boy?!
You're a good boy!
Yes, you are!
Yes, you are!

Buford: It's me, right?
I'm a good boy?
You mean me, right?

Baljeet: Isabella, how does this help us with Pinky?
Isabella: Easy, I've been rubbing his belly with Pinky's squeak toy. Now he's got the scent!
Buford: (pointing) He's this way! I can smell it!
Isabella: Good boy!
Buford: Yeah! I'm a good boy, right?!
Isabella: Yes, you are!
Buford: Huh? Oh! That had better not be the mailman!
Isabella: (chasing after him) No, Buford, you're s'posed to be finding Pinky!

(Cut to the City Hall vault. Doof jumps out of the elevator.)
Doofenshmirtz: What kinda elevator falls at the speed of gravity? Why did they even put an elevator there? I coulda just jumped down the shaft or... (gasps) The deed! Well, I guess it's not...not all that hidden, then, is it? Well, maybe it's just easier to find 'cause I'm hidden! Yes, I (reappears) knew that was a real saying! Come to Papa! (gasps)
(The elevator doors reopen to reveal Perry and Pinky.)
Doofenshmirtz: Perry the Platypus?! Oh, and your pet dog. How did you escape the clutches of bureaucracy? (Perry holds up a piece of paper with the number "7" on it.) Oh, oh, you took a number. I guess the line wasn't as long as I thought. But you're too late! (disappears again) Once I get outside, I will own the Tri-State Area! (Pinky kicks Doof into the ground as he reappears again and a bunch of rolled up papers fall on the ground) W-Which one is it? Oh, great, now I'm confused!!

(Cut to the tour where we see two glass boxes with miniature depictions of "Ain't Got Rhythm" and "Impress My Professor")
Tour Guide: And over here are the spontaneous musical number dioramas.
Candace: The huh?
Tour Guide: Ooh, Danville is known for its spontaneous musical numbers. For instance...

(Song: "The History of the Tri-State Area")
A lot of people know that the Tri-State Area
Used to be a Bi-State Area with an Adjacent Area over there;
What people don't know is that originally it was three distinct
Single-State Areas, but people don't care.

The founders of the Area were independent thinkers,
Completely unaffected by bureaucratic hurdles
And that's why the Capitol building was moved here from Sri Lanka
On the backs of seven giant sea turtles.

It's the history of an area, the Tri-State Area,
Formed mostly from adobe and seaweed;
If you've heard it different elsewhere, that's historical hysteria,
So stop believing everything you read!

Over here's a diorama of the first diorama
Of Vincent Diorama, who lived right here!
When I say "right here", I mean in this very room,
'Til we moved him to a studio apartment last year.

It's the history of an area, the Tri-State Area,
Don't mean to cause a ruckus or a fuss;
It's the birthplace of the onion and the Danville cafeteria,
And home of Bigfoot's hairless cousin, us!

It's the history of an area, the Tri-State Area,
Where planet Venus holds some office space;
Try to think of someplace better, well I double-dog-dare ya,
But if you can't, then get out of my face!

It's the

Tour Guide and male tour patrons: History of the Tri-State Area!

Background singer: History of the

Background singer, Candace, and female tour patrons: Tri-State Area!

Background singer: Area!

Tour Guide: And now, step this way for the history of the history of accounting.
(All tour patrons groan.)

(Cut back to the vault where Perry, Pinky and Doof are searching among the papers for the deed.)
Doofenshmirtz: Okay, lessee, the Declaration of Independence, the Magna Carta, the Deed to the Tri-State Are—I mean the Mayflower Compact? Ha ha! (goes in the elevator with the "Mayflower Compact" and disappears) Goodbye, Perry the Platypus!
(Perry takes out his grappling hook and he and Pinky go up with the elevator.)

(Cut to a City Hall door. Pan down to reveal a doggy door.)
Buford: Oh! Oh! In here! Follow Buford!
(Buford goes through the doggy door)
Phineas: Hey, guys, he went here!
Isabella: I think Buford found him!
Baljeet: Really? A doggy door in a municipal building that does not allow dogs?
(Cut to Perry on a balcony watching Doof. He presses a button and a gate comes down on a door.)
Doofenshmirtz: What the?! Who did that?
Isabella: This way, everyone!
(Pan down to reveal Pinky standing near a statue in the middle of the room. Perry looks left and right. Zoom in on the Blend-into-the-Background-inator. Perry takes out his grappling hook and swings.)
Doofenshmirtz: Lessee, how do you get outta here, now? (Perry swipes the inator off of Doof.) Hey!
(The gang follows Buford as he continues to sniff.)
Buford: Huh? Another dog! Dis way! (He jumps forward)
Isabella: Oh, I hope it's Pinky!
(Perry drops on Pinky and activates the inator. Buford looks around and sniffs the inator.)
Buford: Right here! Right here, he—What? (takes off his helmet) He should be right here! Oh, man!
Phineas: I don't get it. Well, maybe the helmet needs to be fine-tuned.
Buford: (puts helmet on the floor) Yeah, you guys do that. I'm gonna go get a Slushy Dawg.
(Cut to a computer with the text "COMPUTER LOCK OVERRIDE:" being typed onto it.)
Doofenshmirtz: R-I-D-E, colon. (The text "PASSWORD: _______________" appears) Password? Oh, good! I'm r-really good at passwords! Okay, lessee...Uh, how about, uh, "Reindeer flotilla", ah, and send. (The gate raises.) Ha ha! Yes! Now, I'll just take this deed outside and I'll be the ruler of the— (Perry drops down) Perry the Platypus?! (Pinky walks up to him) And your little dog, too?! You're both persistent, I'll give ya that, but the security system is offline and there's nothing you or your little dog friend can do about it! Y'know, unless, one of you happens to be really good with computers.
Major Monogram's Voice: Agent Pinky is good with computers...good with computers...good with computers...
(Perry whistles and Pinky looks at the computer and gives a thumbs up. He takes the computer down from the pedestal and whacks Doof on the head with it. Doof lets go of the deed and Perry grabs it.)
Doofenshmirtz: Wow! That guy is really good with computers!

(Cut back to the tour)
Tour Guide: Now who's ready to see the whole tour again?
All but Candace: Run!!!
(Everyone runs away except Candace.)
Candace: Actually, the song part was nice.
Tour Guide: Oh, ya like the song, do ya? Well... (As he's about to sing again, Pinky, back in mindless animal mode, walks up to Candace) Hey! Hold it! Is that a dog?!
Candace: Hey, it's Pinky! (picks him up)
Tour Guide: I'm sorry, no dogs allowed! This tour is officially over!

Isabella: (running up to Candace) Candace! Candace, you found him! Thank you! (Candace gives Pinky to Isabella) You said he'd turn up and he did!
(Perry walks up)
Candace: Oh, there you are, Perry!
Phineas: Way to go, Candace! (picks up Perry) C'mon, you two wandering pets! Who wants a breakfast burrito?
Buford: I do!
Candace: Exactly how long have you worked here at City Hall?
Tour Guide: Oh, I don't work here. I was sent by Yarnak to help uninformed citizens in need! Now, if you'll excuse me, I am needed elsewhere! Whoosh! (he runs off)

Jeremy: Hey, Candace! Where were you?
Candace: I'm sorry I missed lunch, Jeremy, but this weird guy made me go on a tour.
Jeremy: That's Don. He's, uh, kind of a fixture around here.
(Don reappears running wearing the dog helmet and carrying the deed.)
Don: I'm the ruler of the Tri-State Area!
(Cut to a shot of the rimshot flyer as a real rimshot is heard in the background.)

End Credits

Doofenshmirtz: Oh, great, now I'm confused!
Don: It's the history of an area, the Tri-State Area,
Don't mean to cause a ruckus or a fuss;
It's the birthplace of the onion and the Danville cafeteria,
And home of Bigfoot's hairless cousin, us!

It's the history of an area, the Tri-State Area,
Where planet Venus holds some office space;
Try to think of someplace better, well I double-dog-dare ya,
But if you can't, then get out of my face!

It's the

Don and male tour patrons: History of the Tri-State Area!

Background singer: History of the

Background singer, Candace, and female tour patrons: Tri-State Area!

Background singer: Area!