Closed robinmoussu closed 6 years ago
The code of diceparser is designed to be easy to import into a project. It is a black box. It takes a command (string) as input and it gives data structures as output. I implemented some clients of diceparser. Rolisteam is a diceparser client, and cli/main.cpp is another one.
Each client is in charge of its own aliases.
In the cli/main.cpp, I started (but not finished yet) to implement a way to load alias from json file.
In rolisteam, aliases are stored into the preferences manager and they are saved into init file (on linux as any preferences) (in the register database on windows).
To create import/export methods about aliases, I strongly recommend the use of JSON. Qt contains a really easy way to perform input/output operations. Moreover, it could be interesting to offer a way to save all the other game related data (such as Character states).
Moreover the JSON format it is really tolerant to changes.
Exported theme from rolisteam are saved into rSkin file which are JSON file. You can take a look about that as an example to implement the same thing about dice aliases.
Thanks for the precisions.
Hello,
[ I'm not sure where I should post this ]
I try to search both in the code and the documentation, and I didn't found how alias are exactly stored. I think currently they are hard-coded (at least the are two aliases for l5r in cli/main.cpp (l.206), but since it's possible to directly add new one inside from rolisteam, I guess that their are other input ways.
Do you plan to implement a way to give an external text file that as an input of diceparser as one point? That way it would be really easy to import/export/modify/share aliases for rolisteam. I don't use the other channels (like slack and twitter) so I don't know if a text file it's a good universal solution for all the uses cases of diceparser. If you think it could be a good idea I can implement it, I just would like to know what format you prefer. I think it would make the code cleaner by removing all hard-coded aliases.
Since you handle two syntax (regular expression and standard replace, maybe an ini style is the best:
Remarks: