al e. said:
Gilfreezy said:
Thanks Aaron! Unfortunately, that's Greek to me... After saving the script to the campaign, how would I go about calling the function in-game?
λειτουργία (τρεις φορές ημερησίως) {
"χρησιμοποιήσει αυστηρή"?
Εκστρατεία (). Σετ ({
turnorder: JSON.stringify (
_.reject (
('' === Campaign.get («turnorder») []:?. JSON.parse (Campaign () να πάρει («turnorder»))),
λειτουργία (να) {
επιστρέψει to.id === τρεις φορές την ημέρα?
}
)
)
})?
}?
The scriptlet in Greek.
Well played! Haha!
The Aaron said:Ah, it's a function you could call from another script. You could do something like:
on('ready',function(){
"use strict";
var removeTokenTurn = function(tid) {
Campaign().set({
turnorder: JSON.stringify(
_.reject(
( '' === Campaign.get('turnorder') ? [] : JSON.parse(Campaign().get('turnorder')) ),
function(to) {
return to.id === tid;
}
)
)
});
};
on('chat:message',function(msg){
var args;
if (msg.type !== "api" || !playerIsGM(msg.playerid)) {
return;
}
args = msg.content.split(/\s+/);
switch(args.shift()) {
case '!noturn':
_.each(msg.selected,function(s){
removeTokenTurn(s._id);
});
break;
}
});
});
Then you could select tokens and issue:
!noturn
to remove each selected token from the turn order if it's in there.
Ahhhhh, I see! Sorry for the confusion, I should have clarified that I know jack-all about working with the API.
Unfortunately, the !noturn command didn't work, and fed this error to the API Output Console:
/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Object function () { return getObj("campaign", "root"); } has no method 'get' at removeTokenTurn (evalmachine.:1559:39) at evalmachine.:1579:21 at Array.forEach (native) at Function._.each._.forEach (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:78:11) at evalmachine.:1578:19 at eval (
This is even
more Greek to me!
And again, thank you for taking the time to tinker with this, Aaron! It's much appreciated!