[INFO] Advanced Syntax-Highlighting now supported

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Advanced Syntax-Highlighting now supported

Post by Xuri »

This forum now supports an advanced form of Syntax-Highlighting, which can add language-specific highlighting for over 130 different languages (including, of course - JavaScript - as well as the UOX3 DFN format!). This post will contain information about how to use this feature, with JavaScript/UOX3 DFNs being used as example languages.

The basics:
Surround your text with the following tags to add language-specific syntax-highlighting (as well as a "Download"-link for easy access to the script itself)

Code: Select all

[Codebox=language file=Untitled.languageExtension]Text goes here[/Codebox]
Example, using "javascript" as language:
function onUseChecked( pUser, iUsed )
{
    if( iUsed.container && iUsed.container != pUser.pack )
        pUser.SysMessage( "This item needs to be in your backpack before you can use it!" );
    else
        pUser.CustomTarget( 0, "Select target to inflict with pie-to-the-face:" );
    return false;
}

function onCallback0( socket, myTarget )
{
    var pUser = socket.currentChar;
    var iUsed = socket.tempObj;

    if( !socket.GetWord( 1 ) && myTarget.isChar )
    {
        //Throw pie in target face here
    }
    else
        pUser.SysMessage( "The target is not a character!" );
}
Another example, this time using "uox3dfn" as language:
[base_book]
{
get=base_item
name=book
id=0x0fef
value=18 9
weight=100
restock=20
movable=1
decay=1
type=11
morex=666
morey=32
good=32
}

[0x0fef]
{
get=base_book
name=book
id=0x0fef
}

[0x0ff0]
{ green/beige
get=base_book
name=a book
id=0x0ff0
}
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Pshaw, syntax highlighting, real pros write code in notepad!
Scott
Post Reply