-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Character Export (.json?) #233
Comments
There is a debug window that shows the character information in json. see the bottom of the screen for the little bug, along with the cloud with a down arrow in it, development download / pretty print of your orcbrew. In order for the export your character to work properly, make sure you are on the edit screen. |
@datdamnzotz thanks a lot for your quick reply. I could not see what you meant with
should I be able to download this data in a prettier format using that 'cloud' button? Can you tell me where to find it please, since I can't seem to see it? :\ thanks in advance |
The format being used for data storage on the site is EDN, which you should be able to learn more about on here. We usually refer to this format as 'orcbrew'. A member of our community has build these Go programs to make parsing between orcbrew and JSON, which you'll be able to find here EDIT : I'll add an image with the buttons that Zotz was talking about, which are used for "pretty-printing" content. |
@datdamnzotz In the meantime I managed to generate the .json from the EDN file using the program written by jnwhiteh, as linked above. Thanks a lot |
Are you using orcpub2 instead of https://dungeonmastersvault.com? |
About the second part of my last comment:
Am I out of luck or is there any way to achieve this? |
For what you are looking for doesn't exist. We do not have an export set up for other people's data structures. (Which is what you're secretly hoping for even if you didn't know it yet! 🤣) |
I understand. Thanks for all the help! I'm not really at ease with html/js but I'll take a look at the code and see if I come up with something; if I manage to do it in a not terribly awful way I'll consider opening a PR in case anyone else finds it a useful feature |
Reopening: Enhancing the site for JSON/XML output in known formats would be a potential "nice to have". |
Might also be a good thing to start having a proper look at. I'm not certain we already have a ticket open for that, nor steps setup for how to achieve it. It'd be tough, but we do have the ability to display the final data and print it down on PDF, I don't see why we couldn't export it as well, given some effort. Good starting point would be knowing which types of exports people'd like. |
So I peeked around the code a bit, and it seems to me the information I want is on src/cljc/orcpub/dnd/5e/character.cljc. I am not familiar with this extension (I will try to read-up a bit in the following days) but it seems like it has the character class definition with all final values. Is this right? If so I'll try to find a way to access it and expose it in .json format for instance (unless someone suggests something better of course :)). If anyone can give me some extra hints they will surely come in handy and be appreciated (let me know if this is not the appropriate channel for this discussion) |
It's clojure/script. Super busy atm, I'll try to get back to this tonight. |
The actual portion of the debug window runs here orcpub/src/cljs/orcpub/dnd/e5/views.cljs Lines 1050 to 1060 in 6ddabe9
It is subscribing to the current character loaded (via the edit window) probably could be re-worked to pull a character or other stats, just need to point it to the right edn objects... make-spec receives the built character object and makes the pdf's here: orcpub/src/cljc/orcpub/pdf_spec.cljc Lines 491 to 581 in ac75193
Probably could just reuse alot of what is going on there then toss it to the json processor. |
@codeGlaze @datdamnzotz thanks a lot for your inputs. I believe I know enough to get started now, once I read up a bit on clojure :P |
In case anyone stumbles across this in a search like I just did ... A partial solution/workaround that I have found is to use uswitch/ej to convert the EDN to JSON. This works well with some
Hopefully that's helpful to someone, and/or hopefully someone will tell me how to workaround that 3rd bullet point ... |
There is a native clojure converter already that works. Issue is just getting the right data that the export wants : ] |
I'm afraid I'm going to give up on this. I gave it a try but clojure is just too different from all the programming languages I know, and it's taking forever to understand what's going on and get anything done. I believe the information I want is stored on the built-char variable and so I only needed to export that as json, but I can't seem to progress any further. Hopefully someone with a better understanding of clojure / clojure script will come along and get this done :\ |
Well, sure, but:
Yeah, that. :-/ Currently what I'm doing is just leaving the files for classes et al in their native EDN format and editing them by hand (well, in
Of course, this doesn't work for everything:
As always, corrections and/or suggestions welcomed. |
Huh? DMV (OP project) is literally what gives the EDN files their structure. What weird things would it be doing? Importing via JSON seems kind of low-pri to me. But exporting to it could have its merits. @4sfaloth I skimmed, what template are you imagining targeting? |
@barefootcoder @codeGlaze I believe there is some confusion about what I was trying to achieve, and since @codeGlaze also requested it I'll try to explain myself a bit better. I have been working on a web app of my own which I use as a DM screen on a tablet. I now wanted to be able to import characters built on orcpub into it. Mind that I am talking about built characters, so the general orcpub export is not suitable for me. Please let me know if my explanation is still too confusing :\ |
Well, that comment was weighted more towards editing classes, races, backgrounds, etc., where there is already an import and an export. Although that doesn't really apply to characters, which is what the OP was originally discussing, I personally got here by searching for how to convert the EDN AFA "what weird things would it be doing," they come in two flavors:
(Getting back to characters now, which is the point of the OP's question.) Well, you can already export to JSON, sorta-kinda. The reason I think importing is important is because, again, it is possible to lose your work. Or suppose you lose your password and can't get back into your account. Or suppose you just accidentally hit a "delete" button somewhere. In those cases, the proper answer (as always), is that you should have a backup. Except, with DMV, that's problematic:
Having a way to import characters—whether JSON or even EDN—would solve those issues.
I was assuming you knew about the debugging button, but perhaps you don't? Bring up your character in DMV and scroll to the very bottom. In the bottom right, you should see two tiny, yellow icons. The upper one looks like a cloud with a downard-pointing arrow in it. The one underneath that is supposed to be a bug, I think ... it's so tiny it's hard to tell. If you hover over it, it says "Development – Debug info". Click that. It may seem to do nothing, but you should notice now that you can suddenly scroll down even further. There you'll find two panes with your built character info in JSON. The one on the right is pretty-printed, but I'm pretty sure they're identical otherwise. If you didn't know about that, give it a try and see if that helps solve your issue. If you did know about that, maybe you could explain why what's there is insufficient for your needs. |
Messing around with the possibilities of exports, I discovered this in the routes. HItting You can also access the character info from the local storage when hitting the view page. |
I know for sure there is a way to do that. I did that in order to import characters over from the original orcpub server back to here. I can't recall exactly how it worked but it was kinda "fishy"; I think you had to actually open the browser console and copy some stuff and then post them somewhere else. I'll see if I can find that reference for you
I knew about the button, but was unaware it displayed data for the built character. I thought it was just orcpub internals. I "exported" a .json character that way, it does look like it has many of the stuff I needed (namely hitpoints and final attributes), but I don't see many others like armor class or passive perception. Should all this data be visible from the debug windows? |
But that's the "internal format character", not the built one, right? |
You know what? I've never looked to see how much of the "calculated" info is in that JSON. Since I've only ever been using it as a backup for last-resort character re-creation, I never needed that sort of stuff before. Passive perception is trivial to calculate, of course, but armor class ... yeah, that's a PITA. Well, if the whole manual process is not too awful for you, why not add another step? :-) What I've switched over to is saving the PDF, extracting the field values from that, then twiddling them and creating a new PDF. For your purposes, you could stop once you get the values. While this is not sufficient for what you need (I think) on its own, perhaps in combination with the debug JSON, and perhaps a little creative scripting, you could manage to cobble something together? I personally am using Once you get the FDF, you can either find a product or programming library to read it for you (I'm using
You could probably even do that with a one-liner, certainly in Perl, or maybe even in Ruby or Python. The only bad part is that you just have to read the files for a while to know what the names are for things. And also that some of the larger boxes on the character sheet have been shuffled around, but nobody updated the code that touches the form fields, so you occasionally have weird stuff like |
https://www.dungeonmastersvault.com/dnd/5e/characters/17592188952026 |
@barefootcoder @4sfaloth what format you looking to export to? Just a simple dump? or roll20? or??? If anyone has the roll20 format @ me so I can incorporate it. Seems to be the defacto standard to shoot for. |
Sorry for taking some time to reply.
.json or .xml simple dump would be perfect for me, since I intend to write my own parser anyway. At any rate this would be most useful to me! Are you going to get that dump-mechanism merged into master? |
Still working on it ; ] |
@datdamnzotz I just used orcpub yesterday and it has this feature now! Not sure if you had anything to do with it but it seems to be working fine and to address my request. I'm closing this :) Thanks to whoever made this happen! |
My primary goal (which I believe is different than the OP's) is to be able to use a data dump to be able to recreate the character, in case of data loss. The ultimate embodiment of this would be for it to be paired with an import feature, so that both backing up and restoring are both just a click. But obviously that's a more pie-in-the-sky type of idea. In the meantime, just a way to capture all the decision points so that, by referring to the data dump, I can at least recreate the character manually. I just had an occasion to try out the new feature, and, while it captures the vast majority of the data (aside from spells, which you mentioned wasn't done yet), I did notice a few things missing (most notably race and subrace; perhaps because it's a custom race ... ?). But maybe I should start a separate issue for that. |
I believe it would be nice to have a character export feature in an easily readable format (eg: .json or .xml) so that people could import them in other apps and easily parse it.
Is there anything like that in the backlog?
Great work so far btw!
The text was updated successfully, but these errors were encountered: