Function List - Help for adding a custom language



  • Hello,

    The game Wolfenstein Enemy Territory has a bot mod called Omni-Bot, which has a scripting part powered by the Game Monkey script language

    It has as such added some particular functions etc. which are bundled through its repository with a custom Notepad++ installation

    Currently, it has a parser definition that roughly works: it captures almost all the “namespace” and function names, but at the same level

    Here it is:
    <code>
    <parser id=“ob_function_old” displayName=“Omni-Bot (old)” commentExpr="((/*.?*)/|(//.?$))">
    <function mainExpr="^[ \t]*(global |member )?([0-9A-Za-z_.]+)(\ *)=(\ )function(\ )(([0-9A-Za-z_,\ ]))" displayMode="$functionName">
    <functionName>
    <nameExpr expr="^[ \t]
    (global |member )?\K[0-9A-Za-z_.]+"/>
    </functionName>
    </function>
    </parser>
    </code>

    I’d like to improve it so the functions are inside the “namespaces”, and that all parts are captured
    I ran the various regular expressions in regex101 to check them, but they doesn’t seem to work once in the N++ file

    Here is the script I’ve modified:
    <code>
    <!-- ========================================================== [ GM ] -->
    <!-- GM - Game Monkey script for Omni-Bot -->

    <parser
    displayName=“Omni-Bot”
    id =“ob_function”

    <classRange
        mainExpr    ="\w*(global)\s+([0-9A-Za-z_\.]+)\s*\=\s*(function\(\s*\w*\s*\)){0,1}\s*\{"
        openSymbole ="\{"
        closeSymbole="\}\;"
    >
        <className>
            <nameExpr expr="\w*(global)\s+\K[0-9A-Za-z_\.]+" />
        </className>
        <function
            mainExpr="\s*\K[0-9A-Za-z_\.]+\s*\=\s*(function\(\s*[0-9a-zA-Z_\.]*\s*\))?\s*\{"
        >
            <functionName>
                <nameExpr expr="\s*\K[0-9A-Za-z_\.]+"/>
            </functionName>
        </function>
    </classRange>
    

    </parser>
    </code>

    And here is an example file:
    https://pastebin.com/Uk9jdfzw

    The current definition outputs:
    <code>
    navigate
    OnEnter
    Test
    Test2
    OnMapLoad
    OnBotJoin
    InitializeRoutes
    </code>

    The goal is to have something like:
    <code>
    Map
    Navigation
    jump
    navigate
    Roles
    Axis
    DEFENDER
    DEFENDER1
    AxisBridgeSuicide
    OnEnter
    Test0
    Test
    Test2
    OnMapLoad
    OnBotJoin
    InitializeRoutes
    </code>

    (What’s above it supposed to be indented but heh I’m probably using the wrong MarkDown stuff)

    My modified parser just outputs nothing atm…

    The script part in userDefineLang.xml is the same between these two, I don’t think you need that in order to help?

    Do you see what’s wrong? ^^’

    Thank you in advance,

    Regards,

    Mateos



  • modify the exiting language for test
    as css
    #define IDM_LANG_CSS (IDM_LANG + 10)



  • Hi,

    What do you mean by the “exiting language”? Where should I put this line?



  • @Mateos81
    well in function list.xml go to line no. 59

         <association id="my_parser_id" userDefinedLangName="My UDL Name" />


  • Ah I have this there:
    <!-- ======================================================================== -->
    <association id= “ob_function_old” userDefinedLangName=“Omni-Bot (old)” />
    <!-- ======================================================================== -->
    <association id= “ob_function” userDefinedLangName=“Omni-Bot” />
    <!-- ======================================================================== -->

    That’s what I use to test; like now if I switch through the N++ menu to either of these languages, well original works but mine don’t

    I should have precised that’s present in the file yeah, without you can’t select the language ^^’

    Edit: And ofc related entries in userDefineLang.xml



  • @Mateos81 said:
    i think this was a only comment
    uses is as
    displayName=“Omni-Bot”
    replace

    userDefinedLangName=“Omni-Bot”



  • Hmm I think it’s already the case, or I’m mistaking something?

    I have two association and parser tables, one is Omni-Bot (old) and the other is Omni-Bot in functionList.xml, same in userDefineLang.xml

    Old works fine, it’s the new one the issue, it doesn’t seem to parse anything

    Have you tried adding these to your files and checked the two configurations?


Log in to reply