Quest Editor
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
Thank you Interkarma.
I have the code on a local git repository, i'm going to clean up a few things and publish it in the next days (including reorganized .tmLanguage).
In the meanwhile, i added an alpha to the dropbox link on first post. It's a .vsix file which can be installed directly from the editor ui.
I have the code on a local git repository, i'm going to clean up a few things and publish it in the next days (including reorganized .tmLanguage).
In the meanwhile, i added an alpha to the dropbox link on first post. It's a .vsix file which can be installed directly from the editor ui.
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
Repository is on github. You can find a download in Releases, this is where i'm going to push all updates.
In addition to what shown before, this version brings some small handy features to interact with symbols. For example you can rename a symbol preserving prefix (_foo_ -> _bar_ also changes __bar_, =bar_ etc.).
I converted tables from the documentation in json format to allow autocomplete. A future version may also use it also to confirm validity for existing symbol definitions.
To avoid manually selecting language for individual files, you can try to add a string like this to file associations in editor settings:
This should open txt files inside a folder called Quests as TEMPLATE files rather than raw text. Please report back if this isn't working for you.
If you want to contribuite open cloned folder in editor and run npm install (with no args) to automatically install dependencies.
@Hazelnut
Syntax file has been reworked and improved, now it doesn't contain comments as they are not needed anymore. Tell me if i can help
In addition to what shown before, this version brings some small handy features to interact with symbols. For example you can rename a symbol preserving prefix (_foo_ -> _bar_ also changes __bar_, =bar_ etc.).
I converted tables from the documentation in json format to allow autocomplete. A future version may also use it also to confirm validity for existing symbol definitions.
To avoid manually selecting language for individual files, you can try to add a string like this to file associations in editor settings:
Code: Select all
"files.associations": {
"**/Quests/*.txt": "dftemplate"
},
If you want to contribuite open cloned folder in editor and run npm install (with no args) to automatically install dependencies.
@Hazelnut
Syntax file has been reworked and improved, now it doesn't contain comments as they are not needed anymore. Tell me if i can help
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
An update on what i've been working on
Format document/selection. Messages with <ce> tag are optionally centered.
Find/peek message definition. Comment on line above is shown as a summary on hover. Hold Ctrl to see first line after definition.
Quests in the workspace (autocomplete, hover, go to/peek definition and references.
Format document/selection. Messages with <ce> tag are optionally centered.
Find/peek message definition. Comment on line above is shown as a summary on hover. Hold Ctrl to see first line after definition.
Quests in the workspace (autocomplete, hover, go to/peek definition and references.
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
Some work for actions, built with modularity in mind to fulfill Daggerfall Unity ability to import custom actions. Each mod that adds new actions can define a json file which provides signatures and a short description for them. For example this is from Daggerfall.json
Actions are used on autocomplete suggestions prompts
Snippet syntax allows easy immission of values even if high-level format is used instead of usual foo(arg1,arg2).
When cursor is above an action call, first word is seeked in all modules; after this first check, signature snippets are converted to regular expression. If a match is found, informations are shown on hover.
Modules can be added from workspace settings
A question for Interkarma/Hazelnut: I know some %abc macros were added just for DU, can they also be added from mods?
Code: Select all
{
"summary": "Give a quest item to player and displays QuestComplete success message or a custom message. Can be used to give quest reward or just place item directly into player's inventory.",
"overloads": [
"give pc nothing",
"give pc ${1:_item_}",
"give pc ${1:_item_} silently",
"give pc ${1:_item_} notify ${2:messageID}"
]
}
Snippet syntax allows easy immission of values even if high-level format is used instead of usual foo(arg1,arg2).
When cursor is above an action call, first word is seeked in all modules; after this first check, signature snippets are converted to regular expression. If a match is found, informations are shown on hover.
Modules can be added from workspace settings
Code: Select all
"dftemplate.modules": [
"${extensionPath}/modules/Daggerfall.json",
"${extensionPath}/modules/DaggerfallUnity.json"
]
- Interkarma
- Posts: 7236
- Joined: Sun Mar 22, 2015 1:51 am
Re: Syntax highlighting
Hazelnut would be the best one to answer, but I don't believe this is possible at this time. The first step of adding macro to the global dictionary in MacroHelper.cs doesn't appear open to mods.
- Hazelnut
- Posts: 3015
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Syntax highlighting
It's not currently possible to add new macros with mods but it's feasible. I would need to understand the use case to judge if it's worthwhile and how it would need to work. If is just a few to round out some gaps in classic then we could simply add them into base DFU. Otherwise I would expect they would likely be contextual and require context provider support etc so will have to think though all of that and see how best to support it.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
Started some work on diagnostics. This is based on the names of variables in the snippet/signature for actions and other keywords. A few examples:
${1:_person_} must be a) a symbol defined in the quest and b) defined as Person
${2:task} must be valid symbol of a task
${1:messageID}" must be a defined message
Time must use 24-hour format (00:00 to 23:59)
Code: Select all
"place npc ${1:_person_} at ${2:_place_}"
Code: Select all
"prompt ${1:message} yes ${2:task} no ${3:task}"
Code: Select all
"rumor mill ${1:messageID}"
Code: Select all
"daily from ${1:hh}:${2:mm} to ${3:hh}:${4:mm}"
Thanks for the answer. I was just wondering so i can best implement them in the extension. I'm organizing this kind of data in two ways: actions and conditions are imported from modules (as explained above) while symbol definitions and messages are not exposed. I'll keep macros like the latters then.Hazelnut wrote: ↑Thu Jul 26, 2018 7:37 pm It's not currently possible to add new macros with mods but it's feasible. I would need to understand the use case to judge if it's worthwhile and how it would need to work. If is just a few to round out some gaps in classic then we could simply add them into base DFU. Otherwise I would expect they would likely be contextual and require context provider support etc so will have to think though all of that and see how best to support it.
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
Added special support for "params"
and when task
Some improvements on symbol seek. Messages, symbols and tasks are shown grouped in QRC and QBN blocks.
And more additions to live diagnostics
Suggests the next available message
Ps: i've seen some quests which declare variables without using them in a task nor setting a global number (for example variable _2ndparton_ in L0B30Y09). I can't find a reason in the documentation, what's their purpose?
and when task
Some improvements on symbol seek. Messages, symbols and tasks are shown grouped in QRC and QBN blocks.
And more additions to live diagnostics
Suggests the next available message
Ps: i've seen some quests which declare variables without using them in a task nor setting a global number (for example variable _2ndparton_ in L0B30Y09). I can't find a reason in the documentation, what's their purpose?
- Interkarma
- Posts: 7236
- Joined: Sun Mar 22, 2015 1:51 am
Re: Syntax highlighting
I believe those are the result of quest author copy pasting from one quest to another (maybe they had a few base quests to start from) and not cleaning up after adding custom logic.
Your syntax highlighting will not only help new quest authors, but help community tidy up the classic quests over time. BTW, this looks better every time I see it. I think the original quest authors would have enjoyed a text editor like this.
Your syntax highlighting will not only help new quest authors, but help community tidy up the classic quests over time. BTW, this looks better every time I see it. I think the original quest authors would have enjoyed a text editor like this.
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Syntax highlighting
Thank you Interkarma.
I made a lot of additions since latest release, so it's time to publish a new version. You can find the download here while this is the changelog. Some more detailed instructions are available on first post.
I made a lot of additions since latest release, so it's time to publish a new version. You can find the download here while this is the changelog. Some more detailed instructions are available on first post.