interpim Posted February 22, 2007 Share Posted February 22, 2007 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. Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/ Share on other sites More sharing options...
Orio Posted February 22, 2007 Share Posted February 22, 2007 What numbers are you looking for? The time? The other numbers? Basically, you should learn about regular-expressions. Orio. Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/#findComment-191568 Share on other sites More sharing options...
interpim Posted February 22, 2007 Author Share Posted February 22, 2007 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. Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/#findComment-191605 Share on other sites More sharing options...
magic2goodil Posted February 22, 2007 Share Posted February 22, 2007 Here's a question..Are the timestamps going to be in the original string that needs to be broken down? Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/#findComment-191661 Share on other sites More sharing options...
interpim Posted February 22, 2007 Author Share Posted February 22, 2007 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 Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/#findComment-191701 Share on other sites More sharing options...
interpim Posted February 22, 2007 Author Share Posted February 22, 2007 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 Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/#findComment-191731 Share on other sites More sharing options...
interpim Posted February 23, 2007 Author Share Posted February 23, 2007 ok, silly me, I fixed the size issue... I was limiting the input to a smaller size... fixed that part anyways Link to comment https://forums.phpfreaks.com/topic/39679-newbie-retrieve-numerical-data-from-string/#findComment-191767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.