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

Questions with getting Fetch Running

I'm trying to use Fetch to get the location and size of a selected token.  I created an ability on a character sheet with the following @(selected.height) @(selected.width) @(selected.top) @(selected.left) Doesn't seem to do anything but repeat the text.  I have the following API mods installed: SeletctManager, ChatSetAttr, VectorMath, MatrixMath, PathMath, RecursiveTable, TokenMod, Messenger, libInline, Fetch, MathOps, checkLightLevel, libTokenMarkers Any suggestions as to why Fetch isn't fetching?
Just a quick sanity check:  Do you have a Roll20 Pro subscription? And the Fetch Mod script is loaded in the game?
1678246395
GiGs
Pro
Sheet Author
API Scripter
In addition to Jarren's questions, this attribute names look suspect: @(selected.height) @(selected.width) @(selected.top) @(selected.left) If an attribute is called height , you would acess it with @{selected|height} - pope not period. On the other hand, if your attributes are catally called selected.height , I suggest changing the selected part - that's a recipe for confusion.
1678248397
timmaugh
Pro
API Scripter
Hey, Andrew... What you need is 1) to actually engage Fetch (you're missing one element), and 2) a way to see what Fetch has ... um... fetched. Engaging Fetch... Fetch (like all the metascripts) will only get involved in a message if that message starts out as intended for the Script Moderator (that is, a bangsy message, beginning with an exclamation point)... !@(selected.height) Seeing the Result... Of course, now that the message is intended for the Script Moderator, it never makes it to chat. That's fine if you use Fetch in another script's command line, for instance, setting a bar value on a token using TokenMod: !token-mod --set bar1|@(selected.height) Run that, and the bar1 value for the selected token will be set to the token's height. An easier way to see what Fetch has returned is to use ZeroFrame (since it organizes the metascripts anyway). If you start with a bang, you engage the metascripts; if you then include ZeroFrame's {&simple} tag, you flip that message back to one that will hit the chat output. So, with ZeroFrame installed, you could do this: !The token is at (@(selected.left),@(selected.top)){&simple} And since that really gets you the "center" of the token, if you wanted the upper left corner, you could use MathOps, too: !The token's top left corner is at ({&math @(selected.left) - (@(selected.width)/2)}, {&math @(selected.top) - (@(selected.height)/2)}){&simple} You could include the data in a report about the token: !&{template:default}{{name=@{selected|token_name} Report}}{{Top=@(selected.top)}}{{Left=@(selected.left)}}{{Height=@(selected.height)}}{{Width=@(selected.width)}}{{Top Left Corner Coords= ({&math @(selected.left) - (@(selected.width)/2)}, {&math @(selected.top) - (@(selected.height)/2)})}}{&simple} But, again, the true power of Fetch comes in that it can return this kind of data to the commands of other scripts. To GiGs point... if you use Roll20 constructions, you have to use the pipe separator and enclose the thing you're looking for in braces: @{selected|token_name} ...however, not all things are returnable using Roll20 formations. That's when you need Fetch, and Fetch will work with either the pipe separator or a period separator: @(selected|token_name) @(selected.token_name)
Ah yah, duh.  That was silly of me.  I was thinking that the period was a new construct that was specific to Fetch, and didn't think about engaging the API.  When you pointed me to this, it was in the context of using it with TokenMod ... When I load libInline (I think) or  checkLightLevel, one of those is telling me there's a conflict with an existing library, from the above list.  I'm not noticing any issues though.  Any idea which mod is conflicting? FYI, can Fetch return whether a status marker is present on a token?  And its count, if it has a number assigned to it by TokenMod? Thanks for taking the time to respond.  I bet that took some time.
1678250856
timmaugh
Pro
API Scripter
Andrew K. said: Thanks for taking the time to respond.  I bet that took some time. "Super easy. Barely an inconvenience." =D Regarding the conflict, can you share a screenshot of the actual error? One thing that could cause the  kind of error you are describing is if you have a second copy of the same script/library installed in the same game. Typically this might happen if you have a manually installed script, and then inadvertently double paste the code into the window. You end up with a second copy of the script/library in the same tab in your Mod Deck, so it looks like it is there only once, but you still get the error. As for Fetch returning the status marker information, yes it can. Check out this thread and scroll down in the message I've linked to until you come to the Token Status Properties  header. That section should have all the information you need to let you retrieve the information.
I got an error when I enabled checkLightLevel and one with Fetch.  After hitting OK, I didn't see the message again, and have not encountered any issues in game.
1678715402
Kraynic
Pro
Sheet Author
That is a standard warning that is just there to let you know you are installing things that can affect the same parts of the vtt.  Just because 2 scripts have some overlapping functionality doesn't necessarily mean that they conflict though.  It is basically there to make sure you are paying attention to what you install.