Jump to content
Ding

Coding a Hatchery

Recommended Posts

Anyone want to help me with my MySQL dilemna? I don't know what any of those things mean. Field, VARCHAR, Attricbutes, This, That.... What does it mean??!? I'm so confused about it! Someone.... help us.

Share this post


Link to post

Anyone want to help me with my MySQL dilemna? I don't know what any of those things mean. Field, VARCHAR, Attricbutes, This, That.... What does it mean??!? I'm so confused about it! Someone.... help us.

Did you read the tutorial in the first post? Or search online for other tutorials if you don't like that one? Or search specifically for the confusing parts? The linked one looks like it explains quite a bit, and I'm sure there are plenty of others out there, as well, if you just look.

Share this post


Link to post
Did you read the tutorial in the first post? Or search online for other tutorials if you don't like that one? Or search specifically for the confusing parts? The linked one looks like it explains quite a bit, and I'm sure there are plenty of others out there, as well, if you just look.

I did and I tried to figure out what anything means. Sadly, I didn't get it. sad.gif I want to kill this thing.... RAWRGH

 

Should I try again?

 

I'll try reading it again.

Share this post


Link to post

I just made the MySQL table for an ER. I put 2 values. One was id (For scroll) and the other Dragon. Now what do I do from here?

 

D:

Share this post


Link to post
I just made the MySQL table for an ER. I put 2 values. One was id (For scroll) and the other Dragon. Now what do I do from here?

 

I think the next step would be to test if you can enter data obtained from a form via a PHP script into the table.

 

Then in theory, viewers can use this form to enter let's say their scroll name and the dragon's code they want to ER and it would be stored in the database until whenever.

 

I found out how to do this here: http://www.tizag.com/mysqlTutorial/index.php

 

That part is really pretty simple but I would suggest starting from the beginning of this tut and working on to where you need to be, which is how to obtain data from a form and put it into a table.

The beginning part is important because it will teach you how, through PHP, to connect to the right server, database, and table. All that good stuff biggrin.gif

 

 

 

Share this post


Link to post

what would I use to make the site, like something free like Google site maker

Though I don't know very much about Google's site maker (I usually do all my coding in notepad laugh.gif ) I'm sure you could. But I don't know if that's your best option offhand.

 

My assumption is it needs to be someplace you have access to all the coding and the server were your databases are, and that can handle a lot of viewer traffic if the site really takes off.

 

There's also a lot of host options out there with varying degrees of bandwidth available for your site. For example some are free but you might have to deal with third party ads on your site, some are ad free but you might be limited on how much bandwidth your allowed per like month or how much file space you can use. Other hosts you have to pay for and they'll have their own varying prices and features for subscribing.

 

 

Share this post


Link to post
what would I use to make the site, like something free like Google site maker

I know that google site maker does NOT have the ability to handle PHP. Use 000webhost.com (Which is what I use) and upload your .php files to the FTP server. biggrin.gif Once that is done, go to your sites name and then /whateveryourfilesnameis.php and you will see all your code displayed there and what it should look like. Say if you write <center>Hello World</center> in your PHP script.

 

You would get a Hello World in the center of the page against a white solid background. My website was made using 000webhost.com: dc-mm.co.cc

 

I didn't use the site builder. I created that from scratch. biggrin.gif

Share this post


Link to post

I made an Auto-Refresher with PHP. biggrin.gif And it works. So yea. It is obviously on my site.

Share this post


Link to post

Hey,

Well me and a friend we arent at all educated in any coding (well a little html) and we made a "hatchery" out of the codes jamelia gives you its not amazing it was done in not even 10 minutes just wanted to get it out there that you could use they're codes for the hatchery and customize everything else.

If y'all dont mind ill give the link

www.tinyurl.com/DCemergenciez

We didnt customize it or anything just made it and we did put at the bottom that we didnt acctually make any of the site

 

Share this post


Link to post

I made an ER/Nursery/Nest with months of searching. Now I need to figure out how to work the API. Can anyone help me?? People are adding adults and it is bothering me. And I need to know how to make those little arrows WORK. Please HELP!

 

Link: The DC-MM ER/Nursery/Nest

Edited by Rebsingh

Share this post


Link to post

I'd love to make my own hatchery, especially since there's been so many problems with the existing ones I use.

 

This may be a really stupid question, but would I need to purchase my own domain to host my hatchery or are there free web hosts that will allow me to use php coding to build a hatchery?

Share this post


Link to post

There are tons of free ones that allow php, etc. The question seems to be more whether they'll accept the sort of traffic and F5-mashing that DC causes. On the order of "some might, but good luck finding them", I'd imagine. But to practice quietly while you work out how to even make the site, the free ones should be ok.

