Cless Posted June 28, 2007 Share Posted June 28, 2007 Hello, Not sure what the topic for this should be, so I named it Roughly two or three questions. Lol. Uhm, yeah. My questions are: How do you store Money? (I'm quite sure you wouldn't use a variable, as, variables are only temporary). Also, how would you store equipment or items? (Like, on an RPG). My friend also wants to know how to store characters statistics, and giving how to give the character items. So, like, the item gets added to the player's inventory. Thanks! Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 28, 2007 Share Posted June 28, 2007 Well I store money in a bank. (not what you asking, so be more clear) For the second part your talking a series of mySQL tables that are linked with primary keys. However if you can't grasb this basic idea i don't think your quite ready to be making your own php game Quote Link to comment Share on other sites More sharing options...
Dark Nonique Posted June 28, 2007 Share Posted June 28, 2007 Hmm, Cless, you wouldn't happen to know a guy by the name of JoJo would you? And why not just use variables, but store the items and such in a SQL? Quote Link to comment Share on other sites More sharing options...
Cless Posted June 28, 2007 Author Share Posted June 28, 2007 I mean... um, allowing the character to have money to buy items and such with, on the game. Lol. I'm not making one yet, what I'm doing is practicing, and have learned most of the stuff, however, I needed to know some of these things. But, yeah, I mostly understand what you are talking about. Thanks. PS. Dark Nonique? Ah, yes. I know JoJo. An Administrator of TPF. Also, how could I use variables? Aren't variables only temporary? So, when the script ends, the money would be 0 again. Quote Link to comment Share on other sites More sharing options...
xkyogre Posted June 28, 2007 Share Posted June 28, 2007 Yes unless you post it through a form, a session, a cookie or, as mensioned in a mysql table. Does that answer your question? PS. I am also making a php game so take my advice and use a mysql database Quote Link to comment Share on other sites More sharing options...
lifeson2112 Posted June 28, 2007 Share Posted June 28, 2007 yeah, but if you store the information in a text file or a database it will be there for as long as you specify and you can access it any time. Check out some of the stuff you can do with file() and fopen(). Quote Link to comment Share on other sites More sharing options...
Dark Nonique Posted June 28, 2007 Share Posted June 28, 2007 Make some column in your SQL database, likely in the User table or however you have it. Make that your money column or w/e you use.. Make a variable that pulls the value from the SQL and displays it. And you can modify it depending on what they buy and such. So this way, even if the user leaves the site, their money still remains in the SQL. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 28, 2007 Share Posted June 28, 2007 just tack on the money to the character data table then have a second table for items, maybe a third table for quest. For the items give the items a link to users via a common key. The trick is to store the lleast you can in the table and get away with. Store the rest via functionality like switches/if/else/functions/loops. If your game will involve a "map" system you will have a lot more issues because you will need to keep track of their position. One suggestion is if you click to walk store their coordinates in a X,Y system and then you can splash out images based on their position but that involves tilling a huge map image HUGE Its doable, but it will take a lot of coding and you have to watch optimization because you will be doing a great deal of querying Quote Link to comment Share on other sites More sharing options...
Cless Posted June 28, 2007 Author Share Posted June 28, 2007 Awesome, that helps a lot, guys. I think I understand now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.