Jump to content

Cainj

New Members
  • Posts

    9
  • Joined

  • Last visited

Cainj's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. this is sorta like watching a movie you have not seen in a long while. You watch it KNOWING you seen it before, but only remember it while your watching it. I'm super rusty. I went back and looked at my code, matching what is said here - and thought NOOB LOL at first I thought scoots post was rude - until I realized what was said - "links" are not gonna happen. der! thanks guys, I'll rewrite it, post a snippet here for future viewers, if it is still not up to par, you can rip it up cheers! thanks
  2. is this thread suggesting I remove the list of links (options), and substitute for a form?
  3. Hi Mac hmmm for simplicity, I'll use the healer shop. pretty basic. not a game changer on refresh, but helps to illustrated the dilema: player pays for x amount of gold to have y amount of hp to be restored. Does this successfully. Hitting F5 will of course repeat this, and depleate their bank. But the code and the process in itself is very ugly.(imo) It is started with a <a href="?healer&heal">Heal</a> then php catches it if (isset($_GET['heal'])) { [ process healing code here So hitting refresh, the "get" is still there. This example works fine regardless if they refresh, but things like combat could become problematic. I've seen several solutions that use cookies/sessions, but then the problem arises of where to UNSET these so you can access the given location and/or activity again (example, if i leave the healer, and then come back, I do not want the session/cookie to think I refreshed the page). Those examples I have found are mostly for app of non-gaming in nature. I am sure I will arrive at something. But its gnawing at me LOL anyways. hope that helps a little. thanks for taking time to read this.
  4. I would like to know the most effective way of preventing a page refresh. Writing a text game. Going well. However, browser games can get messy if you don't get the F5 under control. I know I could use a Session/Cookie variable, but not sure how to impliment that efficiently. While the game is large, it is managed very nicely within the index.php all is centraled around a "switch/case" based on url request. This method has served me well for many apps I have writen. So thought I would do a game which encompasses many apsects of programing - and one snag I ran into was the dreaded F5. The causes unlimited just about everything, if put in the right spot. I checked the web, but it seems people are asking the wrong question: "..how to disable the F5 key" - which is not correct. I will keep searching, and if I find something before a reply comes here, I'll post what I find that is successful. Thanks!!
  5. on your "mysql_query()" add a or die(mysql_error()); then you will see exactly why it is not updating.
  6. wow, I had this prob for eons!! for some time I kept working on my project, but eventually this "single line" issue bugged me. his is a function I made to correct it. :-) enjoy @filename must be full path (or relative), and $xml is the $xml data modify as needed function saveXMLFile($filename, $xml) { $dom = dom_import_simplexml($xml)->ownerDocument; $dom->formatOutput = true; $fh = fopen($filename,'w'); fwrite($fh,$dom->saveXML()); fclose($fh); } YOUR CODE can be changed as such: $xml = simplexml_load_file("myXml.xml"); $sxe = new SimpleXMLElement($xml->asXML()); $user = $sxe->addChild("user"); $user->addChild("name", "Ed Doe"); $user->addChild("age", "34"); // $sxe->asXML("myXml.xml"); dont need this line function saveXMLFile($xml, $sxe);
  7. figured it out changed it to item id, as this line actaully covers both weapons and armor in one shot, i was testing buying armor, but it was hardcoded as weapons duh) if( ($itemId > 1)....... funny how you get things figured out when you ask and see it from a different perspective - delete this post mod..
  8. ok real fast - i been on this for 6 weeks non stop, weaponid = 1 gold = 976 itemcost = 200 this line is just to check for someone using url to get what they want. if( ((int)$player->weaponId > 1) || ((int)$player->gold < (int)$item->cost) ) then cheater this line is true! How? weaponid = 1 so the first part should fail, and gold is more than enough to cover the cost. so why does this ring true? btw all vars are set ahead of time, this is jus to check that users are not tying to
×
×
  • 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.