Jump to content

SharkBait

Members
  • Posts

    845
  • Joined

  • Last visited

    Never

Everything posted by SharkBait

  1. Well each store at the time of create in the database had a current amount, and a max amount. So when I first logged in before anyone else had: Store1 had 500 with 1500 max Store2 had 1200 with 2000 max Store3 had 700 with 700 max I just made up some starting amounts along with their maxes (no thought into really). There was no magic number of starting items that was distributed between the stores. If a store runs out of an item. Then players will be only able to sell items to it untill it gets to a minium on hand before it will start to sell them again. If the store hits the maxium then of course they won't buy anymore. And not all stores sell the same items. So out of 4 items in total that can be bought/sold a store might have all 4, might have only 2, or might not have any at all to buy/sell. This is also coded in the database. If they have no max amount, they do not buy/sell that particular item. Its nice to talk to someone about how this can work. I dont work on it as much as I would like to but.. :) I too playe Kings of Chaos and Darkthrone. Liked the idea of them, but wanted something of my own ;) There was another game I saw that was done in PHP and Flash... forget what its call though it had a neat style to it.
  2. [!--quoteo(post=369427:date=Apr 27 2006, 06:29 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Apr 27 2006, 06:29 PM) [snapback]369427[/snapback][/div][div class=\'quotemain\'][!--quotec--] that doesn't really sound like you're asking a question about code but about game mechanics. you are the one who has to decide [b][i]how[/i][/b] you want your game to be played. but on that note, does each store offer their own independant inventory, or do all stores present stuff from one source (that is, i can go to any of your stores and it shows the same stuff and same quantities)? also, it depends on how you have your code setup. for example, if you have pens. base price is 10. and you have 3 stores. when you go to a store does it randomly display x amount of pens available, or is there only like 50 pens available between all 3 stores or what? if you explain exactly how you have it set up then i can make my own suggestion on how you should do it, but again, that's really a gameplay mechanic thing not a technical question. [/quote] Each store has their own amount of inventory. They all sell the same 4 items. But each store has a different inital amount with a different max. The idea is to be able to go store to store and buy/sell. Like TradeWars2002 if anyone has played that ;) The idea is that a player can goto one store, buy 30 items, goto another store and the price for them to sell might be better, or worse depending on what that particular store's inventory levels are like. If its better than the previous store they are awarded a little experience. I will hopefully add a way for them to 'haggle' as well to earn them a bit more experience if they are successful. I guess it is more of a game mechanics question. But I have no idea what forum out there might help with game mechanics ;) Btw Crayon, how is that game you're working on going? I forgot the URL.
  3. Hi, Im still slowly working away on a PHPgame and I need some thoughts. When a player goes to a place to buy/sell commodities the MySQL database holds a base value. When they come to a particular place to buy/sell I change the buy priced based on how much of the available commodity is there. So if: | Amount | Max | Buy | Sell ----------------------------------------------- Store1 | 500 | 1200 | 45 | 25 Now the way it works is [code] pseudo if Amount is <= 10% of Max then    Sell price is is 45% less than Buy else    Sell price is 150% greater than Buy [/code] Should I make a universion buy price and then change it based on the availability of the commodity? So set all stores to a base price of say 50 and then change the store's Buy and Sell price independently?? Right now each store has a set Buy price in the database that varies on me just randomly entering a value :) Looking for some feedback/suggestions etc Thanks
  4. [!--quoteo(post=369046:date=Apr 26 2006, 03:18 PM:name=avo)--][div class=\'quotetop\']QUOTE(avo @ Apr 26 2006, 03:18 PM) [snapback]369046[/snapback][/div][div class=\'quotemain\'][!--quotec--] HI All Is it possible for you to let me know how to check for a symbol in a text field before a post i thought i should use a wildcard and tryed [code]<? if ($_POST ['email'] !=@% ) { $no_symbol = "bad; } else { $no_symbol = "good; } ?>[/code] but i was wrong only came up with errors if someone can point me in the direction of the variable that i need to use i will it will be most appriciated.. Thank in advance. [/quote] You could do it using regular expressions and look for the @ character. I'm not good at them but I am sure someone else could enlighten both of us how to look for the @ symbol.
  5. [!--quoteo(post=368987:date=Apr 26 2006, 01:40 PM:name=onepixel)--][div class=\'quotetop\']QUOTE(onepixel @ Apr 26 2006, 01:40 PM) [snapback]368987[/snapback][/div][div class=\'quotemain\'][!--quotec--] How about SELECT * FROM test where (test1 = 'Y' OR test 2 = 'N') AND testname = 'MINE' [/quote] Thats what I thought. Hehe silly me. Thanks
  6. Hi, I have a MySQL query that looks like this: SELECT * FROM test where test1 = 'Y' OR test 2 = 'N' AND testname = 'MINE' Now I understand that is wrong, but I am not sure how to make the query do what I want. I want to make the query true if test1 = Y OR test2 = N or even both. How can do this properly?
  7. If and when you've done your setup for MySQL. You can then query the creation date to see what accounts have been created in the last 30 days and display them to the visitors as new users
  8. Hi, With javascript is it possible, if a window is not the most top window open, if something in it changes to have the windows taskbar flash to show that something has changed with it? So that if the window is in th background behind other applications, and the javascript window has changed something, the task bar's button flashes for notification?
  9. I think you'll need a while loop in there [code] $result = mysql_query($sql, $conn) or die(mysql_error()); //Loop through the results while ($items = mysql_fetch_array($result, MYSQL_ASSOC)) {   // Display stuff   echo "{$items['image']}<br />"; } [/code] With just using the $result = mysql_query()
  10. Dont forget to close your <form> tag with </form> when your done with it ;)
  11. Could also use the ones that are on PHPFreaks own website [a href=\"http://www.phpfreaks.com/tutorial_cat/25/Page-Number--Pagination.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorial_cat/25/P...-Pagination.php[/a] :)
  12. Try something like: SELECT * , COUNT(*) FROM Votes GROUP BY NamesID ?? Of course then you would reference the other table to find out who the NamesID belongs to
  13. [!--quoteo(post=363828:date=Apr 11 2006, 03:53 PM:name=chriscloyd)--][div class=\'quotetop\']QUOTE(chriscloyd @ Apr 11 2006, 03:53 PM) [snapback]363828[/snapback][/div][div class=\'quotemain\'][!--quotec--] okay i have a table already in mysql and all i need help is with creating a upload script that upload images to a folder called userimages and i need it to insert the information to the mysql table such as a description ,file address, filename,and uid = userid and i need it to also make a copy of the image and resize it and make the name the same but at the end make it name_resized [/quote] I wont be able to help much but with the image resize you'll need to look at the GD part of PHP.
  14. Alright figured it out, just had to run through it outloud a couple of times to get my conditional the way I wanted it. [code] <?php foreach ($ADMINLINKS as $HEADER => $LINKS) { if(is_array($LINKS)) {   if(($USERLEVEL == $SALES) && ($HEADER != "Users")) continue;   ?>    /* blahblahblah do code here */ <?php } } ?> [/code] Thanx for the help!
  15. [!--quoteo(post=363807:date=Apr 11 2006, 02:37 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Apr 11 2006, 02:37 PM) [snapback]363807[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try something like: [code]<?php $UserA = 1; $UserB = 2; $UserC = 4; $array = array("Blah" => "goober",   "Blah2" => "goober2",   "Blah3" => "goober3", ); foreach($array as $item => $desc) {    // I want to skip item 1 and 3 if $UserB == 2    if ($UserB == 2 && ($item == "Blah" || $item == "Blah3")) continue;    else echo "<p>{$item} -> {$desc} </p>"; } ?>[/code] Ken [/quote] Though, will the above still print out Blah2 ?? What I am trying to do is if it is a certain user logged in, I dont want them to see certain links that the foreach returns. So Admin sees Blah, Blah2, Blah3, but Lacky only seens Blah2 and not Blah or Blah3
  16. My brain is mush.. looking for some insight into my foreach loop Trying to figure out how to skip over things in an Foreach loop via a conditional. [code] <?php $UserA = 1; $UserB = 2; $UserC = 4; $array = array("Blah" => "goober",   "Blah2" => "goober2",   "Blah3" => "goober3", ); foreach($array as $item => $desc) {    // I want to skip item 1 and 3 if $UserB == 2    echo "<p>{$item} -> {$desc} </p>"; } ?> [/code] I though I could use next($array); but that wasnt it, then I thought about using break(); but well.. that breaks it :) I'm missing something simple I think.... any help appreciated.
  17. [!--quoteo(post=362372:date=Apr 6 2006, 02:33 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 6 2006, 02:33 PM) [snapback]362372[/snapback][/div][div class=\'quotemain\'][!--quotec--] There's no question that these should be represented as different DB records; however, for the time being, you can use the following query (UNTESTED) to returning proper matches (will match C34, not C345): [code]SELECT PNS, LOCATE( ',C34,', CONCAT(',',PNS,',') ) AS matchPos FROM parts HAVING matchPos > 0[/code] [/quote] I did the proper way and put them into their own database and their own items and link 2 other tables to it. Thanks :)
  18. [!--quoteo(post=362351:date=Apr 6 2006, 01:22 PM:name=jworisek)--][div class=\'quotetop\']QUOTE(jworisek @ Apr 6 2006, 01:22 PM) [snapback]362351[/snapback][/div][div class=\'quotemain\'][!--quotec--] thats definitely not the most efficient way of storing this information, but you can use [code] SELECT * FROM parts WHERE PNS LIKE '%C34%' [/code] [/quote] Yea I do realize that is note totally efficient. But I have like 55 items that point to the same Description but have a different REF_PN So all those in the Item1 are the same part, but in a different location. I could change it so that C14, C15, C28, C29 etc are all seperate items in the database, but it seems silly because the only difference between those 4 parts is the Ref_pn. If I use LIKE that will also pull out things like C345, C345, CC34 too wont it? Though any suggestions on how I should store thses values would be grealty appreciated Something like this pershaps? id | Ref_pn | Description | TR-PN ------------------------------------------------ 1 | C3 | Cap 10uF 10V 10% | 25-000004-00 ------------------------------------------------ 2 | C5 | Cap 10uF 10V 10% | 25-000004-00 ------------------------------------------------ 3 | C6 | Cap 0.1uF 12V 5% | 25-000005-01 ------------------------------------------------ If that helps :)
  19. Hi, I have a field in my database that is a text type and inside the fields the values are stored like: Model | PNS -------------------------------------- Item1 | C1,C2,C4,C10,C34,C35,C36 -------------------------------------- Item2 | C1,C4,C34,C55,C56,C57 -------------------------------------- Item3 | C1,C4,C56,C59,C98 -------------------------------------- I have SELECT * FROM parts WHERE PNS = ????? How do I just make a query to look for the C34?
  20. Hi, Anyone know of good sites to learn Javascript from? There are some things I would like to do, but my javascript is very very very basic. I know how to use mousehover mouseoff ;) Pretty much what I am looking for is this: When a user starts typing in a textarea they can write up to 255 characters. But at 100 characters a textbox below the textarea is enabled. Is this easily done? I can do it using VB.Net but then I dont want to get into that side of the webdevelopment. I'm content using PHP and such. Thanks
  21. I fixed it. Just re-ran the update and install for yum php-gd. Restarted httpd and voila, worked. :)
  22. The code you have it great. Though, I dont seem to have imagecreatefromjpeg() which tells me GD isnt enabled in PHP. I can not find any mention of GD in phpinfo(). I installed GD onto the server. It was able to make the gddemo.png and a couple of other files. My php version seems to be 5.0 but no where in the php.ini file does it show extension=php_gd2 in it. How do I go about enabling GD in PHP? I've used getimagesize() and I thought that was a function of GD? Do I have to recompile PHP with enabling GD support??
  23. Hi, I've been looking and I have not any tutorials about making a script for generating those authorization/access codes with the GD. I've found places that give people scripts to do it, but I am more interesting in following some sorta tutorial about how this works. Thanks.
  24. But... Since PHP is serverside, it cant tell what varible is selected in the javascript. I saw an suggestion to use the DOM and have javascript request something from the server, but thats too much work for what I am trying to do... :)
  25. Hi, I've been looking around and I can not seem to find a simple enough example of what I want to do with javascript and drop down menus. With my first <select> I generate the menu from a PHP array (string and string) depending on what item the user clicks on I want it to populate a corrisponding <select> with another array that is set using PHP I could probally do this with $_GET after selecting the first option, but I would rather have it load the 2nd <select> without reloading the page. There are other form elements that I dont want the user to have to re-enter :) Why does this seems harder than I thought it would? Would I use the OnChange option for the <select> then pass the value of the selectedindex? I am thing unsure how would I go about having javascrip update the 2nd <select> by populating it with one of the indexes from a multidimention array based on the first <select> Hopefully that makes sense.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.