Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-12-2012, 07:39 AM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 77,703
AlexC is an unknown quantity at this point
Default Exploration System

Alright, so a while ago I took it upon myself to try and figure out a simple exploration script. Just something easy, where my members could look for items or pets, and I thought I'd share the script with you all.

The system is;

+ Non cheatable. Most people won't be able to figure out how to save at a certain point
+ Simple - very little coding is used. No huge thing to walk through.
+ Can be embedded in any layout
+ RANDOM - this is a non-narrated adventure.

So yeah, this actually wasn't very hard to make, the hardest part was finding a random link selector. I consider it rather easy to edit, but HOWEVER: there is a downfall to the easy to edit part - the "randomly selected" thing is included in the header of every individual page - I advise you mass edit, which I'll go over later.

LET'S GET TO IT SHALL WE?

So, to start, you'll need the page itself. Go and find your blank.php and copy it. Rename it whatever you want - for this, we'll go with "explore.php".

Between the "START SCRIPT" and "OUTPUT PAGE" things, place this:

Code:
$article_title = "Explore The Forest";
$article_content = "<div style='text-align:left;'>You have decided to take some of your pets exploring down in the park. It's a beautiful day and you'd just love an adventure right about now...</div><br /><br><iframe src='http://yoursite.com/explore/0.html' frameborder='0' height='400' width='700'></iframe> ";
Yeah, I know, everyone hates iframes - but guess what, in this case, iframes will help you so your members won't be able to save at a certain spot (say, on a rare pet link) and so you don't actually have to make a billion pages. You'll only need explore.php to actually be on your site, the rest is something else altogether (though it does involve pages).

Step two, is to change what it says up there. That's a copy of what's on my site and I'll be very upset if you don't change it. You'll want to change...

- Title ($article_title = "Explore The Forest")
- Content (You have decided to take some of your pets exploring down in the park. It's a beautiful day and you'd just love an adventure right about now...)
- Width (width='700')
- URL (http://yoursite.com/)

Step Three. Create a directory, folder or whatever your host is calling them. Call it something like "Explore" or "Explore Pages" - we'll just go with "Explore".

Step Four. Take this file below here and make a page titled "0.html" in your "Explore" folder.

Code:
<html>
<head>
 <script type="text/javascript"><!--
var links = new Array();
links[0]="1.html";
links[1]="2.html";
links[2]="3.html";   
links[3]="4.html";
links[4]="5.html";
links[5]="6.html";
links[6]="7.html";
links[7]="8.html";   
links[8]="9.html";
links[9]="10.html";

function getRandomLink() {
	var randomNum = Math.floor(Math.random()*links.length);
	window.location = links[randomNum];
}
//--></script>
</head>

<body>

Insert little welcome message about how everyone is happy and the sun is shining, and ask which way they'd like to go.


<br><br><br><br><br>

<table border="0" align="center">
<tr align="center">
  <td></td>
  <td><form name="" action="">
	<input type="button" value="Go Ahead!" onclick="getRandomLink()" />
</form></td>
  <td></td>
</tr>
<tr>
  <td><form name="" action="">
	<input type="button" value="Go Left!" onclick="getRandomLink()" />
</form></td>
  <td></td>
  <td><form name="" action="">
	<input type="button" value="Go Right!" onclick="getRandomLink()" />
</form></td>
</tr>
<tr align="center">
  <td></td>
  <td><form name="" action="">
	<input type="button" value="Go Back!" onclick="getRandomLink()" />
</form></td>
  <td></td>
</tr>
</table>

</body>
<html>
Alright, so this is going to be the starter page of your little explore system. Notice on the link list I don't have 0.html - means this page won't be repeated at all.

So, for the rest, you'll want to make ten copies of this 0.html page, and name them 1.html, 2.html, etc, etc. Then give each of them a different message. Most of them won't be much of anything - to increase the odds of getting certain messages, repeat them. So you can have nine messages about a weird looking flower and one about finding a rare pet under said flower.

And that's it! Almost.

Just a quick note that I said I would say; Mass editing. As you can see, the link selector is placed in the header of every single page. I wasn't sure how to put it in its own file (that'll be an update somewhere in the future). So if you plan to have fifty pages, I would recommend writing out fifty, pasting it into your ten and then just slowly making the pages afterwards, with the fifty links already in. Also, if you want to say, add ten or twenty pages in the future, don't do them one by one, do them all at once and add the links all at once. Tedious, I know, but hey - if you don't like it, don't use it.

So yeah, now I'm done. Hopefully it wasn't too confusing. Hopefully I can edit this over time and make it a little better. Credit would be nice - I didn't put it in the script anywhere, but maybe if you want to mention somewhere that Gloometh made the script, that'd be nice. If you've got an questions, suggestions, complaints, feel free to post them.
__________________

