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

New to API: help required... please

1417914425

Edited 1417943353
Ziechael
Forum Champion
Sheet Author
API Scripter
Hi all, first off thanks for all the hard work those who speak java-ese have put into making awesome labour saving and campaign enhancing scripts. I'm relatively new to the site but already have upgraded my membership in order to try and build a campaign of epic proportions for my group of old D&Dites. After reading practically everything and trying out a fair few things to boot i'm still having problems with a couple of scripts not working right, most certainly user error rather than coder error and i truly apologise if i'm missing something obvious, i promise i have scoured the forums for my solution, read every post in the scripts thread and tried and tested a few logical ways to fix my problem. However, no joy for me and so i appeal to those out there who use these scripts happily on a daily basis to take a few minutes to condescendingly put me on the right path... feel free to patronise me too if you like, as long as it makes things work ;) Currently i'm having issues with the following: Cone and Circle Templates - Works great but for the life of me i can't figure out how to define the angle for the cones, its either straight up or approx 135 degrees when using !cone angle 15etc. I've tried a few things to define the angle but nothing yields a result. Bet it's obvious but please help! Movement Tracker and Aura Highlighter - this one i simply can't get to work at all, i've inputted my DM name (exactly as seen in the chat window, is that right?) and created my pins according to the specifications but nothing i do seems to generate the auras or movement tracking that i so desperately want to see :( Auto Initiative - again assuming complete newbie user error but i simply can't seem to generate rolls that take into account the initiative bonus of the selected tokens. All are tied to character sheets containing a totalised initiative bonus (i'm using the 3.5 D&D character sheet from the campaign options menu for reference). I 'think' its to do with statName but i've tried all permutations i can think of that relate to the total bonus. But no matter what i get no rolls above 20 and regularly gets rolls under the minimum that should be available for a character with +3 to their roll? (ie. 1-3 when 4 should be the min). In all cases i've made sure to get the latest gist rather than the previewed one and have tried literally everything i can think of with my limited knowledge. For reference i am also running the Initiative Highlighter script. Thanks in advance for ANY help at all.
1417933331
The Aaron
Roll20 Production Team
API Scripter
Hi Ziechael, I think those are some pretty old API scripts, probably from the stickied thread. I think I used the Movement tracker at some point, and it required you to have a particular image on the page with a particular name. It might help people to assist you if you put a link in to each of the scripts you're using. I'll check back tomorrow and see what I can do to help. =D
1417943444
Ziechael
Forum Champion
Sheet Author
API Scripter
Thanks for the reply, they are from the sticky yes, i picked them as they looked simple enough for even me to get working ;) Typical! Editted the OP with links as requested.
1418039788
Ziechael
Forum Champion
Sheet Author
API Scripter
Also, if anyone could recommend any 'newer' scripts compatible with D&D 3.5 that would do what these do but better i'd be very grateful. Just started playing around with dynamic lighting too... man i love this site!
Hey ziechael, For the auto initiative, I noticed the same problem when character sheets were introduced. The issue is that the old API can't find attributes that are given by the character sheet. I did a quick fix in my script to hard code in the exact attributes I use. You might be able to get it working by manually adding attributes of the correct name to the characters, instead of using the character sheet for those.
1418055383
The Aaron
Roll20 Production Team
API Scripter
So, I'm a bit biased and will suggest the one's I've written. But realistically, anything that helps your game is good. I have a TurnMarker script that highlights the current player, with quite a few options regarding notification. I don't know what Auto initiative does, but I have a GroupInitiative script.
1418057333

Edited 1418059588
Ziechael
Forum Champion
Sheet Author
API Scripter
Mark - thanks. I did dabble a bit with adding attributes manually but i'm such a newbie that i got scared and asked for help instead... will take a look again now i'm a bit braver ;) Aaron - Sorry THE Aaron... sir... i've seen your many contributions, posts, helpful hints and scripts and frankly am in awe. The only reason i haven't used your scripts yet is i felt they were more advanced than i could cope with right now lol. However, i am getting more confident with my campaign so i think i'll take a look at your turnmaker and groupinitiative scripts tonight, are they 3.5 character sheet compatible? Really appreciate the patience of the help on this site, makes it easy on us idiots new users! For reference, i've fixed my cones and circles problem.. sort of. I realised that i could just use the straight one to generate the 'cone' then rotate the image and move to represent the angle... probably what was intended all along. Still can't hardcode the initiative modifiers though, tried created a 'init' attribute and assigned it a @{init} to try and pull it through from the character sheet or is that wrong/harking back to the original issue and i should just put the 3 or whatever and manually update should that change in the future? Thanks guys.
1418064955
The Aaron
Roll20 Production Team
API Scripter
hahahah.. Just Aaron is fine. I really only added the The so I could find the chat threads I last commented on. =D I try to make them as user friendly as possible, but it's hard to balance against my own personal slogan: "There is a simplicity to be had only on the other side of complexity." =D
1418131387
Ziechael
Forum Champion
Sheet Author
API Scripter
An update on this, i've contacted the author of the movement tracker directly for help on his as i think you are right and i need to place the markers somewhere to be accessed by the script, currently they are just sat in my campaigns graphics folder. Hopefully he'll get back to me with detailed instructions. I took a look at your turn marker and it looks great so i'm going to use that, is there a way of getting the aura pulse to be set by the token existing aura so i could set their aura 2 to reflect their speed and the pulse would show their movement range?
1418131973

Edited 1418132293
Ziechael
Forum Champion
Sheet Author
API Scripter
Hi Aaron, i got this error ReferenceError: results is not defined at GetCharSpeed (evalmachine.:696:9) at evalmachine.:249:17 at eval ( ^i'm assuming it related to a token that has not got their 'speed' set yet? After playing with your script a bit i'm loving the functions it has, snap back on movement is awesome, is there a way to track distance moved in a turn? Also, is there a way to turn it off/on at will at all for general non-combat exploring? i tend to not restrict my players too much until a beastie is present.
1418133567
The Aaron
Roll20 Production Team
API Scripter
I don't think I have a GetCharSpeed() function, but I'll check. There isn't an accumulator built into the script, but that's an inretesting idea. You can select a token and hit space to see the path it most recently took. I like the idea about the auras. I originally added the aura pulsing to make it easier for my blind player to find his token. It it is off when the turn order is hidden. You could also have a token on the edge of the map with a turn that you could pause on while they explore if you still want to have the turn order up. If that isn't sufficent, I can see about adding an off state. :)
1418135648
Ziechael
Forum Champion
Sheet Author
API Scripter
That's the main beauty of this site and the API in general, a few lines of code and you get something completely different to the first release, i actually love seeing how these things grow by reading through the threads for the scripts :) And i have to admit to being a little bit pleased to hear you like my ideas even if i end up leaving the hard work to you ;) In terms of an accumulator it would be as simple as a chat message saying x has x movement left this turn based on the map settings and their speed setting or to make it potentially easier (or harder as my knowledge of coding is so poor as to be very untrustworthy) it could be set so that the snapback on movement prevented them moving beyond their speed or something? When the marker is 'off' (ie. tracker closed) does it effectively stop the snapback as well so that people can move without restriction? Sorry, i could test this but i'm at work and having to pretend i'm not playing games ;)
1418141433
The Aaron
Roll20 Production Team
API Scripter
When the Turn Order is hidden, the Turn Marker disc is moved the the GM layer at the upper left corner. It shouldn't be visible to players and won't follow the token whose turn it is about. Does that answer your question? Probably would be better to just print the distance moved rather than try to restrict. It can't be accurate unless they drop waypoints though because they may be counting squares in a Z shape move around obstacles but the apparent movement is just a straight line from source to destination. Short of writing A* or Dijkstra's algorithm, it would be hard to get a precise figure (and that would require encoding some deep knowledge of the terrain somehow, not to mention special rules for restrictions imposed by tokens in the path, and inferring walk/hustle/run type actions). GetCharSpeed() appears to be part of Movement Tracker. One thing that is counter-intuitive to new users of the API is that all of the scripts are concatenated together to execute. When an error occurs, it could be in any of the scripts and the line number can't be trusted (because you don't know the order of concatenation and it isn't adjusted for said).
1418151136
Ziechael
Forum Champion
Sheet Author
API Scripter
Ah i see, well that is something i can easily solve by disabling it and keeping yours running instead. I think if yours could 'chat' the moved distance even if just as they do it they can move in a z by physically moving in the desired places and just add the distance up (5' + 7.5' + 5' means they would still have 12.5' to move) takes some mental arithmetic and honest on the players part but nothing too harsh for the diagonal calculations it could save?
1418153031
The Aaron
Roll20 Production Team
API Scripter
So, when dragging a token, you can hit space to get the distance measurement. You can hit space again to drop waypoints. Highlighting a token and hitting space will show you it's last path and distance (based on the page configuration). That might give you the details you want? Waypoints: <a href="https://wiki.roll20.net/Manipulating_Graphics" rel="nofollow">https://wiki.roll20.net/Manipulating_Graphics</a>
1418164463
Ziechael
Forum Champion
Sheet Author
API Scripter
And i thought i'd read everything there was to read! That is exactly what i wanted and a simply inspired feature. Consider me sated. While i'm sure i'll find some more scripts i can ab use in the future i think i've got everything i need now to really get my campaign off the ground... just a few power cards to develop and lots of macros to write but thats the life of a GM right? Thanks for all your help, its really been literally game changing!
1418166449
The Aaron
Roll20 Production Team
API Scripter
Yup! You might like my Torch script. It's probably one of my more popular ones. =D TokenNameNumber automatically numbers mooks, which might also be useful.
1418168866
Gen Kitty
Forum Champion
The Aaron said: Probably would be better to just print the distance moved rather than try to restrict. It can't be accurate unless they drop waypoints though because they may be counting squares in a Z shape move around obstacles but the apparent movement is just a straight line from source to destination. Short of writing A* or Dijkstra's algorithm, it would be hard to get a precise figure (and that would require encoding some deep knowledge of the terrain somehow, not to mention special rules for restrictions imposed by tokens in the path, and inferring walk/hustle/run type actions). On top of that, you can have special rules about movement. Someone may be stealthing at 1/2 or 3/4 speed. Someone could be flying. Someone could be able to ignore the cost of difficult terrain. Someone (in 4e) could be using a power that allows for movement of speed + $SomeNumber. It's far better to attempt to report than to attempt to restrict. GMs can be reasoned with, scripts don't care :&gt;
1418169637
Ziechael
Forum Champion
Sheet Author
API Scripter
Thats very true, i guess it is easy to get carried away with the limitless possibilities without realising that the human brain is capable of so much more than simple java script ;) I'm happy to have to do 'some' things myself, besides, too much automation and i may as well just build my campaign on NWN online servers... Aaron, I'll check out the torch and tokennamenumber, they both sound like something i'd be interested in, thanks :)