Jump to content

[TUT] Function Syntax Highlighting for N++


Dealman

Recommended Posts

I recently decided to sit down and define my own language for Notepad++ based on Lua, but I wanted each MTA function to be highlighted according to their availability(whether it's client-only, server-only or shared). So I came up with this little script which compares the functions available on the Wiki and splits them into text files.

Now I'm only sharing this script in case it might help someone for some reason, skip ahead if you're not interested in this and just want to get the syntax highlighting going.

Client Code;

local clientFunctions = { 
    [1] = "getRadioChannel",
    [2] = "getRadioChannelName",
    [3] = "getSFXStatus",
    [4] = "getSoundBPM",
    [5] = "getSoundEffects",
    [6] = "getSoundFFTData",
    [7] = "getSoundLength",
    [8] = "getSoundLevelData",
    [9] = "getSoundMaxDistance",
    [10] = "getSoundMetaTags",
    [11] = "getSoundMinDistance",
    [12] = "getSoundPan",
    [13] = "getSoundPosition",
    [14] = "getSoundProperties",
    [15] = "getSoundSpeed",
    [16] = "getSoundVolume",
    [17] = "getSoundWaveData",
    [18] = "isSoundPanningEnabled",
    [19] = "isSoundPaused",
    [20] = "playSFX",
    [21] = "playSFX3D",
    [22] = "playSound",
    [23] = "playSound3D",
    [24] = "playSoundFrontEnd",
    [25] = "setRadioChannel",
    [26] = "setSoundEffectEnabled",
    [27] = "setSoundMaxDistance",
    [28] = "setSoundMinDistance",
    [29] = "setSoundPan",
    [30] = "setSoundPanningEnabled",
    [31] = "setSoundPaused",
    [32] = "setSoundPosition",
    [33] = "setSoundProperties",
    [34] = "setSoundSpeed",
    [35] = "setSoundVolume",
    [36] = "stopSound",
    [37] = "createBlip",
    [38] = "createBlipAttachedTo",
    [39] = "getBlipColor",
    [40] = "getBlipIcon",
    [41] = "getBlipSize",
    [42] = "setBlipColor",
    [43] = "setBlipIcon",
    [44] = "setBlipSize",
    [45] = "getBlipOrdering",
    [46] = "setBlipOrdering",
    [47] = "getBlipVisibleDistance",
    [48] = "setBlipVisibleDistance",
    [49] = "fadeCamera",
    [50] = "getCamera",
    [51] = "getCameraClip",
    [52] = "getCameraGoggleEffect",
    [53] = "getCameraInterior",
    [54] = "getCameraMatrix",
    [55] = "getCameraTarget",
    [56] = "getCameraViewMode",
    [57] = "setCameraClip",
    [58] = "setCameraGoggleEffect",
    [59] = "setCameraInterior",
    [60] = "setCameraMatrix",
    [61] = "setCameraTarget",
    [62] = "setCameraViewMode",
    [63] = "addPedClothes",
    [64] = "getBodyPartName",
    [65] = "getClothesByTypeIndex",
    [66] = "getClothesTypeName",
    [67] = "getPedClothes",
    [68] = "getTypeIndexFromClothes",
    [69] = "removePedClothes",
    [70] = "createColCircle",
    [71] = "createColCuboid",
    [72] = "createColRectangle",
    [73] = "createColSphere",
    [74] = "createColTube",
    [75] = "createColPolygon",
    [76] = "isElementWithinColShape",
    [77] = "getElementsWithinColShape",
    [78] = "getElementColShape",
    [79] = "getCursorPosition",
    [80] = "setCursorPosition",
    [81] = "isCursorShowing",
    [82] = "showCursor",
    [83] = "setCursorAlpha",
    [84] = "getCursorAlpha",
    [85] = "dxDrawImage",
    [86] = "dxDrawImageSection",
    [87] = "dxDrawLine",
    [88] = "dxDrawLine3D",
    [89] = "dxDrawRectangle",
    [90] = "dxDrawText",
    [91] = "dxGetFontHeight",
    [92] = "dxGetTextWidth",
    [93] = "dxCreateFont",
    [94] = "dxCreateTexture",
    [95] = "dxCreateShader",
    [96] = "dxCreateRenderTarget",
    [97] = "dxCreateScreenSource",
    [98] = "dxGetMaterialSize",
    [99] = "dxSetShaderValue",
    [100] = "dxSetShaderTessellation",
    [101] = "dxSetShaderTransform",
    [102] = "dxSetRenderTarget",
    [103] = "dxUpdateScreenSource",
    [104] = "dxGetStatus",
    [105] = "dxSetTestMode",
    [106] = "dxGetTexturePixels",
    [107] = "dxSetTexturePixels",
    [108] = "dxGetPixelsSize",
    [109] = "dxGetPixelsFormat",
    [110] = "dxConvertPixels",
    [111] = "dxGetPixelColor",
    [112] = "dxSetPixelColor",
    [113] = "dxSetBlendMode",
    [114] = "dxGetBlendMode",
    [115] = "dxDrawMaterialLine3D",
    [116] = "dxDrawMaterialSectionLine3D",
    [117] = "dxSetAspectRatioAdjustmentEnabled",
    [118] = "dxSetTextureEdge",
    [119] = "createEffect",
    [120] = "fxAddBlood",
    [121] = "fxAddBulletImpact",
    [122] = "fxAddBulletSplash",
    [123] = "fxAddDebris",
    [124] = "fxAddFootSplash",
    [125] = "fxAddGlass",
    [126] = "fxAddGunshot",
    [127] = "fxAddPunchImpact",
    [128] = "fxAddSparks",
    [129] = "fxAddTankFire",
    [130] = "fxAddTyreBurst",
    [131] = "fxAddWaterHydrant",
    [132] = "fxAddWaterSplash",
    [133] = "fxAddWood",
    [134] = "getEffectDensity",
    [135] = "getEffectSpeed",
    [136] = "setEffectDensity",
    [137] = "setEffectSpeed",
    [138] = "attachElements",
    [139] = "createElement",
    [140] = "destroyElement",
    [141] = "detachElements",
    [142] = "getAttachedElements",
    [143] = "getElementAttachedOffsets",
    [144] = "getElementAlpha",
    [145] = "getElementCollisionsEnabled",
    [146] = "getElementAttachedTo",
    [147] = "getElementBoundingBox",
    [148] = "getElementByID",
    [149] = "getElementChild",
    [150] = "getElementChildren",
    [151] = "getElementChildrenCount",
    [152] = "getElementColShape",
    [153] = "getElementData",
    [154] = "getElementDimension",
    [155] = "getElementDistanceFromCentreOfMassToBaseOfModel",
    [156] = "getElementHealth",
    [157] = "getElementID",
    [158] = "getElementInterior",
    [159] = "getElementMatrix",
    [160] = "getElementModel",
    [161] = "getElementParent",
    [162] = "getElementPosition",
    [163] = "getElementRotation",
    [164] = "getElementRadius",
    [165] = "getElementsByType",
    [166] = "getElementsWithinColShape",
    [167] = "getElementType",
    [168] = "getElementVelocity",
    [169] = "getLowLODElement",
    [170] = "getRootElement",
    [171] = "isElement",
    [172] = "isElementAttached",
    [173] = "isElementCallPropagationEnabled",
    [174] = "isElementCollidableWith",
    [175] = "isElementDoubleSided",
    [176] = "isElementFrozen",
    [177] = "isElementLocal",
    [178] = "isElementLowLOD",
    [179] = "isElementInWater",
    [180] = "isElementOnScreen",
    [181] = "isElementStreamable",
    [182] = "isElementStreamedIn",
    [183] = "isElementSyncer",
    [184] = "isElementWaitingForGroundToLoad",
    [185] = "isElementWithinColShape",
    [186] = "setElementAlpha",
    [187] = "setElementAttachedOffsets",
    [188] = "setElementCallPropagationEnabled",
    [189] = "setElementCollidableWith",
    [190] = "setElementCollisionsEnabled",
    [191] = "setElementData",
    [192] = "setElementDimension",
    [193] = "setElementDoubleSided",
    [194] = "setElementFrozen",
    [195] = "setElementHealth",
    [196] = "setElementID",
    [197] = "setElementInterior",
    [198] = "setElementMatrix",
    [199] = "setElementModel",
    [200] = "setElementParent",
    [201] = "setElementPosition",
    [202] = "setElementRotation",
    [203] = "setElementStreamable",
    [204] = "setElementVelocity",
    [205] = "setLowLODElement",
    [206] = "engineImportTXD",
    [207] = "engineLoadCOL",
    [208] = "engineLoadDFF",
    [209] = "engineLoadTXD",
    [210] = "engineReplaceCOL",
    [211] = "engineReplaceModel",
    [212] = "engineRestoreCOL",
    [213] = "engineRestoreModel",
    [214] = "engineSetAsynchronousLoading",
    [215] = "engineSetModelLODDistance",
    [216] = "engineGetModelLODDistance",
    [217] = "engineApplyShaderToWorldTexture",
    [218] = "engineRemoveShaderFromWorldTexture",
    [219] = "engineGetModelNameFromID",
    [220] = "engineGetModelIDFromName",
    [221] = "engineGetVisibleTextureNames",
    [222] = "engineGetModelTextureNames",
    [223] = "addEvent",
    [224] = "addEventHandler",
    [225] = "getEventHandlers",
    [226] = "cancelEvent",
    [227] = "removeEventHandler",
    [228] = "triggerEvent",
    [229] = "triggerServerEvent",
    [230] = "wasEventCancelled",
    [231] = "triggerLatentServerEvent",
    [232] = "getLatentEventHandles",
    [233] = "getLatentEventStatus",
    [234] = "cancelLatentEvent",
    [235] = "createExplosion",
    [236] = "fileClose",
    [237] = "fileCreate",
    [238] = "fileDelete",
    [239] = "fileExists",
    [240] = "fileFlush",
    [241] = "fileGetPos",
    [242] = "fileGetSize",
    [243] = "fileIsEOF",
    [244] = "fileOpen",
    [245] = "fileRead",
    [246] = "fileRename",
    [247] = "fileSetPos",
    [248] = "fileWrite",
   
Link to comment
  • 2 months later...
  • 7 months later...
  • 2 weeks later...
  • 2 weeks later...
Good job, Dealman, thanks.

I am messing with it and trying to separate --[[ ]] comment with [[ ]] message string but no luck.

Do you have any idea? :?

Unfortunately not. I made a thread on their SourceForge forum while I was developing it asking that very question, weren't able to fix it because their system was kinda shite.

They might have updated it so it's possible now, not sure.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...