EDIT (5/23/12) I am no longer updating this (seeing as I no longer am working on MM2+). But please note this tutorial is apparently outdated and may not work properly with the main script without lots of extra work.
Alright, so since MM2+ is heavily explore based I have to do this a lot   XD So I figured I'd post up a tutorial to maybe help some people make   their own systems! Now note:
MY EXPLORE SYSTEM IS NOT 100% COMPLETE
Thus, I will be posting this information as I go through.
Also:
I'm going to assume each part is long and will go over the   limit per post (because my code kindly already does this XD) And it'll   be easier to see each separate part. :D 
EDIT: Actually I just tested, it wouldn't go over this magical limit (hopefully) but it'll make it easier so I can link to the second/third post to save you the scrolling :3 
The three parts of this tutorial will be:
-'Simple' NPC interactive with user-Complete
-Exploring, finding, seeking, etc-Nearly done
-Extra stuff (finding something, interacting with the environment, getting a new adoptable, etc, etc)-Not started? IDK
So now for 
PART 1!!!
Part 1--NPC Interaction
Your user is stuck in the randomness of empty space of the internet OH   NO!!! But wait! There's a random person here too! Oh! IT'S AN NPC *shot*
NPC stands for Non-Person-Controlled. Basically it's a character   who is not controlled by you, but can still interact (or not?) with   their environment given user input. 
So now we need some information before we make our code. We need to make this NPC. Here's some things to keep in mind:
	Quote:
	
	
		| 
			
				 -Name- 
Seriously, you need one. Unless it's some random dude who   wears a cloak (not a Mewtwo reference) who you don't know who it is you   can not have a name. But otherwise make a name. You could do something   common like Bob, or Mary, or Chris, or Susan or something, so do   something epical like Huyji, Frezro, etc. Also feel free to make up   based upon stuff, like if you have a fire lizard go ahead with Char,   Blaze, Fiora, etc as a name :3 
-Species- 
Is it a human? Is it a talking dog? Is it some magical   made up creature? Make sure people know (images can do good or a quick   discrete description) 
-Looks- 
whether you character looks like you might want to make   clear so the user can visualize the situation. (Images are good once   again). Maybe the person is tall and looms over peeps, maybe they're   really small so you have to pick them up in your hand to speak to them.  
-Speech- 
How do they talk? Do they use proper grammar? Do they use   slang? What about accents? Or occasionally shifting to their native   language. NOTE: Under no means use chatspeak! It looks VERY   unprofessional... 
 
			
		 | 
	
	
 Here's some quick examples (all the same saying just   different ways of saying it):
"Hello there!"
"Hiya!"
"Well hello there!"
"Howdy!"
"Hola!"
"Welcome stranger!"
And so on! If I can make one phrase in 6+ different ways you can make your characters speeches the same!
Now that we got our speech complete maybe we begin coding! But you need   to plan! Where are these/this people/person? Are they in a snowy field,  a  volcano, a jungle? 
For the sake of this example we'll be in a 
magical forest (shush). In   this magical forest there are mysteries, so what would someone do in a   new place? Ask for help!
Now we begin coding!
Part 1b--Beginning the code
So what you need to do is find a file in your main folder called   "blank.php". On your computer, right click the file and go down to copy   (yours might have a duplicate button, IDK), after you've copied it  right  click again (not on a file, on a blank space in your folder) and  hit  'paste'. Your pasted document should be called "blank copy.php" If  not  it'll ask you to rename it or change it's name to "blank (2).php".   Either way just accept that. Now rename your file to something you can   remember, I suggest not 'explore.php' since you might want more explore   areas. For this example we'll be using a fake file called  "forest.php".
Now open up your file and go down to "Output to user". Underneath that we'll begin our quest! But first paste in:
	PHP Code:
	
		
			
$act = $_GET["act"];
$act = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $act);
$act = secure($act);
$num = $_GET["num"];
$num = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $num);
$num = secure($num); 
		
	
 Act is for the action, and 