Last edited by AlexC; 03-12-2012 at 01:11 PM.
Reply With Quote
  #2  
Old 03-12-2012, 10:17 PM
Nemesis's Avatar
Nemesis Nemesis is offline
Member
 
Join Date: Mar 2011
Location: Ohio, United States
Posts: 641
Gender: Male
Credits: 56,975
Nemesis is on a distinguished road
Default

If i find the time will try this.. good job though!
__________________
https://gemnode.com
Free Hosting for Mysidia Adopt Sites
Just join our forum and request your free hosting account
Reply With Quote
  #3  
Old 03-12-2012, 10:23 PM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 77,703
AlexC is an unknown quantity at this point
Default

Thanks - it's a little time consuming to write out, but otherwise pretty easy.
Reply With Quote
  #4  
Old 03-13-2012, 02:41 AM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 24,723
mapleblade
Default

why not try PHP instead?
PHP Code:
$random rand(1,50);

if(
$random >&& $random 20){
$article_title "You found a Rock";
$article_content "You only found a rock, <a href="explore.php">Head on</a>";
// possible query, or -1 steps query
}
elseif(
$random =>21 && $random =< 40){
$article_title "You found a Flower";
$article_content "You only found a flower, <a href="explore.php">Head on</a>";
// possible query, or -1 steps query
}
elseif(
$random =>41 && $random =< 49){
// potion recieve query
$article_title "You found a Potion";
$article_content "You only found a potion, <a href="explore.php">Head on</a>";

}
elseif(
$random == 50){
// potion recieve query
$article_title "You found a rare adoptable";
$article_content "You found a rare adoptable hiding in the bushes, he seems to like you, and you take him home, it looks like his species is ADOPTABLE <a href="explore.php">Head on</a>";

}else{
$article_content "Error";
$article_title "There went something wrong.";

This will also stop spamming the page that u find an adoptable, since its not /1.html but all on the same page.
__________________
Need coding help? send me a PM! :)

Last edited by mapleblade; 03-13-2012 at 02:52 AM.
Reply With Quote
  #5  
Old 03-13-2012, 08:33 AM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 77,703
AlexC is an unknown quantity at this point
Default

I don't know that much about php, so I can't really code form scratch...
Reply With Quote
  #6  
Old 03-13-2012, 09:05 AM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 24,723
mapleblade
Default

ah.. well my script shoud work if you want to use it :)
__________________
Need coding help? send me a PM! :)
Reply With Quote
  #7  
Old 03-13-2012, 10:45 AM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 77,703
AlexC is an unknown quantity at this point
Default

I'll stick with my version, because taking yours would mean I really didn't make it. Feel free to post yours though.
Reply With Quote
  #8  
Old 12-06-2014, 03:23 PM
AndromedaKerova's Avatar
AndromedaKerova AndromedaKerova is offline
ChibiFur Queen
 
Join Date: Nov 2014
Location: England
Posts: 83
Gender: Female
Credits: 4,220
AndromedaKerova is on a distinguished road
Default

From what I can tell, it would generate pages saying something like "you found a pet/item/coin" and a link to continue exploring but I don't see how it would actually give people anything.

Also, in the blank.php I don't see anything to do with "START SCRIPT" and "OUTPUT PAGE"
Only:
Code:
<?php

class BlankController extends AppController{

    public function __construct(){
        parent::__construct();	
    }
	
	public function index(){

	}
}
?>
__________________
Failing at being normal since 1990.

Last edited by AndromedaKerova; 12-06-2014 at 03:26 PM.
Reply With Quote
  #9  
Old 12-07-2014, 07:05 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 110,066
Kyttias is on a distinguished road
Default

This thread was made for an earlier version of Mysidia and pages are not rendered in the same way anymore.

I know that in 1.3.4 that for each page there are two: one to hold complex code, and one to render the page. It's helpful to bounce to a second file for complex code, especially when forms are involved. I don't actually know how to get around having two files, even though one is fundamentally going to be blank if it's useless to you.

Perhaps you can glean from my example:

I have map.php, and it contains merely this blank class (and the contents from blank.php work just as well, to base an example off of):
PHP Code:
<?php

class MapController extends AppController{}

?>
And in the view folder, I have mapview.php:
PHP Code:
<?php
class MapView extends View{
    
