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 »

Interkarma wrote: Sat Aug 18, 2018 10:28 pm
TheLacus wrote: Sat Aug 18, 2018 12:23 pm I have a question for Interkarma: comments must start with the first char of the line, it is not correct to have something like " -- text" or "give pc _reward_ -- text", isn't it ? I think in some cases the trailing part of the line is ignored once the leading has been accepted and parsed, but i wanted to check with you if this is to be considered safe or i should mark it as an error.
A comment line needs only start with a single "-" dash character and anything after it is ignored. It's not technically supported to place comments after the line, although a regex match will ignore everything after the match so it's possible.

Still, I'd prefer the syntax highlighting to only support intended comment usage and perhaps look at adding a different style of comment sequence for both single lines and trailing comments. Probably adding good old C // comment support would make the most sense. I mainly went with "-" as it was already being generated by TEMPLATE and was required for backward compatibility.
Thank you for your answer. I'm not really interested in adding a new comments style, i only wanted to be sure about the intended rules for comments. Specifically I'm interested in your opinion on the formal correctness of indented comments like the second line here

Code: Select all

--  Once the PC injures the _monster_, offer the PC a bribe of another
  --  artifact to desist.  In its haste to get away from the PC, _monster_
--  drops a scrap of paper that the PC may read.
I never saw this happening in a quest and assumed is not allowed, but the parser in game trims the line before checking for the '-' char so it should be skipped anyway.
I see three possiblities for the editor: 1) accept as correct, 2) accept but suggest to align to the left as refactoring, 3) report as error. Since it works in game, i would go with 1 or 2.

Thinking again, it would make sense to have an indentation in a task. I'm probably overthinking it but can you confirm this example is 100% correct?

Code: Select all

_S.00_ task:
	clicked npc _priest_ 
	-- now it prompts yes-no
	prompt 1030 yes _S.03_ no _S.04_ 
	-- now say message
	say 1021

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

Re: Syntax highlighting

Post by Interkarma »

Yes that example should be correct. Any leading white space is trimmed before parsing line and looking for comment character. Indents have no special meaning other than to make it more readable to humans.

One exception though is reading message blocks. Once a block starts, each line is taken verbatim until an empty line is found to end the message block.

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

Re: Syntax highlighting

Post by TheLacus »

New version is available, with fix for used do and other improvements. As previously announced, it now reads Quests-xxx.txt files from StreamingAssets/Tables. If you are not working inside a subfolder of StreamingAssets, you need to set dftemplate.tablesPath with an absolute or relative path to this folder (or any folder that contains these files). The option dftemplate.codeLens.enabled (disabled by default), allows to enable iperlinks with metadata (task references, clock-task link, etc.).

Minimum vs code version has been raised from 1.24 to 1.25 (current is 1.26) to support fading of unused symbols. Let me know if you find any issue :)

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Syntax highlighting

Post by Jay_H »

Yay :D I'll give feedback as I go along with it. Thank you!

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Syntax highlighting

Post by Jay_H »

In the previous version, unused symbols had red or green highlighting under them. Now that doesn't happen, and I have to manually ensure my symbols are used elsewhere. Is this intentional?

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

Re: Syntax highlighting

Post by TheLacus »

Jay_H wrote: Sat Aug 25, 2018 6:15 pm In the previous version, unused symbols had red or green highlighting under them. Now that doesn't happen, and I have to manually ensure my symbols are used elsewhere. Is this intentional?
This happen if the tables path is not set. If data can't be read, diagnostics are not enabled so you don't see errors or warnings prompts.
Be sure that the folder or workspace file you are using is inside a subfolder of StreamingAssets. If you prefer, you can work from another location but you need to manually set the path.

Code: Select all

"dftemplate.tablesPath": "C:/somefolders/StreamingAssets/Tables"
You actually should see a popup on the bottom right that tells you it failed to load language data. :)

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Syntax highlighting

Post by Jay_H »

I don't think I got a pop-up, but the error does appear in the bottom-right corner. I'm trying to see where I add that path you mention, but I don't see where to. Where do I put it?

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

Re: Syntax highlighting

Post by TheLacus »

Jay_H wrote: Sat Aug 25, 2018 7:03 pm I'm trying to see where I add that path you mention, but I don't see where to. Where do I put it?
in the settings file, like you did for language association. You can put this one in user settings instead of workspace settings, if you prefer. :)

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Syntax highlighting

Post by Jay_H »

Ah, thank you. I tried it but it gave me errors relating to missing files like Quests-Diseases.txt, and didn't provide the diagnostics. I chose to reinstall VS Code rather than take up your time with a step-by-step repair job. Now I'm working directly inside the Streaming Assets folder instead, and things are fine.

The QuestList file is filled with red underlines. It says the expressions are undefined for "Preamble." The same appears to be true for every non-quest file, so red underlines are common now.

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

Re: Syntax highlighting

Post by TheLacus »

Jay_H wrote: Sat Aug 25, 2018 8:04 pm The QuestList file is filled with red underlines. It says the expressions are undefined for "Preamble." The same appears to be true for every non-quest file, so red underlines are common now.
Unfortunately this is to be expected since we associated .txt files with template language. If this bother you, it's possible to hide a file with files.exclude. Add something like this:

Code: Select all

"**/QuestList-*.txt": true
you can also exclude other files like "**/readme.txt" etc. Note that this hides the file completely from the editor.

Alternatively you can try to force a txt association to read the file as raw text.

Code: Select all

"files.associations": {
	"**/QuestList-*.txt": "plaintext",
	"*.txt": "dftemplate"
},

Post Reply