Num is for speech (you'll see in a bit)
Now we can't just throw ourselves into a conversation! Introduce the area, what do you see?
So now we add:
	PHP Code:
	
		
			
if ($act == ""){
$article_title = "Magical Forest!";
$article_content = "You find yourself in a Magical Forest. Many small   dragons dance about in the sunlit air (blah, blah, add more  description,  don't take mine please) Oh look a dragon! It seems  friendly want to go  talk to it?<br><br>
<a href='/forest.php?act=talk'>Talk to the dragon!</a><br>
<a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>";
} 
		
	
 So the 
$act == "" is just saying when nothing is defined. But   wait! My first link has defined an $act for us! It's called '
talk'. 
So we need to define this conversation, but we don't just jump right in! We need to introduce the situation 
So in order to do that we must define 
$act == talk! Let's do that now:
	PHP Code:
	
		
			
else if ($act == "talk"){
$article_title = "Talking";
$article_content = "You head over to take to the dragon, but as you do   so another dragon and a puppy come over as well. 'Hello there!' shouts   the purple, serpentine female dragon, 'Can we help you with something?   My name is Lavendra, and this is my mate Kyto. That's Fluffy.'  She  says  this while pointing to the dragon first, then the puppy. She  smiles at  you and waits for a response. The orange male watches you,  not sure if  he trusts you. The puppy honestly doesn't care and is just  rolling  around in the grass.<br><br>
<a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
<a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
<a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
<a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>";
} 
		
	
 So now we add even more areas we need to define! We have two   characters to speak with, and a single character to interact with! The   bottom link is for those people who want to explore but we're not there   yet 
So the conversation for Lavendra and Kyto is exactly the same, excluding   what they say exactly and how they say it. Since they are the same  I'll  walk you through Lavendra and assume you can do others as well  after  this 
So now we start with a simple definition of 
$act == lavendra and 
$num==0:
	PHP Code:
	
		
			
else if ($act == "lavendra"){
$article_title = "Lavendra";
    if ($num == "0") {
    $article_content = "Lavendra: 'What can I do for you?'<br><br>";
    }
    else {
    $article_content = "Lavendra: 'I'm sorry I don't understand, what can I do for you?'<br><br>";
    }
    $article_content = $article_content."<a href='/forest.php?act=talk2'>You: 'Nevermind.'</a>";
} 
		
	
 Now you see the two extra elements I added? Since the 'greeting'   is in 0 and we are defining conversation by number, what if the user   wants to be sneaky or an error occurs and a wrong number is entered?   Just make the character not understand.
The last bit is to end the conversation, you need this so you   can...well...stop talking XD You see it's called '
talk2' I'll explain   that in a second. 
But that's boring, a simple "How can I help you" then stop talking? No!   We need to talk! Let's now define a question, how about we ask them   about Kyto? He's an interesting guy.
	PHP Code:
	
		
			
else if ($act == "lavendra"){
$article_title = "Lavendra";
    if ($num == "0") {
    $article_content = "Lavendra: 'What can I do for you?'<br><br>";
    }
    else if ($num == "1"){
    $article_content = "Lavendra: 'Oh Kyto? He's my mate!' She smiles at   this, 'We've been together for over one hundred years. I've heard this   is a long time for you humans. He isn't very human-friendly though, he   was attacked as a child you see...Anyway, can I help you with  something  else?'<br><br>";
     }
    else {
    $article_content = "Lavendra: 'I'm sorry I don't understand, what can I do for you?'<br><br>";
    }
    if ($num != "1"){
    $article_content = $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about   Kyto.'</a><br>";
     }
    $article_content = $article_content."<a href='/forest.php?act=talk2'>You: 'Nevermind.'</a>";
} 
		
	
 Right, so now I've added in two key areas. We've added in the   conversation about Kyto and a link to this conversation. Now you may   have noticed the "
if ($num != "1") " around the Kyto question link. This   is because we do not want to re-ask the question we are on! So if we   are on '
num=1' we do not want a link for '
num=1'. For those who did not   know 
!= means 'does not equal'. 
Now  we can add as many more topics as we want! Just remember to make a  link  to each one and make each a new number. So here's our example  again  after adding some more!
	PHP Code:
	
		
			
else if ($act == "lavendra"){
$article_title = "Lavendra";
    if ($num == "0") {
    $article_content = "Lavendra: 'What can I do for you?'<br><br>";
    }
    else if ($num == "1"){
    $article_content = "Lavendra: 'Oh Kyto? He's my mate!' She smiles at   this, 'We've been together for over one hundred years. I've heard this   is a long time for you humans. He isn't very human-friendly though, he   was attacked as a child you see...Anyway, can I help you with  something  else?'<br><br>";
     }
    else if ($num == "2"){
     $article_content = "Lavendra: 'Fluffy is the cutest, lil' puppy   ever! And that's all you need to know! Can I help you with something   else?'<br><br>";
      }
    else if ($num == "3"){
     $article_content = "Lavendra: 'This forest is a MAGICAL forest.   Serious, what more do you need to know than that?...Anyway, can I help   you with something  else?'<br><br>";
      }
      else {
    $article_content = "Lavendra: 'I'm sorry I don't understand, what can I do for you?'<br><br>";
    }
    if ($num != "1"){
    $article_content = $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about   Kyto.'</a><br>";
     }
    if ($num != "2"){
     $article_content = $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about  Fluffy.'</a><br>";
      }
     if ($num != "3"){
     $article_content = $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about this  forest.'</a><br>";
      }
     $article_content = $article_content."<a href='/forest.php?act=talk2'>You: 'Nevermind.'</a>";
} 
		
	
 There, now we see a bit more of the world beginning to develop!   You can add as much conversation topics as you want too. You can also   add follow-up questions by setting the "
if ($num == "#")" the # being   the number of the conversation you are responding to 
Once  again you can add as many characters as you want interacting in  this  fashion. The only thing you need to change is the "
else if($act ==   "name")", "
$article_title", and the actual answers.
But what about a non-speaking NPC who just reacts? Like say...
A PUPPY!!! 
 What if we want to go ahead and pet the cute puppy! Well let's do that shall we?
Part 1c-Petting The Puppy (etc)
Now if you remember our talk page one of the links was 
Pet Fluffy! (see the third link?):
	PHP Code:
	
		
			
else if ($act == "talk"){
$article_title = "Talking";
$article_content = "You head over to take to the dragon, but as you do   so another dragon and a puppy come over as well. 'Hello there!' shouts   the purple, serpentine female dragon, 'Can we help you with something?   My name is Lavendra, and this is my mate Kyto. That's Fluffy.'  She  says  this while pointing to the dragon first, then the puppy. She  smiles at  you and waits for a response. The orange male watches you,  not sure if  he trusts you. The puppy honestly doesn't care and is just  rolling  around in the grass.<br><br>
<a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
<a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
<a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
<a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>";
} 
		
	
 Now you should notice something right away. There is no   "
&num=0". This is because it is not necessarily needed. If you want   to add more interactions once you select to interact with the puppy  just  follow the above but paste in our finished code (excluding the  $
num !=)
So first we need to define the actual subpage of our puppy:
	PHP Code:
	
		
			
