Results 1 to 4 of 4

Thread: VSCode extension

  
  1. #1

    Default VSCode extension

    I made a vscode extension for DK FX scripting. It provides simple auto completion, syntax checks, auto formatter and highlighting. I'll keep updating it with newest commands. As of 0.1.1 it's not completely finished yet, but all the critical stuff is already there, so it's ready to use.

    CHANGELOG




    I don't use VSCode, is it worth installing just for a couple of DK maps?
    Yes, you can have the editor with extension ready in just two minutes.

    I've never touched VSCode. How to install & use this extension?
    Download and install VSCode. When done, right click the folder that contains DK maps and in the context menu click the item with a blue icon and text "Open with code".
    On the panel to the left (shown here), click the extension icon (the 4 cubes):
    Look for dungeon keeper and install Dungeon Keeper's scripting assistant.
    Next look for an extension named 'Dracula official' and install it. This is an optional color theme for VSCode but I find the DK extension works the best with that theme.

    Now any time you open a .txt file named 'map' followed by 5 numbers, the editor should recognize it is a dungeon keeper script.

    What are some essential keyboard shortcuts?
    For tabs it works like in browser (ctrl+pagedown,ctrl+w,ctrl+shift+t). Ctrl+Space for code completion. Ctrl+/ to (un)comment a line. Alt+shift+F to auto-format

    Is there any way to browse just the script files?
    Yes, I made a convenient script browser. When editing a dk script, open the command menu (CTRL+SHIFT+P), type 'dk browse', press enter.

    Does it mean I don't have to check DK log after starting up a map to see if it has any errors?
    You should still check logs for script errors. Remember it does not use any of DK's code to check for errors. It has its own checker that works differently.

    Is there any way to temporarily add a custom command I'm working on?
    Yes, go to your local .vscode directory, edit (for windows: ) current user directory/.vscode/extensions/(find dk-scripting-assist)/resources/custom_commands.yaml. Add commands in the same format as they are in commands.yaml

    Is there any way to disable a diagnostic for one line?
    Yes, for that line, include a comment that contains '@ignore"

    How is it unfinished? What is it missing?
    Currently only the newest commands are supported, the extension complains if you do not include the level_version(1) command.
    Commands auto completion is upper case only.

    Is there any way to add custom traps or disable diagnostics?
    Yes, open settings (ctrl + ,), look for 'dungeon keeper' and edit the extension settings. Then restart the editor.

    Click image for larger version. 

Name:	dka1.gif 
Views:	114 
Size:	938.2 KB 
ID:	2227
    Last edited by kix; June 12th, 2022 at 11:57.

  2. #2
    Demon Spawn Necror's Avatar
    Join Date
    Feb 2010
    Location
    qqluqq
    Posts
    184
    Gamer IDs

    Steam ID: qqluqq

    Default Re: VSCode extension

    seems to look pretty nice already but clicking trough a couple random scripts existing scripts already found some commands he wrongfully marks as incorrect

    IF(PLAYER0,CAMPAIGN_FLAG5 >= 1) all Ifs with campain flags seem marked as wrong

    ALLY_PLAYERS(PLAYER3,PLAYER_GOOD) this one he says needs 3 parameters but this is only the case with LEVEL_VERSION(1) enabled

    COMPUTER_PLAYER(PLAYER_GOOD,0) doesn't accept PLAYER_GOOD here

    all these lines are in campains included in FX so I assume they should be valid

    but yeah most scripts are looking good
    Last edited by Necror; February 15th, 2022 at 23:18.

  3. #3

    Default Re: VSCode extension

    Quote Originally Posted by Necror View Post
    ALLY_PLAYERS(PLAYER3,PLAYER_GOOD) this one he says needs 3 parameters but this is only the case with LEVEL_VERSION(1) enabled
    all these lines are in campains included in FX so I assume they should be valid
    I added to the main post that currently only the newest commands with LEVEL_VERSION(1) are supported.

    Quote Originally Posted by Necror View Post
    IF(PLAYER0,CAMPAIGN_FLAG5 >= 1) all Ifs with campain flags seem marked as wrong
    You're right, I'll include a fix in the next version

    Quote Originally Posted by Necror View Post
    COMPUTER_PLAYER(PLAYER_GOOD,0) doesn't accept PLAYER_GOOD here
    is it a valid parameter for that command? what does it do?
    edit: i got an answer on discord, if it is disabled in keeper fx then I'll keep it that way for now
    Last edited by kix; February 16th, 2022 at 16:48.

  4. #4

    Default Re: VSCode extension

    Added settings. Now it is possible to turn off diagnostics and enter custom trap names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •