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

[Question] Text Layer property...

1369299016
Konrad J.
Pro
API Scripter
I think this is a question for Riley, but anyone feel free to jump in and let me know what i'm doing wrong.   I've got a script that is manipulating a text object.  Works great.  But I want to change the text object's layer to be on the map layer so its out of the way of tokens.  I think I may have found a slight bug?  Here is some simple test code... on("change:text", function(obj, prev) {       log(obj.get("_id"));     obj.set("layer", "map");     log(obj.get("layer")); }); I've got a text object on the objects layer.  The first log shows the text objects id just fine.  The obj.set doesn't seem to do anything, text object stays on the objects layer.  The 2nd log also doesn't show anything in the log. Any ideas, is it something simple I'm missing or a small bug?
1369300252
Alex L.
Pro
Sheet Author
Konrad J. said: I think this is a question for Riley, but anyone feel free to jump in and let me know what i'm doing wrong.   I've got a script that is manipulating a text object.  Works great.  But I want to change the text object's layer to be on the map layer so its out of the way of tokens.  I think I may have found a slight bug?  Here is some simple test code... on("change:text", function(obj, prev) {       log(obj.get("_id"));     obj.set("layer", "map");     log(obj.get("layer")); }); I've got a text object on the objects layer.  The first log shows the text objects id just fine.  The obj.set doesn't seem to do anything, text object stays on the objects layer.  The 2nd log also doesn't show anything in the log. Any ideas, is it something simple I'm missing or a small bug? What happens if you try moving it to the GM layer?
1369325395
Konrad J.
Pro
API Scripter
Hmm..right now on a clean campaign the obj.set doesn't seem to do anything with a text objects layer and I'm getting this error when the   log(obj.get("layer")); happens. Error: Firebase.set failed: First argument contains undefined in property 'msg' at Error (<anonymous>) at Aa (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:49) at Aa (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:196) at za (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:468) at G.W.set (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:128:98) at log (
1369326957
Konrad J.
Pro
API Scripter
If I access the text object directly I don't get any errors, but not working still of course. on("change:text", function(obj, prev) {       log(obj.get("_id"));    obj.layer= "objects";     log(obj.layer); });
1369327887
Alex L.
Pro
Sheet Author
Konrad J. said: If I access the text object directly I don't get any errors, but not working still of course. on("change:text", function(obj, prev) {       log(obj.get("_id"));    obj.layer= "objects";     log(obj.layer); }); what do you get if you log(json.stringify(obj));
1369329763
Konrad J.
Pro
API Scripter
its saying json is not defined in the sandbox. Either I'm doing something stupid or I think the get and set routines for text layer were forgotten is all.  Sort of like the setInterval and setTimeout that Riley had to add to the API? I can change the text layer by right clicking in the UI. No problem, I don't need this right now, just wanted to ensure the text was out of the way always from the tokens.
1369332894
Alex L.
Pro
Sheet Author
Konrad J. said: its saying json is not defined in the sandbox. Either I'm doing something stupid or I think the get and set routines for text layer were forgotten is all.  Sort of like the setInterval and setTimeout that Riley had to add to the API? I can change the text layer by right clicking in the UI. No problem, I don't need this right now, just wanted to ensure the text was out of the way always from the tokens. sorry forgot you didnt know JSON should be caps.
1369333802
Konrad J.
Pro
API Scripter
Alex L. said: Konrad J. said: its saying json is not defined in the sandbox. Either I'm doing something stupid or I think the get and set routines for text layer were forgotten is all.  Sort of like the setInterval and setTimeout that Riley had to add to the API? I can change the text layer by right clicking in the UI. No problem, I don't need this right now, just wanted to ensure the text was out of the way always from the tokens. sorry forgot you didnt know JSON should be caps. Doh, I just copied your text. :)  I should have used that for troubleshooting.  Good way to inspect the object. Guess what.  Layer is missing in the text object. :)  It should be between font_family and controlledby "{\"top\":105,\"left\":665,\"width\":70,\"height\":70,\"text\":\"test\\n \",\"font_size\":14,\"rotation\":0,\"color\":\"#000000\",\"font_family\":\"Arial\",\"controlledby\":\"-Iuq-_4X-fnXiBvlbUQd\",\"_id\":\"-IvFYbOs732lKoeoA7YI\",\"_pageid\":\"7F73B956-71C3-4C5B-8C72-576EE4F15EA4\",\"_type\":\"text\"}"
This was an error on my end of things. See if it works now (the party where changing the layer wasn't working, not the JSON.stringify part).
1369333954
Alex L.
Pro
Sheet Author
Riley D. said: This was an error on my end of things. See if it works now (the party where changing the layer wasn't working, not the JSON.stringify part). Missed the layer out of the object I would guess :P
1369334547
Konrad J.
Pro
API Scripter
Riley D. said: This was an error on my end of things. See if it works now (the party where changing the layer wasn't working, not the JSON.stringify part). Awesome Riley, that did it.  I seem to find these little obscure things :)  I also was using "gm" instead of "gmlayer" so it blew it up, but that was fixed easily!  Now I can get back to my movement script.  Works fairly nicely actually.  Even have it showing where you were last.  Will be working on waypoints next.  And an aura that shows you how much more you can move. The way I'm doing the text info box now can also be used for general info you want to pop up to the user and then have it disappear (simply off the map (-280,-280)).   Thanks again.