
Ok, so I have the following set up to assign attributes to a new token automatically.
on("add:character", function(obj) {
The problem is, when ever a new sandbox spins up, it adds the attribute again. Making redundant copies. I don't want this, obviously. My solution thus far has been to disable the script. However, I want to add more tokens and characters now, and it keeps adding to those that already exist.
I've tried this,
on("add:character", function(obj) {
But this doesn't work. What do I need to do to simply check if the attribute already exists? obj.get() returns the value, so I checked it against FALSE 0, rather than "0" obviously. Would this work?
The error I get is:
ReferenceError: Invalid left-hand side in assignment at evalmachine.:3:5 at eval (
This makes me think it's a syntax error. I'm not familiar with JavaScript, I use LUA, and Perl.
on("add:character", function(obj) {
createObj("attribute", {
name: "Strength",
current: 10,
characterid: obj.id
});
});The problem is, when ever a new sandbox spins up, it adds the attribute again. Making redundant copies. I don't want this, obviously. My solution thus far has been to disable the script. However, I want to add more tokens and characters now, and it keeps adding to those that already exist.
I've tried this,
on("add:character", function(obj) {
if (obj.get("Strength") === 0){
createObj("attribute", {
name: "Strength",
current: 10,
characterid: obj.id
});
};
});But this doesn't work. What do I need to do to simply check if the attribute already exists? obj.get() returns the value, so I checked it against FALSE 0, rather than "0" obviously. Would this work?
The error I get is:
ReferenceError: Invalid left-hand side in assignment at evalmachine.:3:5 at eval (
This makes me think it's a syntax error. I'm not familiar with JavaScript, I use LUA, and Perl.