Share this post


Link to post

Ah thanks very much for that. smile.gif

 

Now to figure out what an API key is and what the heck it does/how to use it. *scuttles off to Google*

Share this post


Link to post

THings I have done so far:

 

Skeleton of the ER/Nursery/Nest

Dragon remover

MySQL Database (Which is currently displaying the dragons)

Dragon adder

Length checker

Alpha-numeric checker

Gotten API Access (Twice lol)

A checker to see if the dragon is already in the database

 

Things I need

Figure out how to use the API and stop people from adding adults (Can someone help me on this?)

Fun little things biggrin.gif

 

My ER/Nursery/Nest

Edited by Rebsingh

Share this post


Link to post
THings I have done so far:

 

Skeleton of the ER/Nursery/Nest

Dragon remover

MySQL Database (Which is currently displaying the dragons)

Dragon adder

Length checker

Alpha-numeric checker

Gotten API Access (Twice lol)

A checker to see if the dragon is already in the database

 

Things I need

Figure out how to use the API and stop people from adding adults (Can someone help me on this?)

Fun little things biggrin.gif

 

My ER/Nursery/Nest

That's awesome! Well done! Sadly though my knowledge of using the API is slim to none.

 

Maybe there's some mention of how to exclude adults in the API txt file? I haven't looked at it in a while so, I can't recall offhand.

Share this post


Link to post

Hey Rebsingh,

Good work =) To get the hours left that a dragon has, you can use code like this:

$code = $_POST['code']; //replace 'code' with the name of the textbox that is used to submit a dragon code

$data = unserialize(file_get_contents('http://dragcave.net/api/PRIVATE_KEY_HERE/serialize/view/'.$code));

$hrsleft = $data['dragons'][$code]['hoursleft'];

 

Now $hrsleft should contain the number of hours left for a dragon to live. This will help you to prevent adults from being added to a site, because the hoursleft value for adults/frozens is -1, and for deads it's -2. So if you use a condition something like 'if ($hrsleft < 0)', that will allow your code to tell the difference between growing and non-growing dragons. ^^'

Share this post


Link to post

Thanks so much for your help!

 

But it keeps adding adults.... let me show you my code:

 

***EDIT***

My bad, I didn't update the page xd.png

 

IT WORKED! biggrin.gif *HUGGLES VERY HARD*

Edited by Rebsingh

Share this post


Link to post

Awww people can still add non-existent eggs!!

 

Is there a way I can fix that?

Share this post


Link to post

Yep, here's a quote from the API help file which should help you fix that:

Error Codes:

The API output may contain an error array. If something goes wrong, this array will be filled with information about what didn't work.

0: Notice

1: Invalid Action - The specified action does was not one of the above-listed actions.

2: Missing/Invalid parameter - The specified action requires a parameter, but none were given or parameter was invalid (See action description for what qualifies as "valid").

3: Not found - The specified user/dragon does not exist or could not be found.

4: User error - Something is "wrong" with the user's account. Either it is disabled, or they have no dragons.

foreach($data['errors'] as $error) {
 	if($error[0] == 3) {echo "Sorry, we were unable to find a dragon with that code."; return;}
 }

Good luck with this <3 I went and tried out the hatchery, and so far it seems to be working quite nicely!

Share this post


Link to post
Yep, here's a quote from the API help file which should help you fix that:

 

Good luck with this <3 I went and tried out the hatchery, and so far it seems to be working quite nicely!

It worked! biggrin.gif How are you so good at this? xd.png

 

*Huggles very hard again*

Share this post


Link to post

One more API question:

 

How would I make a scroll reader? I just don't really get the API. People have to add individual codes and I want them to enter scroll name and it displays their eggs and hatchlings and little checkboxes next to them like Silvis layer and how Soti used to be. o.O

Share this post


Link to post
You do realise that there are a couple of examples in http://dragcave.net/api.txt that you can modify to get the answer.

 

It is even easier if you know how to code.

I do know how to code. And I'll take down the MM image, don't worry. wink.gif I just made an ER btw http://dcmm.webege.com/sitebuttons/DCER/DCER.php

 

biggrin.gif

 

And Soti, sorry for being really annoying on the MM Forums, I don't think they are for me. I'll just enjoy the game instead.

Share this post


Link to post

would anyone happen to know the language wiki templates use? i'm having difficulty coding something over there...

 

edit: Nvm, Wikipedia is mai friend

Edited by votehim

Share this post


Link to post

  • Recently Browsing   0 members

    No registered users viewing this page.