[Solved] Quicker Way to add to Parser

Started by eminigalaxy, Sun 29/10/2023 15:26:37

« previous - next »

eminigalaxy

This may seem like a really silly question but does anyone know of a quicker way to add words to the parser? It is very tedious and I was wondering if there was a slightly quicker way or a shortcut or something.
I never rlly know what I'm doing but that's life. || WIP: Dilvemma

eri0o

I think it's not possible, you would be using that interface to add. My guess is the alternative would be making your own parser using AGS Script and making up some text file format you read and use it to configure your own handmade parser.

Snarky

#2
For things that are tedious to edit in the IDE (there used to be no good way to reorganize the sprite folder structure, for example, though I believe that's been fixed in the latest version), I've sometimes resorted to editing the game.agf file directly in a text/xml editor. I imagine that should be possible for the parser vocab as well. (Just back it up beforehand in case you break something!)

Crimson Wizard

..or if someone will write a tool or a editor plugin that would work with the same data, but in a more convenient and fast way in terms of UI.

I guess it would be possible to improve the workflow in the editor itself, but frankly, text parsers are not very much popular nowadays, so this feature has not been updated in AGS for many years.

Danvzare

It'd be nice if you could just save and load the text parser words to and from a text file.
But unfortunately you can't.  :~(

Quote from: Crimson Wizard on Mon 30/10/2023 16:05:55I guess it would be possible to improve the workflow in the editor itself, but frankly, text parsers are not very much popular nowadays, so this feature has not been updated in AGS for many years.
Is it possible that text parsers aren't popular in AGS, because it's difficult to use?

I mean, I'm willing to bet that even if it was an absolute dream to use the text parser, it still wouldn't be super popular. But I think that the difficulty in using a parser due to it not being updated, has made it less popular, which in turn has meant that it hasn't been updated, which in turn has made it less popular.  :-\
A text parser template doesn't even come with the engine, and the template you can find, could use some major refinement in my opinion (such as some basic words already included in the list of parser words, like the words that all of the AGI games typically include).

Crimson Wizard

#5
Quote from: Danvzare on Mon 30/10/2023 16:24:54It'd be nice if you could just save and load the text parser words to and from a text file.
But unfortunately you can't.

It should be possible write a tool which loads a text file and modifies game xml based on this, for instance. That's the most primitive way of achieving this.
There are numerous xml parsing libraries, probably available for all popular programming languages.

On the other hand, writing a plugin for the editor may be a viable solution. Afaik plugins may add menu commands, and access game data. Hence they may be a good choice to implement import/export formats.

Quote from: Danvzare on Mon 30/10/2023 16:24:54Is it possible that text parsers aren't popular in AGS, because it's difficult to use?

How many discussions are there about improving a text parser, around AGS forums? From my memory in all this time (~10 years) there have been only 1 request concerning the parser in our issue tracker on github, something regarding getting the result of last parsing iirc.
A group of "unofficial" translators have contacted me once (several years ago), asking to make a custom engine that would support replacing parser's dictionary with translated words. That's how I learnt that parser's dictionary is not translated. But I do not remember any game authors asking for the same thing.

If one would make statistics of number of users who would like to use a text parser but cannot because of its complexity, that will show this feature's demand.

Then somebody could make a list of things that needs to be improved, and even better make a plan on how they could be improved, that would be something to start a work with. This may be a complete feature overhaul, as well as improvements for existing one.

Quote from: Danvzare on Mon 30/10/2023 16:24:54A text parser template doesn't even come with the engine, and the template you can find, could use some major refinement in my opinion

If one will make a good template with a text parser, and there will be a demand for it, we may include it into AGS distribution.

Khris

#6
Made a small online tool: https://khris.ddns.net/agsparser/

1. Select your Game.agf file and you will see the list of words.

2. if you have already entered a bunch of words in AGS, click "Export word list" to create a text file called "words.txt" that contains all the custom words. Synonyms go in the same line, separated by a comma.
Now edit this file to your liking (or create a new one) putting one new word and its synonyms per line (you can also include blank lines and comments starting with # or //, and hanging commas and spaces are all removed):

Code: ags
apple
sofa,couch
test

# animals
dog,doggo
cat,kitten,kitty

// food
ice cream,popsicle
Finally, upload the file using the "Import word list" button.

3. The visible word list should update accordingly, and you can now download the new Game.agf file. Obviously, always back up your file before using the altered version.


(Note that you are just selecting files which are then loaded into your browser's memory. Nothing is actually uploaded to the server, let alone stored.)

eminigalaxy

I can't quite get this part to work but thanks so much for trying! The words don't update when I import the .txt file, and it doesn't show up in the game file.  :~(

Quote from: Khris on Mon 30/10/2023 20:59:593. The visible word list should update accordingly, and you can now download the new Game.agf file. Obviously, always back up your file before using the altered version.

I never rlly know what I'm doing but that's life. || WIP: Dilvemma

Khris

@eminigalaxy

Hmm, it works fine for me. Can you press F12 and switch to the Console tab, then try and import the text file? If there are errors, they should show up.

eminigalaxy



Okay so errors did pop up but I have no idea what any of this means haha.  ??? @Khris
(I tried to import the same file that was exported to see if that worked.)
I never rlly know what I'm doing but that's life. || WIP: Dilvemma

Khris

@eminigalaxy Can you PM me a link to your .ags file so I can test this?

Khris

@eminigalaxy
I'm not sure what the exact error was but it seems to be working now.

For anybody who is curious:
Spoiler
Code: js
// this causes nonNormal[1] to be undefined
const nonNormal = [...wordList].filter(was => was?.words[0].Type !== "Normal");

// this however works fine???
const nonNormal = wordList.filter(was => was?.words[0].Type !== "Normal");
[close]

Please try again.

eminigalaxy

@Khris

It works now thanks so much! You are a godsend.  :-D
I never rlly know what I'm doing but that's life. || WIP: Dilvemma

SMF spam blocked by CleanTalk