how to make your own bbcodes?

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
User avatar
Ark
Posts: 427
Joined: Wed Jun 01, 2011 10:25 pm

how to make your own bbcodes?

Post by Ark »

Hello everyone wanted to ask if anyone got any experience with bbcodes. Where exactly do you download the source? And besides that how can you make like your own bbcode: for example like if you're sending a message to another player in the game and in your message you put [player] arigato23 [/player]

And when the other player recieves that message their html would be <a href="('arigato's profile.php')">arigato23</a>

yeah I know I would have to query if the player exists and all that, but how to know when it's surrounded by the [player][/player] ...

Oh also how like what would be the javascript(if that's the one) to do when you highlight a section of a text and then press the B button for example and then it puts the [ b][/b] around that highlighted text.

regards to everyone! :D
Orgullo Catracho
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: how to make your own bbcodes?

Post by Chris »

Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: how to make your own bbcodes?

Post by Jackolantern »

Cool! Very concise code, too. I had wondered before how to do this, but I am not a whiz with regular expressions.
The indelible lord of tl;dr
User avatar
Ark
Posts: 427
Joined: Wed Jun 01, 2011 10:25 pm

Re: how to make your own bbcodes?

Post by Ark »

Yeah Thanks Chris, i´d also figured out the javascript part. As it's not in that link ill post the js function here:

Code: Select all

function SelectedText(){
    var t = '';
    if(window.getSelection){
            t = window.getSelection();
    }else if(document.getSelection){
            t = document.getSelection();
    }else if(document.selection){
            t = document.selection.createRange().text;
    }
    return t;
}
Orgullo Catracho
Post Reply

Return to “Advanced Help and Support”