Jump to content

interpim

Members
  • Posts

    303
  • Joined

  • Last visited

    Never

Everything posted by interpim

  1. i got that error the other day lol.... turns out mysql doesnt like fields named 'int'
  2. Thank you so much Orio... works great now guess I will start learning more about foreach() hehe just learning now
  3. between them... right now i get.... string1 string2 string3 in the output... I need it string1string2string3. i look at source and it is string1 string2 string3
  4. anymore help on this? need to have the strings together with no spaces.
  5. looks like you need to load the old info from your database, or assign variables from $_POST to the variables... noticed $sadr=$adr if $sadr was empty... what is the data in $adr?
  6. OK... but i ran it and it worked... but how do i remove the blank space between the strings?
  7. Im creating a name generator script and as far as I can tell the code looks ok, then again, I may be thinking things work differently than they actually do... so basically I have 3 text files with strings on each line. I want to select a random string from each file and concatenate the 3 into one string... I am getting nothing in the output for some reason here is the link to the directory w/ the files http://interpim.com/ambassade and here is the code <?php echo "test"; $f_first=fopen('name_first.txt'); srand ((double) microtime( )*1000000); $random_first = rand(0,161); $i=-1; while(&i<$random_first) { $first=fgets($f_first); $i++; } fclose($f_first); $f_middle=fopen('name_middle.txt'); srand ((double) microtime( )*1000000); $random_middle = rand(0,135); $j=-1; while($j<$random_middle) { $middle=fgets($f_middle); $j++; } fclose($f_middle); $f_last=fopen('name_last.txt'); srand ((double) microtime( )*1000000); $random_last = rand(0,173); $k=-1; while($k<$random_last) { $last=fgets($f_last); $k++; } fclose($f_last); $name=$first . $middle . $last; echo "$name<br>"; ?> what am i doing wrong?
  8. cool... thank you for the link and info
  9. Im just curious if that would work... for instance... on account creation, I want to give each player 20 turns... so $turns=20; now, for every hour on the hour, I want to add 6 turns. Do i need to add a time since last turn field to my database? (Using mysql btw) the time() function in php really confuses me LOL. I have tried working with it before, but I usually mess it up especially when trying to do math with the returned value. are you saying, when a user loads the page, i should check $turns and time since last turn? then find the difference between current time and that time to add however many turns they should get? Could you also point me in the direction of a good tutorial on date/time functions in PHP?
  10. I am in the process of teaching myself PHP and have used this site to do some of my learning. I was inspired by the MMORPG contest, and I know it is over now, but have been attempting to build a fairly simple one for my first project to learn with. I want to prevent users from spamming the attack script to bump up their stats/level so my plan was to implement a limit on how many turns they could use per hour. The thing is, Say I want to give 1 turn every 10 minutes, or 6 turns an hour... If the user isn't online I still want to increment their turn count up while they are offline. This I have seen on some other websites, but I honestly don't have a clue where to start on this. I know basics, but am still learning, so if anyone could explain the process behind this it would be greatly appreciated.
  11. ok, silly me, I fixed the size issue... I was limiting the input to a smaller size... fixed that part anyways
  12. darn :/ another problem. I was using a small, maybe 20kb file to do the testing on this... Actual log files can be huge, so i attempted uploading a 500kb file or so, and It keeps preventing me from uploading it... keeps exiting out. page is at http://interpim.com/parser
  13. yes... the timestamps are written to the file from the game. the file is generated during gameplay and I am not sure there is a way to actually change the file while it is written
  14. actually all the different types of numbers... Basically each to a different variable... I will look up regular expressions for sure though, thanks for the direction.
  15. not sure you can have 2 actions in a form... The only way I could think is to build a action script that does what you need, then sends the rest of the info to Paypal via their link.
  16. How would I pull numbers from a string that can be used to assign values to variables in my script? lines would be similar to this... [21:23:21] You get 307 realm points! [21:23:21] You hit Tiestoxl for 439 (-194) damage! [21:23:21] You get 41,943,040 experience points! [21:23:21] Your share of the loot is 2 gold, 17 silver, and 55 copper pieces. [01:06:04] 101 style damage was blocked by the defender's magic shielding. [01:06:07] Matado hits you for 103 damage. [01:06:08] Joe hits you for 103 damage.
  17. OK... I have figured out my issue with losing some data because I didn't realize that once you call fgets() it automattically moves the pointer to the next line in the file. I just added a fseek($file,0); after a while statement to start over for the next if statement. Now my only issue is being able to pull numerical data from each of the strings... anyone that can clue me in on this?
  18. could you build the php to look for the file via the path from root? such as /phpfilefolder/index.php
  19. OK, the one snippet of code works fine by itself... but when I start adding other if statements it starts messing up the count for some reason. Also, anyone know how I could pull out the numerical data in the file? so I can use it in building averages etc.?
  20. that isn't working either... it is giving me the exact same outcome as before... It is not printing some of the file, and it isn't counting each instance of occurence correctly. I changed it to this to test... <?php $file=fopen($uploadedfile,"r") or exit("Unable to open file!"); $melee_atk_you=0; $melee_atk_them=0; $rps=0; $gold=0; $evade_you=0; $evade_them=0; $parry_you=0; $parry_them=0; $block_you=0; $block_them=0; $miss_you=0; $miss_them=0; $bps=0; while (!feof($file)) { echo fgets($file), "<br>"; if(!stristr(fgets($file),"You attack")===false){ $melee_atk_you=$melee_atk_you+1;} if (!stristr(fgets($file),"realm points")===false){ $rps=$rps+1;} if(!stristr(fgets($file),"You evade")===false){ $evade_you=$evade_you+1;} } echo "You Evaded " , $evade_you , " times.<br>"; echo "You attacked " , $melee_atk_you , " times.<br>"; echo "you earned RP's " , $rps, " times"; fclose($file); ?>
  21. I am using the following code to pull information out of a user uploaded file. I thought at first it was working, but turns out it isn't counting every instance the word combination shows up, and if I try to add another if statement to look for a different set of words and increment that variable it usually breaks the output all together. What am I doing wrong, and if there are any suggestions on how I could do this better, any help for this noob would be appreciated. Also, is there a way to pull numbers out of a string to add up into a variable? here is the code... <?php $file=fopen($uploadedfile,"r") or exit("Unable to open file!"); $melee_atk_you=0; $melee_atk_them=0; $rps=0; $gold=0; $evade_you=0; $evade_them=0; $parry_you=0; $parry_them=0; $block_you=0; $block_them=0; $miss_you=0; $miss_them=0; $bps=0; while (!feof($file)) { echo fgets($file), "<br>"; if(stristr(fgets($file),"You perform")){ $melee_atk_you=$melee_atk_you+1;} } echo "You Evaded " , $evade_you , " times.<br>"; echo "You attacked " , $melee_atk_you , " times.<br>"; fclose($file); ?> And here is a snippet of the type of file that will be passed to this page. [01:06:00] You evade Matado's attack! [01:06:00] (Region) You have entered Northern Suspiro Pass. [01:06:01] You are now preparing to perform a Garrote style as a backup for Hamstring! [01:06:02] You perform your Hamstring perfectly. (+32) [01:06:02] A barrier absorbs 93 damage of your attack! [01:06:02] You attack Matado with your axe and hit for 106 (-33) damage! [01:06:02] A barrier absorbs 7 damage of your attack! [01:06:02] You hit Matado for 3 damage! [01:06:03] You prepare to perform a Leaper! [01:06:04] Matado attacks you with his sword! [01:06:04] Matado casts a spell! [01:06:04] You perform your Leaper perfectly. (+34) [01:06:04] You critical hit for an additional 46 damage! [01:06:04] Matado looks resigned to their doom. [01:06:05] You must wait 1 more minutes and 43 seconds to discharge an item! [01:06:05] You are now preparing to perform a Garrote style as a backup for Hamstring! [01:06:05] (Region) You have left Northern Suspiro Pass. [01:06:07] You perform your Hamstring perfectly. (+37) [01:06:07] Matado is bleeding! [01:06:07] Matado attacks you with his sword! [01:06:07] You are poisoned! [01:06:07] Matado attacks you with his axe! [01:06:07] Your movement is slowed! [01:06:08] 140 style damage was blocked by the defender's magic shielding. [01:06:08] You attack Matado with your falchion and hit for 238 (-49) damage! [01:06:08] You attack Matado with your axe and hit for 192 (-61) damage! [01:06:09] Matado attacks you with his sword!
  22. I somewhat built a simple upload form that will take an uploaded file and send it to another script that will process, then display the results on the webpage. Using this code <?php $file=fopen($uploadedfile,"r") or exit("Unable to open file!"); while (!feof($file)) { echo fgets($file); echo "<br>"; } fclose($file); ?> Now, I know this only spits out the same data that it is given, but my question is, how would I go about parsing the individual lines for the data I want to keep?? I am thinking the best way for me to do that is to create variables for each item I want to track and give it a ++ for each occurance. My question is how do i know what to search to pull it out. Is it possible to put a giant loop of if/then statements, or maybe a switch?
  23. OK... i got someone to send me a snippet of an actual log file... I think i figured out how to pass an uploaded file to a script... Now I just have to figure out how to parse the Data I want out of the log. [21:23:21] You cast a Greater Rune of Shadow Spell! [21:23:21] You hit Tiestoxl for 439 (-194) damage! [21:23:21] You just killed Tiestoxl! [21:23:21] Tiestoxl just died. His corpse lies on the ground. [21:23:21] You get 307 realm points! [21:23:21] You earn 9 extra realm points for outpost ownership! [21:23:21] You get 8 bounty points! [21:23:21] You get 41,943,040 experience points! [21:23:21] Your share of the loot is 2 gold, 17 silver, and 55 copper pieces. [21:23:21] You deposit 4 silver, and 43 copper pieces in your guild bank. [21:23:21] Tiestoxl is dead! [21:23:22] You are no longer facing your target. [21:23:23] Vastagor's strength returns. [01:06:00] Matado attacks you with his sword! [01:06:00] You evade Matado's attack! [01:06:00] You must perform the Perforate Artery style before this one! [01:06:00] (Region) You have entered Northern Suspiro Pass. [01:06:01] You prepare to perform a Hamstring! [01:06:01] You are now preparing to perform a Garrote style as a backup for Hamstring! [01:06:02] 98 style damage was blocked by the defender's magic shielding. [01:06:02] You perform your Hamstring perfectly. (+32) [01:06:02] You attack Matado with your falchion and hit for 186 (-38) damage! [01:06:02] A barrier absorbs 93 damage of your attack! [01:06:02] Matado resists the effect! [01:06:02] You attack Matado with your axe and hit for 106 (-33) damage! [01:06:02] You critical hit for an additional 21 damage! [01:06:02] A barrier absorbs 7 damage of your attack! [01:06:02] Matado is bleeding! [01:06:02] You hit Matado for 3 damage! [01:06:03] Matado performs the Remedy ability, protecting himself from the effect of envenomed weapons. [01:06:03] You prepare to perform a Leaper! [01:06:03] Matado casts a spell! [01:06:04] Matado attacks you with his sword! [01:06:04] You evade Matado's attack! [01:06:04] Matado casts a spell! [01:06:04] 101 style damage was blocked by the defender's magic shielding. [01:06:04] You perform your Leaper perfectly. (+34) [01:06:04] You attack Matado with your falchion and hit for 173 (-35) damage! [01:06:04] You critical hit for an additional 46 damage! [01:06:04] You attack Matado with your axe and hit for 141 (-45) damage! [01:06:04] Matado looks resigned to their doom. [01:06:05] You attempt to use the Battler. [01:06:05] You must wait 1 more minutes and 43 seconds to discharge an item! [01:06:05] You prepare to perform a Hamstring! [01:06:05] You are now preparing to perform a Garrote style as a backup for Hamstring! [01:06:05] You resist the effect! [01:06:05] (Region) You have left Northern Suspiro Pass. [01:06:07] 110 style damage was blocked by the defender's magic shielding. [01:06:07] You perform your Hamstring perfectly. (+37) [01:06:07] You attack Matado with your falchion and hit for 209 (-43) damage! [01:06:07] Matado is bleeding! [01:06:07] You hit Matado for 3 damage! [01:06:07] Matado attacks you with his sword! [01:06:07] Matado hits you for 103 damage. [01:06:07] You are poisoned! [01:06:07] Matado hits you for 39 damage. [01:06:07] Matado attacks you with his axe! [01:06:07] Matado misses! [01:06:07] Your movement is slowed! [01:06:07] You prepare to perform a Leaper! [01:06:08] 140 style damage was blocked by the defender's magic shielding. [01:06:08] You perform your Leaper perfectly. (+46) [01:06:08] You attack Matado with your falchion and hit for 238 (-49) damage! [01:06:08] You critical hit for an additional 47 damage! [01:06:08] You attack Matado with your axe and hit for 192 (-61) damage! [01:06:08] Matado looks resigned to their doom. [01:06:09] Matado attacks you with his sword! [01:06:09] Matado hits you for 93 damage. [01:06:09] Matado's armor appears to crumble away before your eyes! [01:06:09] Your armor is imbued with a brilliant spectral aura! [01:06:09] You are poisoned! [01:06:09] Matado hits you for 33 damage. [01:06:09] Matado attacks you with his axe! [01:06:09] Matado hits you for 50 damage. [01:06:09] Your physical essence is weakened! [01:06:09] Your Constitution has decreased. [01:06:09] Your hits have decreased. [01:06:09] Your physical essence is weakened! [01:06:09] Your attacks are slowed by an unseen force! [01:06:09] You prepare to perform a Rib Separation! [01:06:11] 101 style damage was blocked by the defender's magic shielding. [01:06:11] You perform your Rib Separation perfectly. (+33) [01:06:11] You attack Matado with your falchion and hit for 185 (-38) damage! [01:06:11] You attack Matado with your axe and hit for 128 (-41) damage! [01:06:11] Your knowledge of the ways of subterfuge increases [01:06:11] You just killed Matado-Kay! [01:06:11] Matado's extra strength fades. [01:06:11] Matado's extra health fades. [01:06:11] The protection around Matado fades. [01:06:11] Matado's armor returns to normal. [01:06:11] Matado's enhanced vigor fades. [01:06:11] Matado's enhanced agility fades. [01:06:11] Matado's extra strength fades. [01:16:07] Matado's enhanced vigor fades. [01:06:11] Matado's form is restored. [01:06:11] Matado's form is restored. [01:06:11] Matado's meditative state fades. [01:06:11] Matado is defending wholeheartedly again. [01:06:11] Matado's aura of magnanimity fades. [01:06:11] Matado just died. His corpse lies on the ground. [01:06:11] You get 1684 realm points! [01:06:11] You get 76 bounty points! [01:06:11] You get 146,006,907 experience points! [01:06:11] You pick up 17 gold, 40 silver, and 34 copper pieces.
×
×
  • 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.