
So I've been working on this for the past several hours and I'm a bit stymied. I'm having difficulty changing a value after I create it with the API. If I manually create the attribute (going to the Attribute & Abilities tab and selecting +Add) I'm able to change the value just fine using the API, but if I create the attribute with the API then when I try and alter the value I get an error. Below is a sample piece of code. on("ready", function(){
on("add:character", function(obj) {
var attribute = findObjs({
_type: "attribute",
_characterid: obj.id,
_name: "test"
})[0];
if (attribute == undefined) {
createObj("attribute", {
name: "test",
current: "1 2 3",
characterid: obj.id
});
};
//It all works fine up to this point.
var attribute = findObjs({
_type: "attribute",
_characterid: obj.id,
_name: "test"
})[0];
log(attribute);
//We are still good at this point.
//Log is showing a single attribute.
attribute.set("current","A B C");
//And here is where we fail.
//We can use this same set of commands
//on a manually create attribute and
//it will work fine, but it fails when
//the attribute is created through the API
});
}); So does anyone have any insight into what I am doing wrong? When the attribute.set command is enabled I get the cryptic message: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1orts, require, module, __filename, __dirname) { function f(a){throw a;}var j=v However if I have manually created the "test" attribute that same code will have no problem. Any insight would be much appreciated.