Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

Adding more than 10 token actions causes their display to be mis-ordered.

I've added API to create the effect. The same effect can be achieved by adding abilities manually. Once your open the character sheet to re-order them, this causes them to re order correctly which tells me it's something to do with initial ordering while adding. That's because when you shift them in the sheet, the update causes them to order properly. function doThings(token) { var funcFixNewObject = function(obj) { var p = obj.changed._fbpath; var new_p = p.replace(/([^\/]*\/){4}/, "/"); obj.fbpath = new_p; return obj; }; var charSheet = null, charId = null; var items = ["1","2","3","4","5","6","7","8","9","10","11"]; var name = "Some-name"; charSheet = createObj("character", { avatar: token.get("imgsrc"), name: name, gmnotes: "", archived: false, inplayerjournals: "", controlledby: "" }); charSheet = funcFixNewObject(charSheet); if (!charSheet) { log("ERROR: could not create character sheet"); return; } charId = charSheet.get('_id'); token.set("represents",charId); for (var item in items) { createObj("ability", { name: items[item], description: '', action: "! \nMarco text for " + items[item] + "!", istokenaction: true, characterid: charId }); } sendChat('API',"done, check token actions for " + name); } on("chat:message", function (msg) { var cmdName = "!ability_bug"; var msgTxt = msg.content; // make the API shut up about avatar images even if none is provided... if (msg.type == "api") { if (msg.content.indexOf(cmdName) != -1) { if (!(msg.selected && msg.selected.length > 0)) { sendChat('API',"no token selected for demonstration"); return; } var token = getObj('graphic', msg.selected[0]._id); doThings(token); } } });
1422657907
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Ken, there is no guarantee of token actions being in any particular order. It's not functionality we currently support. This is in the realm of a feature request like sortable/draggable macro bar buttons that got implimented.