Jump to content

Urbley

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Urbley's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thx xtopolis. I wasn't really asking questions as such. Just wondered if anyone had any input on the theory around these converters as a whole. I'm trying to search out people who are curious about the whole business of string manipulation and now also regexp I understand PHP and MySQL very well but when it comes to this string stuff I have no idea. I would love to change that.
  2. This is really only a general cry for help. I just need some direction in a specific area. Up until now (Over the past 4 years or so) I have only ever really used php for intermediate database manipulation with MySQL. I recently started a new job and as such am required to extend my knowledge of PHP so have assigned myself a project as such to help with this. I'm sure there are a few people that will have a giggle here but anyways... I play an online browser based game called Ogame which is a space simulation game consisting of colonising and developing planets throughout a universe consisting of 9 galaxies and each galaxy has 499 solar systems and each solar system has 15 planet slots which you can colonise. One aspect of the game is to attack another players planet to steal their resources and destroy their ships and defense. Then we proceed to a forum where we post our combat reports (cr's) and gloat. The raw text for a combat report looks like this (I have replaced peoples names with XXX); At 01-14 11:45:23 the following fleets met in battle:: Attacker XXX ([2:62:8]) Weapons: 140% Shields: 140% Armour: 150% Type Bomber Dest. Total 1.735 350 Weapons 2.400 4.800 Shields 1.200 1.200 Armour 18.750 27.500 Defender XXX ([2:60:4]) Weapons: 120% Shields: 110% Armour: 120% Type S.Cargo L.Cargo L.Fighter Cruiser Battleship Sol. Sat Dest. Battlecr. R.Launcher L.Laser H.Laser Gauss Ion C. Plasma S.Dome L.Dome Total 2 140 375 9 99 1 13 31 2.439 1.039 94 128 45 49 1 1 Weapons 11 11 110 880 2.200 2 4.400 1.540 176 220 550 2.420 330 6.600 2 2 Shields 21 53 21 105 420 2 1.050 840 42 53 210 420 1.050 630 4.200 21.000 Armour 880 2.640 880 5.940 13.200 440 24.200 15.400 440 440 1.760 7.700 1.760 22.000 4.400 22.000 The attacking fleet fires 8.060 times with a total firepower of 20.385.600 at the defender. The defending shields absorb 352.126 damage In total, the defending fleet fires 4.466 times with a total firepower of 1.731.032 at the attacker. The attackers shields absorb 1.023.073 damage Attacker XXX ([2:62:8]) Type Bomber Dest. Total 1.726 350 Weapons 2.400 4.800 Shields 1.200 1.200 Armour 18.750 27.500 Defender XXX ([2:60:4]) Type S.Cargo L.Cargo L.Fighter Cruiser Battleship Dest. Battlecr. R.Launcher L.Laser H.Laser Gauss Ion C. Plasma S.Dome L.Dome Total 1 26 69 2 68 13 26 402 165 9 90 10 46 1 1 Weapons 11 11 110 880 2.200 4.400 1.540 176 220 550 2.420 330 6.600 2 2 Shields 21 53 21 105 420 1.050 840 42 53 210 420 1.050 630 4.200 21.000 Armour 880 2.640 880 5.940 13.200 24.200 15.400 440 440 1.760 7.700 1.760 22.000 4.400 22.000 The attacking fleet fires 4.626 times with a total firepower of 12.146.400 at the defender. The defending shields absorb 182.441 damage In total, the defending fleet fires 929 times with a total firepower of 893.193 at the attacker. The attackers shields absorb 392.515 damage Attacker XXX ([2:62:8]) Type Bomber Dest. Total 1.723 350 Weapons 2.400 4.800 Shields 1.200 1.200 Armour 18.750 27.500 Defender XXX ([2:60:4]) Type L.Fighter Battleship Dest. Battlecr. R.Launcher L.Laser Gauss Plasma L.Dome Total 1 4 4 3 4 1 5 13 1 Weapons 110 2.200 4.400 1.540 176 220 2.420 6.600 2 Shields 21 420 1.050 840 42 53 420 630 21.000 Armour 880 13.200 24.200 15.400 440 440 7.700 22.000 22.000 The attacking fleet fires 2.339 times with a total firepower of 6.492.000 at the defender. The defending shields absorb 40.742 damage In total, the defending fleet fires 36 times with a total firepower of 129.956 at the attacker. The attackers shields absorb 34.664 damage Attacker XXX ([2:62:8]) Type Bomber Dest. Total 1.722 350 Weapons 2.400 4.800 Shields 1.200 1.200 Armour 18.750 27.500 Defender XXX ([2:60:4]) destroyed The attacker has won the battle! He captured 675.444 metal, 192.759 crystal, and 537.684 deuterium The attacker lost a total of 975.000 units. The defender lost a total of 30.541.000 units. At these space coordinates now float 2.689.200 metal and 1.495.200 crystal. The chance for a moon to be created is 20 % There are currently CR converters out there which will take this information in a textarea and format the report for usage on various forums to make it more presentable. An example of one such converter would be, http://crconv.vafan.se/ select english i.e. ogame.org and click go. You would then take your raw data and paste it into the CombatReport: textarea on the lower left side and click convert after choosing various options about presentation etc and in the Result: textarea you would receive a formatted report which would be coloured etc for usage on the forum. [center] [color=#00DDFF][b]The following fleets met in battle:[/b][/color] [color=#B9B9B9]Attacker:[/color] [b][color=#FF0000]XXX[/color][/b] [color=#FF0000]Bomber[/color][color=#FF0000]...[/color][color=#FF0000]1.735[/color] [color=#FF0000]Dest.[/color][color=#FF0000]...[/color][color=#FF0000]350[/color] [color=#B9B9B9]Defender:[/color] [b][color=#0099FF]XXX[/color][/b] [color=#FF0000]S.Cargo[/color][color=#FF0000]...[/color][color=#FF0000]2[/color] [color=#FF0000]L.Cargo[/color][color=#FF0000]...[/color][color=#FF0000]140[/color] [color=#FF0000]L.Fighter[/color][color=#FF0000]...[/color][color=#FF0000]375[/color] [color=#FF0000]Cruiser[/color][color=#FF0000]...[/color][color=#FF0000]9[/color] [color=#FF0000]Battleship[/color][color=#FF0000]...[/color][color=#FF0000]99[/color] [color=#FF0000]Sol. Sat[/color][color=#FF0000]...[/color][color=#FF0000]1[/color] [color=#FF0000]Dest.[/color][color=#FF0000]...[/color][color=#FF0000]13[/color] [color=#FF0000]Battlecr.[/color][color=#FF0000]...[/color][color=#FF0000]31[/color] [color=#0099FF]R.Launcher[/color][color=#0099FF]...[/color][color=#0099FF]2.439[/color] [color=#0099FF]L.Laser[/color][color=#0099FF]...[/color][color=#0099FF]1.039[/color] [color=#0099FF]H.Laser[/color][color=#0099FF]...[/color][color=#0099FF]94[/color] [color=#0099FF]Gauss[/color][color=#0099FF]...[/color][color=#0099FF]128[/color] [color=#0099FF]Ion C.[/color][color=#0099FF]...[/color][color=#0099FF]45[/color] [color=#0099FF]Plasma[/color][color=#0099FF]...[/color][color=#0099FF]49[/color] [color=#0099FF]S.Dome[/color][color=#0099FF]...[/color][color=#0099FF]1[/color] [color=#0099FF]L.Dome[/color][color=#0099FF]...[/color][color=#0099FF]1[/color] [b][color=#FF0000] -- After battle -- [/color][/b] [color=#B9B9B9]Attacker:[/color] [b][color=#FF0000]XXX[/color][/b] [color=#FF0000]Bomber[/color][color=#FF0000]...[/color][color=#FF0000]1.722[/color][color=#8000FF] ( lost: 13 )[/color] [color=#FF0000]Dest.[/color][color=#FF0000]...[/color][color=#FF0000]350[/color][color=#8000FF] ( lost: 0 )[/color] [color=#B9B9B9]Defender:[/color] [b][color=#0099FF]XXX[/color][/b] [color=#B9B9B9]Destroyed[/color] [b][color=#00DDFF]The attacker has won the battle![/color][/b] [color=#B9B9B9] He [/color] [color=#B9B9B9] captured [/color] [color=#8000FF][b]675.444[/b][/color][color=#B9B9B9] metal [/color] [color=#8000FF][b]192.759[/b][/color][color=#B9B9B9] crystal [/color] [color=#B9B9B9] and [/color] [color=#8000FF][b]537.684[/b][/color][color=#B9B9B9] deuterium [/color] [color=#B9B9B9] The [/color] [color=#B9B9B9] attacker [/color] [color=#B9B9B9] lost [/color] [color=#B9B9B9] a [/color] [color=#B9B9B9] total [/color] [color=#B9B9B9] of [/color] [color=#8000FF][b]975.000[/b][/color][color=#B9B9B9] units. [/color] [color=#B9B9B9] The [/color] [color=#B9B9B9] defender [/color] [color=#B9B9B9] lost [/color] [color=#B9B9B9] a [/color] [color=#B9B9B9] total [/color] [color=#B9B9B9] of [/color] [color=#8000FF][b]30.541.000[/b][/color][color=#B9B9B9] units. [/color] [color=#B9B9B9] At [/color] [color=#B9B9B9] these [/color] [color=#B9B9B9] space [/color] [color=#B9B9B9] coordinates [/color] [color=#B9B9B9] now [/color] [color=#B9B9B9] float [/color] [color=#8000FF][b]2.689.200[/b][/color][color=#B9B9B9] metal [/color] [color=#B9B9B9] and [/color] [color=#8000FF][b]1.495.200[/b][/color][color=#B9B9B9] crystal. [/color] [color=#B9B9B9] The [/color] [color=#B9B9B9] chance [/color] [color=#B9B9B9] for [/color] [color=#B9B9B9] a [/color] [color=#B9B9B9] moon [/color] [color=#B9B9B9] to [/color] [color=#B9B9B9] be [/color] [color=#B9B9B9] created [/color] [color=#B9B9B9] is [/color] [color=#8000FF][b]20[/b][/color][color=#B9B9B9] % [/color] [b][color=#00DDFF]Battle Result[/color][/b] [color=#B9B9B9](Assuming the attacker got the debris..)[/color] [color=#B9B9B9]Attacker gain:[/color] [color=#8000FF][b]4.615.287[/b][/color] [color=#B9B9B9]Defender lost:[/color] [color=#8000FF][b]30.541.000[/b][/color] [color=#B9B9B9][b]Total Damage:[/b][/color] [color=#8000FF][b]31.516.000[/b][/color] [size=10] [url=http://crconv.vafan.se][color=#7B90B8]Converted with Invader Skodge's CR Converter 3.5[/color][/url][/size] [/center] You can now see that the raw code has been sorted and arranged as such to make it more visually appealing on a forum. Simple things like stripping out unnecessary words and information. Only showing the first and last rounds in the battle etc. I am not looking to know in specific detail how this works and perhaps this post is even in the wrong forum but what I was hoping was to maybe strike up a discussion about the various methods used in such a process so that I might be able to head off on my own and be able to learn how such a process is formed. Any ideas would be absolutely amazing. You can see the finished article after using such a converter at http://board.ogame.org and then scrolling to any universe and looking in the HoF (hall of fame) section. Basically string manipulation and this kind of process in PHP has always intrigued me but I have never known where to start and I am hoping that there are many people out there like me who would be willing to have a discussion about this topic with an aim to figuring out some of the functions involved. If this indeed in the wrong forum, my apologies. P.S. do yourself a favour and don't become addicted to the game. Thanks. Steve
  3. in fairness yeah I probably should have worded this better.... But can I not use php to manipulate the input report at the start of the post to make it look more like the report below? Basically editing the string using PHP and outputting something more usable on a bbCode enabled forum.
  4. Ok here's my mission. I play a browser based space battle game and after a battle in this game an attack report is created. It looks like this below.. What I really want to do is make a web based converter which will strip this code to pieces and rearrange it to make it more visually appealing when posted on a forum using bbCode... I would like it to look something like this... and applu the bbcode color and center tags. I have never used php to format strings before so any help you could give me regarding this kind of job would be really helpful.
  5. <textarea name="contents" rows="40" cols="30"></textarea> for the input field in the form. $content = $HTTP_POST_VARS['contents']; //Other vars of course! $db = mysql_connect("**********", "********", "*********"); mysql_select_db("*******",$db); $dbQuery="INSERT INTO table VALUES ('$numPosts', '$title', '$dateAdded', '$tuning', '$vidName', '$imagename', '$content')"; $result = mysql_query($dbQuery,$db);
  6. Ok I have tutorials stored in my database. But when I retrieve the information there are white spaces between some words missing. The field is of format Text. The information is being added to the database via PHP. I used phpMyAdmin to go in and look at the info contained within the database and yes the spaces are missing there also. Any ideas anyone? All entries in this Text field called content are behaving the same. Ok so just to update as I am still looking in to this right now, It appears that because I used a textarea to input the code the line breaks have been removed from the textarea input and no spaces have been included. EEK!!! HELP!
  7. This forum never fails to amaze. Thanks everyone for the UNBELIEVEABLY quick replies! Steve
  8. Sorry that was a typo on my behalf when putting it on here. Edited it. That query is now returning a value of 4 every single time. I can tell you that there are 6 entries in my database at the mo with id's of 2, 3, 5, 6, 7 and 8. When I try to add a new entry it gives an id of 4! Where it should be 9.
  9. Ok I have a table with a bunch of tutorials. id is a field that holds a unique id. Very simple! I started off using a count to get the next id, i.e. count all the tutorials in the table and then, nextId = count + 1 kind of thing. This was fine until I discovered some tutorials may need to be deleted so if i deleted number 2 and then tried to add one, it would have the same id as the one before this one was entered. i.e. 2 tutorials with the an id of 6 like is happening at the minute. I want to use the SELECT MAX statement but it's not working for me. Here's what I have so far. $dbQuery2="SELECT MAX(id) AS maxId FROM tutorials"; $numPosts = mysql_query($dbQuery2,$db); $numPosts = $numPosts + 1; echo $numPosts; $db is my connection info. All connection info is fine. The echo is echoing NOTHING! =S Any ideas people? Thanks, Steve.
  10. It's set to 20mb. I really don't know how to go about simply uploading this script, pulling the name off and storing it in a database. I can do the database stuff but as for taking the whole string i.e. c:\whatever\whatever\myvideo.flv and stripping it to just myvideo.flv... I don't know! using HTML post just seems to timeout no matter what I do. I was sure to include ENCTYPE="multipart/form-data" in the form tag though. Does anyone have any ideas that could help me out?
  11. I know this has probably been covered a thousand times but here's my problem. I'm making an admin section for an online e-learning application. I want the "tutor" or administrator to be able to upload a video file. Normally between 3-5mb. Using html forms with POST just does not seem to work on files this size. I also want to strip out just the file name and insert the filename i.e. myVideo.wmv and insert it into the database so another php script can access the video file at a later time. The inserting into database is a problem. But what's the best way to strip the filename i.e. c:\..\...\.....\...\myVideo.wmv to just the file name and what's the easiest way to upload the file? A coded answer would be excellent but a finger pointing in the right direction would be just as good. Steve
  12. case "performEdit": { $postID = $_GET["postID"]; $title = $_GET["title"]; $dateAdded = $_GET["dateAdded"]; $contents = $_GET["contents"]; echo "$postId"; echo "$title"; echo "$dateAdded"; echo "$contents"; $db = mysql_connect("********", "**********", "****"); mysql_select_db("db65694326",$db); $dbQuery="UPDATE stephensBlog SET title='$title', dateAdded='$dateAdded', content='$contents' WHERE postID='$postID'"; $result=mysql_query($dbQuery,$db); echo "<script>alert('Your entry has been edited');window.location='blogAdmin.php?username=$username&password=$password';</script>"; break; } The syntax works fine on my other switches and the variables are definitely being received by the switch fine (I checked with some echo statements and what not). When I retrieve the database info and display it the values come up as $title $dateAdded and $contents. rather than the proper values... What's up with this? Steve
×
×
  • 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.