Jump to content
MakeWebGames

Brewery Mod


-BRAIDZ-

Recommended Posts

brewery.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Sql:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Add items:

Bottle of Beer

Bottle of Whiskey

Bottle of Cider

Bottle of Vodka

You will just have to change the item id in the code.

Save this image as "brewery.jpg" and add it to your images folder on your database:

[ATTACH]2103[/ATTACH]

I would like to thank [MENTION=67703]adamhull[/MENTION] for the help with parts of my code.

 

If you have any problems with the script mail me

Edit your inventory.php file.

And add for each item id

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Just change item id

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

And so on,you should get the drift now.

brewery.jpg.58a94e68d69eafa46fa45f783987595e.jpg

Edited by -BRAIDZ-
Link to comment
Share on other sites

Below is a compiled list of constructive criticism.

 

 

Overall, nice for your first. However, it could be refactored for easier flexibility, expandability, and less functions with hardcoded values.

Edited by sniko
Link to comment
Share on other sites

More dynamic would be better so that you can set the types of alcohol to brew and all the settings for that type. Then you would only need like 3 of those functions. Also, this script can use some heavy optimizing. You call global variables where they are not even used, you stack queries on top of eachother that are updating the same table, and you flood the users table with more useless fields.

You should create a separate table that hold all the stuff for the users brewing. You can create a table for that with fields such as an ID, userid, brew type, and time last brewed and use that info to determine if they can brew that type again.

Basically what [MENTION=65371]sniko[/MENTION] said haha. I took too long to post and he got in while I was typing

Link to comment
Share on other sites

Below is a compiled list of constructive criticism.

 

 

Overall, nice for your first. However, it could be refactored for easier flexibility, expandability, and less functions with hardcoded values.

 

Thanks mate.

But there is only one way to learn and that is what I am doing.

I will go through and see what I can fix up.

I know the code is messy as, but what can you expect for someone only just starting out.

But thank you for saying it's a nice mod, and thank you for the criticism.

This is one way of learning.

And by doing it myself also.

I hope everyone else likes it as well :)

I will not take full credit for the mod as I have had a little bit of help with it

Link to comment
Share on other sites

  • 2 months later...

Here it is, converted for RC Engine.

I only have one problem with though, the mod it self is fully functioning, its just the queries are not working..

Not too sure where I have gone wrong, but I have been trying to get them working for ages now.

Also, I have taken out the item use (drink) functions for RC and will be creating new items for RC Engine for this mod, so there will be different item numbers..

And will be coding them into itemuse.php

The changes to the sql table:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Converted code:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Here it is, converted for RC Engine.

I only have one problem with though, the mod it self is fully functioning, its just the queries are not working..

Not too sure where I have gone wrong, but I have been trying to get them working for ages now.

Also, I have taken out the item use (drink) functions for RC and will be creating new items for RC Engine for this mod, so there will be different item numbers..

And will be coding them into itemuse.php

The changes to the sql table:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Converted code:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Link to comment
Share on other sites

 

Thanks, but I did not ask for any criticism.

I know my coding is horrible, and I use the mysql_real_escape_string() because the whole RC Engine does..

Now what I did ask, was about my queries, where am I stuffing up with them for them not to work?

Link to comment
Share on other sites

Thanks, but I did not ask for any criticism.

I know my coding is horrible, and I use the mysql_real_escape_string() because the whole RC Engine does..

Now what I did ask, was about my queries, where am I stuffing up with them for them not to work?

 

Thanks, but I did not ask for any criticism.

And by that logic, I can say you didn't ask for no criticism. Life doesn't work like this, buddy.

 

I know my coding is horrible, and I use the mysql_real_escape_string() because the whole RC Engine does..

Then break the mould. Just because another (shoddy) developer did something differently/wrong, you shouldn't copy them.

 

Now what I did ask, was about my queries, where am I stuffing up with them for them not to work?

Which queries, specifically?

Link to comment
Share on other sites

And by that logic, I can say you didn't ask for no criticism. Life doesn't work like this, buddy.

 

Then break the mould. Just because another (shoddy) developer did something differently/wrong, you shouldn't copy them.

 

Which queries, specifically?

All of the queries, they aren't working, they wont put anything into the database....

Link to comment
Share on other sites

All of the queries, they aren't working, they wont put anything into the database....

You're using ' (quote mark) instead of ` (back tick) causing a SQL error (line 272). If you knew how to debug properly - or even attempted a debug - you would have realised your mistake.

Link to comment
Share on other sites

You're using ' (quote mark) instead of ` (back tick) causing a SQL error (line 272). If you knew how to debug properly - or even attempted a debug - you would have realised your mistake.

This forum is obsessed with using back ticks on table and column names.

It's bad practice to use back ticks on everything, you only need to use back ticks for reserved MySQL words.

Link to comment
Share on other sites

This forum is obsessed with using back ticks on table and column names.

It's bad practice to use back ticks on everything, you only need to use back ticks for reserved MySQL words.

Its probably because people just copy/paste the output from phpmyadmin.

Don't use INT(11) for everything

I have been told by a colleague that working with INT's compared to small/tiny INT's is more efficient, modern CPUs are designed to work better with 32-bit values. Granted you use up more space but in this day and age where you get TB of storage for next to nothing it dosent matter about the 16 bits you will save per record.

Link to comment
Share on other sites

Its probably because people just copy/paste the output from phpmyadmin.

 

I have been told by a colleague that working with INT's compared to small/tiny INT's is more efficient, modern CPUs are designed to work better with 32-bit values. Granted you use up more space but in this day and age where you get TB of storage for next to nothing it dosent matter about the 16 bits you will save per record.

I always use INT(11) or BIGINT(25) depending on what for, the mod is now working,

I removed the quotation marks, and didn't add in any back ticks, works fine now...

And removed the endpage function (because [MENTION=67703]adamhull[/MENTION]) said it is not needed...

Link to comment
Share on other sites

I always use INT(11) or BIGINT(25) depending on what for, the mod is now working,

I removed the quotation marks, and didn't add in any back ticks, works fine now...

And removed the endpage function (because @adamhull) said it is not needed...

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

is the function that has all the footer infromation and the die; function for Mccodes if i am correct and the engine you use has no use for it

Link to comment
Share on other sites

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

is the function that has all the footer infromation and the die; function for Mccodes if i am correct and the engine you use has no use for it

All the

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Functions have been removed..

So do I need the die; functions or not?..

Sorry I didn't quite understand that...

Link to comment
Share on other sites

Huh? I mean so when someone loads my game on a mobile device, it loads in like a mobile site? And you do have to zoom in constantly to see what you're doing

There we go - you're learning to be specific in your requests.

You're going to need a script to detect the device the client is on.

This won't be easy as I assume you don't use a template engine and everything is in one view (business logic and view logic) - so if you need help, open a new thread.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...