    public function 
index(){
        
$document $this->document;    
        
$document->setTitle("Novul World Map");    
        
$document->add(new Comment("<img name='NovuMap' src='http://fc01.deviantart.net/fs70/f/2014/308/9/d/map_small_by_kyttias-d85blb1.png' usemap='#M_NovuMap' style='border: 1px solid #ccc;'>"));
        
$document->add(new Comment('<map name="M_NovuMap">
                <area alt="woods" title="" href="#" shape="poly" coords="224,39,246,70,215,130,174,135,153,115,157,88" />
                <area alt="harbor" title="" href="#" shape="poly" coords="152,127,195,158,206,199,207,229,187,252,161,266,129,268,91,236,84,199,104,172,135,150" />
                <area alt="maple thicket" title="" href="#" shape="poly" coords="78,259,143,289,140,314,143,335,128,358,91,376,51,347,43,300" />
                <area alt="bay" title="" href="#" shape="poly" coords="150,330,183,346,227,327,230,276,205,241,173,267,149,282" />
                <area alt="hills" title="" href="#" shape="poly" coords="219,244,263,214,304,221,335,264,286,309,240,310,236,274" />
                <area alt="jungle" title="" href="#" shape="poly" coords="224,335,252,390,311,422,377,438,408,354,371,312,306,312,239,319" />
                <area alt="marsh" title="" href="#" shape="poly" coords="249,399,276,423,256,485,225,489,138,478,84,426,102,403,120,395,118,382,136,363,188,395,226,403" />
                <area alt="mangroves" title="" href="#" shape="poly" coords="319,438,296,467,302,492,425,493,427,465,415,441" />
                <area alt="kelp forest" title="" href="#" shape="poly" coords="423,433,437,470,459,491,496,490,527,475,530,438,515,407,483,412,438,419" />
                <area alt="plateau" title="" href="#" shape="poly" coords="430,362,473,406,507,391,519,378,525,343,502,295,466,292,433,303" />
                <area alt="mountains" title="" href="#" shape="poly" coords="361,199,396,199,413,205,426,225,453,247,475,259,490,288,448,291,428,308,365,299,337,279,341,251,320,217" />
                <area alt="farmland" title="" href="#" shape="poly" coords="546,261,560,289,624,295,684,282,715,222,654,196" />
                <area alt="beach" title="" href="#" shape="poly" coords="580,73,577,107,603,137,632,160,673,168,693,166,680,130,638,121,616,87" />
                <area alt="plains" title="" href="#" shape="poly" coords="553,28,511,61,441,73,384,29,402,9,500,3" />
                <area alt="desert" title="" href="#" shape="poly" coords="540,75,423,94,411,141,430,202,487,235,563,238,608,204,593,142" />
                <area alt="volcano" title="" href="#" shape="poly" coords="304,107,361,130,370,166,352,195,316,205,283,195,256,180,263,121" />
                <area alt="brambles" title="" href="#" shape="poly" coords="279,11,266,49,279,90,315,102,369,99,406,61,385,38,342,8" />
            </map>
        '
));

    } 
#end index
#end MapView
?>
My page contains an image map (there's a couple of handy generators for this, here's one). I don't have links associated with the locations yet, but you get the idea?

While this is not an exploration system in the sense that the original post has, I hope it explains how pages are rendered a little better? I'm trying to write up some vague documentation based on things I've learned about Mysidia, you can find that here.

***

edit: And to imitate exactly what the original post has, try this--

explore.php:
PHP Code:
<?php

class ExploreController extends AppController{}

?>
view/exploreview.php:
PHP Code:
<?php
class ExploreView extends View{
    
    public function 
index(){
        
$document $this->document;        

        
$document->setTitle("Exploring *Location*");
        
$document->add(new Comment("<div style='text-align:left;'>You have decided to take some of your pets exploring down in the park. It's a beautiful day and you'd just love an adventure right about now...</div><br /><br><iframe src='http://yoursite.com/explore/0.html' frameborder='0' height='400' width='700'></iframe>"));

    } 
#end index
#end ExploreView
?>
I can't particularly help you with the rest of it.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 12-07-2014 at 07:13 AM.
Reply With Quote
  #10  
Old 12-07-2014, 11:13 AM
ilrak ilrak is offline
Goldfish Fanatic
 
Join Date: Aug 2014
Location: Utah
Posts: 57
Gender: Female
Credits: 12,719
ilrak is on a distinguished road
Default

This is really helpful! I was looking for something similar (I've been trying to do an image map for shops and such). This is awesome! Thank you!
Reply With Quote
Reply


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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trade System Kyttias Questions and Supports 4 05-29-2016 12:29 AM
Dev Rambling: Exploration System Kyttias Programming and Game Development 4 01-27-2015 01:54 AM
Abandon system bokkun Mys v1.1.x Mods 30 11-16-2010 10:19 PM
Trade System? sensacion Questions and Supports 5 08-20-2010 11:36 AM
Trade System? SieghartZeke Questions and Supports 1 12-28-2009 07:06 AM


All times are GMT -5. The time now is 08:21 PM.

Currently Active Users: 752 (0 members and 752 guests)
Threads: 4,081, Posts: 32,029, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636