First number is the species number, in hex. Bulbsaur is easy as it is #1, so 0x1 is used. Pikachu is #25, so we would use 0x19. Second number is the level (also in hex), 3rd number is the hold item it comes with - you can find the values for items and Pokémon here.
fanfare plays a tune, the values of which can be found in the 'header' section of Advance-Map. Msgbox number 0x4 means that the box stays open until closeonkeypress happens, and the player presses A. waitfanfare just means that the box can only be closed after the jingle plays fully.
setflag 0x828 is the Pokémon Menu flag (as that is needed to view your Pokémon). Msgbox number 0x5 gives a Yes/No choice box.
compare LASTRESULT 0x1 is a way of saying "Did the player say yes?", if they did then the script gosubs to @name, which calls the Pokémon naming routine call 0x1A74EB. Which automatically comes back with the return command. If the player answers no then the script just continues.
applymovement is used if you want a person event to walk around, turn around, or show [!] [?][:D] emote things. All you need is the event number and a pointer to which movements you want. waitmovement 0x0 then means the script will not continue until the movement is completed. hidesprite makes the sprite disappear and the flag is to make the disappearance permanent.
This is how you organise movements:
#raw 0x11 0x11 0x11 0x11 0xFE
In this example 0x11 happens 4 times, 0x11 means 'Move up 1'. Always remember to include '0xFE' to the end as that signifies the end of the movement.
For simplicity imagine that 'setflag' changes the value from 0 -> 1. 'clearflag' changes the value from 1 -> 0.
Here is a script to demonstrate flag use in changing what happens:
faceplayer checkflag 0x500
if 0x1 goto @FlagIsSet
msgbox @Talk1 0x6 setflag 0x500
msgbox @Talk2 0x6 clearflag 0x500
= Let's set the flag!
= The flag is set, let's clear it!
The line under 'checkflag 0x500' is important, it means that when 0x500 is set (value = 1) then the script shoulg to to @FlagIsSet rather than carry on. This script should therefore alternate between the two messages every time you talk to the person event.
Ah that's a problem that crops up a lot, the issue is that 'hidesprite' is only temporary, to make it permanent you need to also set a flag, somewhere in the script (there might be one already), then you use that as the event's "Person ID" in Advancemap.