You need commas at the end of lines 44, 61, and 79
You need to replace the semicolon at the end of line 74 with a comma, and replace the period at the end of line 76 with a comma
Those are the only syntax issues. Once you fix those, you should be able to import without issue. There are a few formatting issues, but that's aesthetic.
I would recommend using Visual Studio Code as your script writing/editing software. It will point out syntax errors as you write. I was able to spot the issues with the code immediately with this program.
If vscode isn't helping, try jshint.com.
Here is the cleaned up code. You had a missing "," or two, and the syntax for your ternary operation was bad, which I corrected.
You also had a few "eval" and "removeeval" that were unnecessary, which I removed.
I haven't tested it on a sheet, but the syntax is now 100% valid.
JSHint is an excellent JavaScript linter that I recommend that everyone use.
You have opened two arrays in source
, but only closed one. Source only needs to take one array, so you should delete the second [
.
Additionally the object needs to be terminated with a ;
, not a ,
.
You should look at some basic JavaScript Object articles before proceeding, however, otherwise you may make further mistakes.
Sorry, I wrote that on my phone and didn't have the time to go over the whole code. You can also put your code though a linter (like JShint.com), as it will tell you about all the lines that have a syntax error. You also need to make the following changes:
SourceList["mndfly"] = {
source : ["mndfly", 0],
} }
(yes, you are missing two closing curly brackets there)Or you can remove the whole SourceList
entry and leave line 31, 68, and 81 as they are now. This is because the source "HB" already exists as "Homebrew" and you shouldn't overwrite it. You can make a new SourceList
entry, but to do that you can only have a string in the square brackets, and no comma or number.
Lastly, to make the weapon entry work, you will need to change its name to something else than "Flayer" so that it matches the regExpSearch
that you gave it (or the other way around, change the regExpSearch to match the name). Note that a weapon can't have a sortname
, so you can delete that entry.
Ok, so I am using JSHint.com (thank you great resource there), it is helping me understand the scripting a little easier.
I am using some other sites as well to help me.
So I have cut down the script a great deal, there was subclasses I had just copied in and such that were not needed, so that has all been removed reducing the total code by a lot.. That leads to some Good news, and some bad"?" news?
Now when I copy the script to the sheet it accepts it, I am able to see it when I open the library of scripts to add, and I am able to add and remove it as needed. Here is where it gets weird..
When it is added to the sheet I no longer have the ability to open the "Set Character Class", when I click on it nothing happens. When I remove the script from the library it works fine.
I was looking at the scripts you wrote but the only thing I am finding are subclasses and this is a new class (at least how its written), so I was hoping to look at how the Basic fighter class is written as this class has no spell abilities, I figure that might be the closest (or possibly a rogue)..
I will also do up a new github post a little later.. One of my table mates who uses the sheets as well and has written his own code has been able to get the subclass to appear without issue on a 12.99 sheet but both of us tried and were unsuccessful at getting it to load on the 13.19 sheets (it doesnt show up in the available cleric subclasses). I will see if I can figure that out but if there is a specific script I should review first it would be appreciated to be pushed that direction? I am more than happy to spend the time learning and reading and reviewing code :D there is just a lot of it to look at and sometimes I really dont know if I am looking at the right stuff or not :D
Thanks again for your help and everyone else who offers help here and else where.. to those of us learning, its awesome so thank you from me!!!
The kind of imports that the Fifth Edition Character Sheet app on Android accepts is most likely not compatible with the imports made for MPMB's Character Record Sheets. I have no idea what kind of import the Android app requires, nor can I find any API or syntax explanation with a quick Google search. Transcribing one over to the other format is probably possible, but most likely not easy and could be rather time-consuming.
Without more info on how the Android app does its thing, I can't really say more. You are probably better off asking somebody who is more familiar with that app.
Are you sure you are posting this in the right sub? This subreddit is for MPMB's Character Record Sheet, which is a PDF and not an app. There is a popular app called "Fifth Edition Character Sheet" for android, might it be that you are asking about that?
Note that MPMB's Character Record Sheet doesn't use JSON files (.json) but JavaScript files (.js). The "Fifth Edition Character Sheet" app for android does use JSON files, hence my suspicion that you are looking in the wrong place.
Anyway, for adding any of the Plane Shift article's content to MPMB's Character Record Sheet, look in the top sticky post.