else if ($act == "fluffy"){
    $rand = rand(0,1);
    $article_title = "Fluffy";
    if ($rand == 0){
    $article_content = "Fluffy just keeps rolling on the grass and ignores you.";
    }
    else if ($rand == 1){
    $article_content = "Fluffy lets you pet him. He barks happily while you do so.";
    }
    else {
    $article_content = "Fluffy completely ignores you and walks away.";
    }
    $article_content = $article_content."<br><br>
    <a href='/forest.php?act=fluffy'>Pet Fluffy again</a><br>
    <a href='/forest.php?act=talk2'>Stop petting Fluffy</a>";
} 
		
	
 Now you'll see I actually just finished the whole code for you! Shocking isn't it? Now what 
do we have here? Well I'll explain.
First, you are defining to new subpage of Fluffy. Fluffy is subpage worthy 
Secondly, you are defining a 
rand number with this statement:
	PHP Code:
	
		
			
     $rand = rand(0,1); 
		
	
 This specific statement will create a  random  number between 0 and 1 (ie, 1 or 0) and make the variable 
$rand  equal  that number. 
Next we define the article title, pretty boring? XD
Fourth,  we are defining all the random actions this puppy could do. For   simplicity I only added 3. The first two are actions the puppy does   while the 3rd is just in case of an error we have our backs covered.
	PHP Code:
	
		
			
    if ($rand == 0){
    $article_content = "Fluffy just keeps rolling on the grass and ignores you.";
    }
    else if ($rand == 1){
    $article_content = "Fluffy lets you pet him. He barks happily while you do so.";
    }
    else {
    $article_content = "Fluffy completely ignores you and walks away.";
    } 
		
	
 And at long last we end with an option to continue  petting this  cute bundle of fur or to just stop. (the  
<br><br> right  after our random action is to prevent the  first link from latching onto  the end of our random paragraph)
NOTE: When working with random outcomes it's always good to keep in mind a couple times. 
1) The less options you have the higher chance of a repeat. Since I only have two that chance is extremely high.
2)  Every time you add a new outcome MAKE SURE to change the second  number  in the 
$rand to be equal to that of your highest number, that'll  make  sure all your options work. 
Now you may ask: 
Are we done now? NO! We still have to make the '
talk2', '
talk3' and '
enter' work!
Part 1d-Talk2, Talk 3, and Enter
Okay, so now we have already defined links for '
talk2' and '
enter', but  what are these exactly? We'll begin with 
Talk2 and 
Talk3.
Now if you remember '
talk' is when we first met these dragon, we don't  know who they are, we just got there. But after chatting with them you  do know them a bit better, also they'll be standing there and not  walking into the picture.
'
talk2' is just like '
talk' because it lists the people you can converse  with but it changes the 
$article_content because the people are already  there and we know them a bit better. So just to put simply your 
talk2  should look a bit like:
	PHP Code:
	
		
			
