That is not a script. It is an event. Be very careful to use the correct terms as they mean VERY different things in RPG Maker.
I can only see part of the event, and it doesn't include the command to add him to the party or what you do afterwards. So I am going on an assumption here and saying you simply need a third page with no sprite, conditioned by a self switch. After adding him to your party, turn on the self switch.