Html log to BBCode converter

Discussion in 'Development General' started by Tano, May 20, 2010.

  1. Tano

    Tano Member

    Joined:
    May 18, 2010
    Messages:
    58
    Likes Received:
    0
    i made this converter becouse some of my users requested it.

    http://www.pokemonvictoryroad.com/log/convertitorelog.php


    it converts Pokémon Online html logs in text with BBCode tags (used in most forums, like PHPBB) maintaining the same aspect.

    that's an example:

    Battle between Tano and Zaftom started!

    Tier: OverUsed
    Variation: +13, -18
    Rule: Rated
    Rule: Sleep Clause
    Rule: Evasion Clause
    Rule: OHKO Clause
    Rule: Species Clause

    Zaftom sent out Bronzong!
    Tano sent out Swampert!
    Tano: gl

    Start of turn 1
    Swampert used Stealth Rock!
    Pointed stones float in the air around Zaftom's team!

    The foe's Bronzong used Trick Room!
    The foe's Bronzong twisted the dimensions!

    Start of turn 2
    The foe's Bronzong used Stealth Rock!
    Pointed stones float in the air around Tano's team!

    Swampert used Roar!
    Pointed stones dug into the foe's Dusknoir!
    The foe's Dusknoir was dragged out!
    The foe's Dusknoir is exerting its Pressure!

    The foe's Dusknoir restored a little HP using its Leftovers!


    [........... cutting here .........]

    Start of turn 53
    Tyranitar used Substitute!
    Tyranitar made a substitute!

    The foe's Snorlax used Return!
    It's not very effective...
    Tyranitar's substitute took the damage!

    The sandstorm rages!
    The foe's Snorlax is buffeted by the sandstorm!
    Tyranitar is hurt by its burn!
    Tyranitar restored a little HP using its Leftovers!

    Start of turn 54
    Tyranitar is tightening its focus!
    The foe's Snorlax used Return!
    It's not very effective...
    A critical hit!
    Tyranitar's substitute took the damage!

    Tyranitar used Focus Punch!
    It's super effective!
    The foe's Snorlax lost 49% of its health!

    The sandstorm rages!
    The foe's Snorlax is buffeted by the sandstorm!
    Tyranitar is hurt by its burn!
    Tyranitar restored a little HP using its Leftovers!

    Start of turn 55
    Zaftom called Snorlax back!
    Zaftom sent out Dusknoir!
    Pointed stones dug into the foe's Dusknoir!

    The foe's Dusknoir is exerting its Pressure!
    Tyranitar used Dark Pulse!
    It's super effective!
    The foe's Dusknoir lost 23% of its health!
    The foe's Dusknoir fainted!

    The sandstorm rages!
    Tyranitar is hurt by its burn!
    Tyranitar restored a little HP using its Leftovers!
    Zaftom sent out Snorlax!
    Pointed stones dug into the foe's Snorlax!

    Start of turn 56
    Tano called Tyranitar back!
    Tano sent out Sukuna! (Vaporeon)
    Pointed stones dug into Sukuna!

    The foe's Snorlax used Return!
    Sukuna lost 6 HP! (1% of its health)

    The sandstorm rages!
    Sukuna is buffeted by the sandstorm!
    The foe's Snorlax is buffeted by the sandstorm!
    The foe's Snorlax fainted!
    Sukuna restored a little HP using its Leftovers!

    Tano won the battle!
    Tano: gg
    Zaftom: gg


    Converted with PO Log to BBCode
     
    Last edited: May 20, 2010
  2. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    It's great :)
     
  3. Akusu

    Akusu Guest

    Perhaps a shorter example would suffice hehe. Either way, good job. Now we can have War Stories! :P
     
  4. Tano

    Tano Member

    Joined:
    May 18, 2010
    Messages:
    58
    Likes Received:
    0
    lol, you're right ^^'

    i've cut the example.

    thanks.
     
  5. Steve

    Steve Active Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    491
    Likes Received:
    45
    Very nice! Thanks!
     
  6. Tano

    Tano Member

    Joined:
    May 18, 2010
    Messages:
    58
    Likes Received:
    0
    you're welcome.

    please report any bug, becouse i haven't tested it too much and with too many logs.

    also i have do make clear that this tool only works with english logs.
    that's becouse i can replace "<span style=\" font-weight:600; color:" with "[color=", and "<span style=\" color:" with "[color=", but i can't distinguish between "</span>" of a bold text and "</span>" of a normal coloured text. so i needed to add some rules based on the contents.

    if tou want it to work with all languages, i'm afraid i'll need the output of the log to be a little bit different. "</span >" (with space) for bold text and "</span>" for normal text will suffice.
     
  7. zeroality

    zeroality Artificial Insanity

    Joined:
    Apr 22, 2010
    Messages:
    1,378
    Likes Received:
    1
    Good stuff.