else if ($act == "talk2"){
 $article_title = "Talking";
 $article_content = "After chatting, you turn back to the main group.  Fluffy is just rolling around at the feet of Lavendra and Kyto, while  those two both watch you. What will you do?<br><br>
 <a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
 <a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
 <a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
 <a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>";
 } 
		
	
 See? easy! Just like before!
But now you must wonder why we need 
ANOTHER talk. '
talk3' is for when you return from your valiant exploration!
	PHP Code:
	
		
			
else if ($act == "talk3"){
 $article_title = "Talking";
 $article_content = "You come back from exploring to find the group in the same place. What will you do?<br><br>
 <a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
 <a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
 <a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
 <a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>";
 } 
		
	
 And there! Done! Easy right?
But what is this '
enter'? Why is it so special? Well that actually has to wait for 
part 2 XD
BUT! Keep thinking of a few things! 
-What areas are there to explore? Yeah, yeah it's a forest, but what's  
IN the forest? Maybe a thicket, maybe deeper in the forest, maybe a  stream, or whatnot! These 'subareas' will be defined in part 2, as well  as what you can find/interact with while exploring!
-What can you find? Pets, items, money, nothing, new areas, etc! And yes I just stated everything I will cover XD (note: items is not, item items, because I do not know that 
YET. It's just items as in OMG I FOUND A BOTTLE *action**action**action*)
-How can you interact with your environment?
-What does the landscape look like? Yes, you'll need to make images for 
part 2
-How should the page be set up? More will come later but basically it'll have an 
Event, an 
Image, and a 
Description of the Event.