Quest Editor

For all talk about quest development - creation, testing, and quest system.
Post Reply
User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

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.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

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.

Image

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"
},
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 :)

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

An update on what i've been working on

Format document/selection. Messages with <ce> tag are optionally centered.
Image

Find/peek message definition. Comment on line above is shown as a summary on hover. Hold Ctrl to see first line after definition.
Image

Quests in the workspace (autocomplete, hover, go to/peek definition and references.
Image
Image

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

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

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}"
        ]
}
Actions are used on autocomplete suggestions prompts
Image

Snippet syntax allows easy immission of values even if high-level format is used instead of usual foo(arg1,arg2).
Image

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.
Image

Modules can be added from workspace settings

Code: Select all

"dftemplate.modules": [
	"${extensionPath}/modules/Daggerfall.json",
    	"${extensionPath}/modules/DaggerfallUnity.json"
]
A question for Interkarma/Hazelnut: I know some %abc macros were added just for DU, can they also be added from mods?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Syntax highlighting

Post by Interkarma »

TheLacus wrote: Sun Jul 22, 2018 8:48 pm A question for Interkarma/Hazelnut: I know some %abc macros were added just for DU, can they also be added from mods?
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.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Syntax highlighting

Post by Hazelnut »

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

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

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:

Code: Select all

"place npc ${1:_person_} at ${2:_place_}"
${1:_person_} must be a) a symbol defined in the quest and b) defined as Person

Code: Select all

"prompt ${1:message} yes ${2:task} no ${3:task}"
${2:task} must be valid symbol of a task

Code: Select all

"rumor mill ${1:messageID}"
${1:messageID}" must be a defined message

Code: Select all

"daily from ${1:hh}:${2:mm} to ${3:hh}:${4:mm}"
Time must use 24-hour format (00:00 to 23:59)

Image
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.
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. :)

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

Added special support for "params"
Image

and when task
Image

Some improvements on symbol seek. Messages, symbols and tasks are shown grouped in QRC and QBN blocks.
Image

And more additions to live diagnostics
Image

Suggests the next available message
Image

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?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Syntax highlighting

Post by Interkarma »

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. :)

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Syntax highlighting

Post by TheLacus »

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.

Post Reply