Jump to content

Help with String formatting


Urbley

Recommended Posts

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..

 

At 12-12 02:40:00 the following fleets met in battle::

 

Attacker Chopper (6:234:9)

Weapons: 130% Shields: 120% Armour: 120%

Type L.Cargo Battleship Bomber Dest. Battlecr.

Total 100 500 25 75 235

Weapons 12 2.300 2.300 4.600 1.610

Shields 55 440 1.100 1.100 880

Armour 2.640 13.200 16.500 24.200 15.400

 

 

Defender peety (6:240:4)

Weapons: 110% Shields: 110% Armour: 110%

Type R.Launcher L.Laser H.Laser

Total 1.069 508 56

Weapons 168 210 525

Shields 42 53 210

Armour 420 420 1.680

 

 

The attacking fleet fires 1.490 times with a total firepower of 3.247.315 at the defender. The defending shields absorb 47.567 damage

In total, the defending fleet fires 1.633 times with a total firepower of 315.672 at the attacker. The attackers shields absorb 249.359 damage

 

 

Attacker Chopper (6:234:9)

Type L.Cargo Battleship Bomber Dest. Battlecr.

Total 91 500 25 75 235

Weapons 12 2.300 2.300 4.600 1.610

Shields 55 440 1.100 1.100 880

Armour 2.640 13.200 16.500 24.200 15.400

 

 

Defender peety (6:240:4)

destroyed

The attacker has won the battle!

He captured

45.347 metal, 19.392 crystal, and 2.265.867 deuterium

 

The attacker lost a total of 108.000 units.

The defender lost a total of 3.602.000 units.

At these space coordinates now float 16.200 metal and 16.200 crystal.

 

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.

 

Attacker Chopper

Ship1 1000

Ship2 1000

Ship3 1000

 

Defender Peety

Ship1 1000

Ship2 1000

Ship3 1000

 

The attacker has won the battle!

He captured

45.347 metal, 19.392 crystal, and 2.265.867 deuterium

 

The attacker lost a total of 108.000 units.

The defender lost a total of 3.602.000 units.

At these space coordinates now float 16.200 metal and 16.200 crystal.

 

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.