Parsing issue with multiple attributes


#1

I’m currently trying to add some attributes to some of my entities, and it worked fine with the first time. However, when I added a second attribute to it, when I hit the parse button in the editor, it turned red and didn’t update. I decided to comment out the second attribute to double-check that was where the issue was (there wasn’t any error from the compiler), but it stayed red, but also the first attribute still worked fine. My question is basically what does the red parsing button mean? Obviously it doesn’t work but I don’t know how to fix it without further details. Here is the top of the code and a screenshot of the red parse button.


ObjectOnground.attributes.add(‘weaponType’, {type : ‘string’, title : ‘Type’, default : ‘Unknown’});
ObjectOnground.attributes.add(‘active’, {type : ‘string’, title : ‘Active’, default : ‘false’});

if (ObjectOnground.attributes.has(‘weaponType’))
{
this.weaponType = ObjectOnground.attributes.get(‘weaponType’);
}
if (ObjectOnground.attributes.has(‘active’))
{
this.active = ObjectOnground.attributes.get(‘active’);
}

2018-12-28

Any help is appreciated.


#2

Can you post a link to the project please? If there is a script error, then the parsing will fail.


#3

I was able to fix it. I merely put the if statements into the initialize method. Not sure why I put them outside of it in the first place.