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

The One Ring API issues with stance scripts

My friends and I started out with our game being the Cubicle7 conversion of TOR to a D&D 5e setting, well now we're wanting to try out the original system. A fellow by the name of Michael Heilemann had a whole process called  Taming the One Ring  that helps with setting up macros and scripts for the game. I have the dice for the sheet working, but I can't get his scripts for changing battle stances on the battle map. Everytime I move a token the script says there's a lot of errors, and I am not very good at scripts, I am just copy-pasting as his guide recommends.  For Reference this is the message I get:  I'm not sure what I am doing wrong and any help would be appreciated.
1559249081
The Aaron
Roll20 Production Team
API Scripter
Can you link to the script? 
The link provided to Taming the One Ring should have it, but the specific one, I think, is  This one on TOR stances . Baring that it could also be  tor stance turn order
1559251642
The Aaron
Roll20 Production Team
API Scripter
Ah, thanks, I somehow missed that link. =D. I'll try to take a peek tonight, it should be a pretty straightforward error. 
I appreciate it my dude. The GM for the game has entrusted me in getting the api set up, and frankly, I'm not very good at it. The link tells a lot of what needs to be done so i've tried my best. now I'm transcribing all the macros he's made into the game x-x
1559265283
The Aaron
Roll20 Production Team
API Scripter
It's actually in the tor-stance.js: /* The One Ring Stance Regions for Roll20. By Michael Heilemann (<a href="mailto:michael.heilemann@me.com" rel="nofollow">michael.heilemann@me.com</a>) In running battles with The One Ring in Roll20, it's a very useful way to have players (and GM characters) set their Stance, simply by dropping their token on the right area of a Battle Mat. # How to Install It 1) Insert the Voidstate's Battle Mat (Google it) and make it 750px wide (and appropriately tall), with its top left corner at the top left. 2) Name the page it's on 'Battle'. # How To Use 1) Make sure your characters have a `stance` (lowercase) attribute. If you're using the characters sheet I made for Roll20 (it's in the dropdown), it should already be available on the characters. 2) Drop a character's tokens onto the battlemat, and their stance should update automatically. 3) Fight the shadow. # Further Use - Now that characters have the stance attribute in place, and it's automatically set by dragging the token, you can use it in macros like this (as an example): /r 1t[feat] + @{weapon_rating_1}t[@{weary}] + ?{Circumstantial Modifier|0} &gt; [[@{stance} + @{target|parry}]] - If you also use tor-dice-checker.js, with that Target Number in there, it'll tell you whether it was a success or not, and if so how much. Now that's Elven Magic. # More Information For more of my The One Ring shenanigans: <a href="https://ringen.squarespace.com/loremasters-journal/" rel="nofollow">https://ringen.squarespace.com/loremasters-journal/</a> */ on("change:graphic:top", function(obj) { updateStanceOnDrop(obj); }); var updateStanceOnDrop = function (obj) { var page = findObjs({ _type: 'page', _id: obj.get('_pageid'), })[0]; if (!obj.get('represents').length || page.get('name') !== 'Battle') { return; } var left = parseInt(obj.get('left'), 10); var top = parseInt(obj.get('top'), 10); var forwardTop = 0; var openTop = 290; var defensiveTop = 520; var rearwardTop = 760; // outside the mat. if (left &gt; 730 || top &gt; 1010) { return; } // forward if (top &lt; openTop) { setStanceOnTokensCharacter(obj, 6); // open } else if (top &gt;= openTop &amp;&amp; top &lt; defensiveTop) { setStanceOnTokensCharacter(obj, 9); // defensive } else if (top &gt;= defensiveTop &amp;&amp; top &lt; rearwardTop) { setStanceOnTokensCharacter(obj, 12); // rearward } else if (top &gt;= rearwardTop) { setStanceOnTokensCharacter(obj, 12); } }; var setStanceOnTokensCharacter = function (token, newStance) { var characterid = token.get('represents'); var stance = findObjs({ _characterid: characterid, _type: 'attribute', name: 'stance' })[0]; if(stance){ stance.set('current', newStance.toString()); sortTurnorder(); } // sendChat('character|'+characterid, '/w gm !sortturnorder'); }; That should work.
1559285422

Edited 1559285888
Really? I just thought it was describing what it was suppose to do, I'll give it a go though. Thank you my friend. I just tried to run it and the same error screen pops up. I wonder what im doing wrong. Maybe because the tokens and character sheet stats aren't fully set up yet? We are trying to convert the characters to TOR from D&amp;D after all. Just to be safe, I'll post the new error messege to see if anything else has changed.
1559304039
The Aaron
Roll20 Production Team
API Scripter
hmm.. that should prevent it from crashing at that point.&nbsp; These scripts all seem to depend on certain attributes existing on characters.&nbsp; The root problem is that the token being moved does not have a "stance" attribute, which should be created by the character sheet.&nbsp; Try opening the character you're manipulating and verify it has the stance attribute.
1559304075
The Aaron
Roll20 Production Team
API Scripter
Just to check, you did install the corrected version of the script I posted, right?&nbsp; And you don't have a second copy of it installed with the old code?
1559318297

Edited 1559318848
Nope, I replaced it with the script here, no other copy that I can see, there's one for turn order but that's a different script in it of itself. I made sure to give the TOR sheets a stance attribute, as the webpage suggested, as I said I feel there may be an issue with it because there's two sheets right now contesting for it, one being the current TOR sheets and the D&amp;D 5e converted sheets. I'll try and add stances to those as well. Yup, it was the D&amp;D 5e sheets that the game was reading before the TOR sheets, once we get the characters transfered over, I'm going to delete them and see if the problem persists.
Ok, well we got the stance script mostly working, I'm not seemingly getting the NPC's and adversaries to work on the stance chart, and i can't get the script for pc vs. npc defense to properly operate either.&nbsp; This is what pops up, no message shows the actual results of the combat.&nbsp; For assistance this is what the macro for an attack usually looks like:&nbsp; /r 1t[feat] + @{selected|weapon_rating_1}t[@{selected|weary}] + ?{Modifier|0} &gt; #pc_vs_npc_defense and this is the macro for the defense: [[@{target|stance} + @{target|parry} + @{target|shield} + @{target|head-gear}]]
1560142814

Edited 1560142871
Michael I.
Pro
Sheet Author
Looks like you are using my macros, and hopefully my updated script. Have you got this working now if not how can I help Aragent