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 .
×
May your rolls be merry + bright! 🎄
Create a free account

OnMyTurn Without Ping

Hi, I'm using Aaron's OnMyTurn API but I am using to it trigger a sound for player phase / enemy phase. I don't want it to ping the token its tied to as all players have the same turn. Unfortunately, I'm not very familiar with scripting and am not sure where to start to change this. If someone could tell me what I need to alter in order to achieve this result, that would be greatly appreciated.
1766591175
timmaugh
Forum Champion
API Scripter
Hey, KtBI... I don't see any function in the OnMyTurn script that should be causing that ping. I think what you might be seeing would be the normal Roll20 indications of "whose turn is it" as you advance the turn order...? Can you describe what you're trying to do a bit more, and what you mean by "all players have the same turn"? The OnMyTurn script is going to play the contents of the OnMyTurn ability on the character tied to the token who "comes up" in the Turn Order... so if all players (characters) have the same turn, then what would be entered in the Turn Order? What command would OnMyTurn be running? And what would it mean to advance to the "next turn" in the Turn Order (necessary to trigger the OnMyTurn script to fire)? Depending on what you need to do with the Turn Order and what you want to do within the OnMyTurn ability that would be fired by the OnMyTurn script, we might be able to suggest another approach.
Hey, timmaugh! I am setting up things for a Fire-Emblem-style game. Each player has a couple of units that they will have control over but, just like in Fire Emblem, all player controlled units act in the same player phase. In whatever order they prefer. I was using OnMyTurn to play the Player Phase and Enemy Phase sound effects. I created a character sheets called Player Phase / Enemy Phase and gave each of them the OnMyTurn ability. I did this instead of selecting one of the players' units so that none of the players unit's seemed like the "main character".  In the ability they each only have one command, to play the corresponding track when it's their turn in the turn order using Roll20AM. !roll20AM --audio,play|Player Phase SFX or !roll20AM --audio,play|Enemy Phase SFX I hid them in a lower layer so that they weren't visible to the players but at turn start the camera is dragged to where the token is as if it was pinged. When it is brought to the token layer it clearly does a camera drag ping to the token. I'd rather it not do this as it not only looks bad but it is a pretty jarring effect.  Thanks for taking the time to help btw!
1766607502
timmaugh
Forum Champion
API Scripter
Hmm... I have OnMyTurn installed, and I am not getting the ping effect when I advance the Turn Order. That makes me wonder... 1) what other scripts do you have installed? (You can screenshot your mod deck page, if you want, and just share that) 2) do you have a different version of OnMyTurn than what I do? My version of OMT looks the same as the page that  you linked to, so I feel like it might be other scripts you have installed (maybe something is reacting to the advancing of the Turn Order? Maybe TurnMarker?). If you share those, we can probably get to the bottom of it.
Below are the few scripts I have installed. My version of OnMyTurn is in the box below the screenshot. on('ready', () => { const resolver = (token,character) => (text) => { const attrRegExp = /@{(?:([^|}]*)|(?:(selected)|(target)(?:\|([^|}]*))?)\|([^|}]*))(?:\|(max|current))?}/gm; const attrResolver = (full, name, selected, target, label, name2, type) => { let simpleToken = JSON.parse(JSON.stringify(token)); let charName = character.get('name'); type = ['current','max'].includes(type) ? type : 'current'; const getAttr = (n, t) => ( findObjs({type: 'attribute', name:n, characterid: character.id})[0] || {get:()=>getAttrByName(character.id,n,t)} ).get(t); const getFromChar = (n,t) => { if('name'===n){ return charName; } return getAttr(n,t); }; const getProp = (n, t) => { switch(n){ case 'token_name': return simpleToken.name; case 'character_name': return charName; case 'bar1': case 'bar2': case 'bar3': return simpleToken[`${n}_${'max'===t ? 'max' : 'value'}`]; } return getFromChar(n,t); }; if(name){ return getFromChar(name,type); } return getProp(name2,type); }; return text.replace(attrRegExp, attrResolver); }; const checkOnMyTurn = (obj,prev) => { let to=JSON.parse(obj.get('turnorder')||'[]'); let toPrev=JSON.parse(prev.turnorder||'[]'); if(to.length && to[0].id!=='-1' && to[0].id !== (toPrev[0]||{}).id){ let token = getObj('graphic',to[0].id); if(token && token.get('represents')){ let character = getObj('character',token.get('represents')); let ability = findObjs({ name: 'OnMyTurn', characterid: character.id }, {caseinsensitive: true})[0]; if(ability){ let content = resolver(token,character)(ability.get('action')).replace(/\[\[\s+/g,'[['); try { sendChat(character.get('name'),content); } catch(e){ log(`OnMyTurn: ERROR PARSING: ${content}`); log(`OnMyTurn: ERROR: ${e}`); } } } } }; on( 'change:campaign:turnorder', (obj,prev)=>setTimeout(()=>checkOnMyTurn(Campaign(),prev),1000) ); on('chat:message', (msg) => { if('api'===msg.type && /^!eot\b/.test(msg.content)){ setTimeout(()=>checkOnMyTurn(Campaign(),{turnorder:JSON.stringify([{id:-1}])}),1000); } }); });
1766618709
timmaugh
Forum Champion
API Scripter
Nothing in any of those scripts should be causing this. Let me ask around the House to see if I'm not thinking of something obvious... but I might ask for you to invite me to your game (or a copy of it), then GM me so I can poke around.
Sorry, for the delay. I was busy with holiday obligations. I will send you a bare bones copy of the game.