• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] [FIXED] how create new native functions can be suggested by the autotext system
#1
Lightbulb 
How do I create new native functions that can be suggested to the autotext system later? so far I can only walk with #define only.



FIXED



[ First Install the All Autocomplete - Packages - Package Control ]




[Image: 167018997_5565589703481329_5851269852517...e=6088143A]

[Image: 166749805_5565592510147715_7986765319724...e=60882027]
  Reply
#2
Native functions are functions inside the host application. Has nothing to do with creating a function list. Just so happens that pawno does this, but it's not what they are intended for (just making sure you know what native functions are). To truly create one you'd need to create a plugin.
https://raw.githubusercontent.com/compup...n-lang.pdf
Quote:The only means that a pawn program has to manipulate objects in the host application is by calling subroutines, so called ?native functions?, that the host application provides.

Anyway, now the correct way to create custom function (snippet) list: You'll need a .code-snippets file in your .vscode directory for that. Syntax is as follows:
Code:
{
    "FunctionName": { //Displayed on the right of the popup
        "prefix": "FunctionName", //Displayed on the left of the popup
        "description": "Little description about the function", //Not displayed, as far as I know
        "body": "FunctionName()$0" //Text to insert to your file when the function is selected. See code below for an example of two of your functions
    }
}
For example: ./.vscode/my-functions.code-snippets
Code:
{
    "SEM": {
        "prefix": "SEM",
        "description": "Send an error message to a player",
        "body": "SEM(${1:playerid}, ${2:yourstring[]})$0"
    },
    "AddOwnableCarData": {
        "prefix": "AddOwnableCarData",
        "description": "Add ownable car data",
        "body": "AddOwnableCarData(${1:vehicleid}, ${2:OC_SQL_ID}, ${3:plus}, ${4:new_value})$0"
    }
}

More (and better) information about snippets here: https://code.visualstudio.com/docs/edito...edsnippets
  Reply


Forum Jump: