Bug? setDrawOrder / setTokenDrawOrder

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Bug? setDrawOrder / setTokenDrawOrder

Post by wolph42 »

both the calls:

Code: Select all

[setDrawOrder(100)]
and
[setTokenDrawOrder(100)] 
return an invalid expression. The wiki Wiki: setDrawOrder() is inconsistent in the naming (as we all know by now, it can't currently be changed). So I tried them both, but both gave the same result.
Tried both impersonated in the chat and in a macro (with apply to sel. tokens checked).

edit: setTokenDrawOrder seems to work if you also give the token id. So its either still a bug or the wiki needs an update.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by aliasmask »

That's probably a carry over when all the protected functions forced you to put the id. *scratch that* I just tested an old map where I set the draw order and it has stopped working in b86, but still works in b84. I use the function in the onTokenMove macro.

edit: Okay, I went back to test b86 and it IS working. I'm not sure what happened the first time.
||| onTokenMove |||

Code: Select all

[H: x = round(getTokenX()/50)*50]
[H: isOdd = band(round(x/50),1)]
[H: sizeNames = json.append("","Fine", "Diminutive", "Tiny", "Small", "Medium", "Large", "Huge", "Gargantuan","","Colossal")]
[H: offset = 25 * min(7,max(0,json.indexOf(sizeNames,getSize())-4))]
[H, if(isOdd): y = round((getTokenY()-25-offset)/100)*100+25+offset; y = round((getTokenY()+25-offset)/100)*100-25+offset]
[H: moveToken(x,y)]
[H: setTokenDrawOrder((y + 1000)*1000+x+1000)]
[H: exposeFOW()] 
Attachments
Image2.jpg
Image2.jpg (52.03 KiB) Viewed 1673 times

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by wolph42 »

it *is* working for you?? I've tested this thoroughly on a clean map, but without the id I couldn't get it to work ?!? Tested both in b82 and b86, same problem in both.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by CoveredInFish »

wolph42 wrote:or the wiki needs an update.
Lets hope its a bug. ^^


User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by aliasmask »

wolph42 wrote:it *is* working for you?? I've tested this thoroughly on a clean map, but without the id I couldn't get it to work ?!? Tested both in b82 and b86, same problem in both.
Ah, I see what I did before. I'm using a gridless map, but one token has snap to grid on (centering the footprint) and the other didn't (putting footprint in upper left). Now they're the same and everything works as expected.

I saved the campaign in b86.

edit: Questions for you. Are both tokens on the same layer? the same size? what is your formula to calc draw order?
Attachments
isometric test.cmpgn
(357.81 KiB) Downloaded 71 times

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by wolph42 »

If you look at the op you'll see that it's very basic just set the order to 100 for a token. Tried it on the token layer and on the background layer.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by wolph42 »

ok weird, now it works? I downloaded you isometric map which worked. Then I run the campaign whith the 'problem' and its gone, no problem anymore, im stupified

edit: funny by the way, I came accross this problem because of the new map of Recklessenthousiasm, which is isometric and he uses my new 'foliage' function from the back of tricks, to show or remove pillars as you walk along them. that map however is isometric. Funny coincidence.
Anyway I've send him a mail as he might be interested in your project...

User avatar
RecklessEnthusiasm
Cave Troll
Posts: 61
Joined: Sat Jun 12, 2010 2:45 am
Location: Ventura, CA
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by RecklessEnthusiasm »

Hey! Cool thread! I checked out your .cmpgn file, aliasmask! Neat to see other people fiddling with isometric stuff.

Sadly, I don't think the isometric option will be fully realized until we can edit the dimensions/orientation of the square grid (I noticed we can with the octagon grid, making it wider than it is tall, but not square). What we CAN do is obliqueperspective like you have here (equilateral diamonds) but terrain and buildings in this perspective always look pretty crazy producing a very 'super nintendo' looks to the terrains.

Of course, you can always turn off snap to grid too for actual isometric, I guess, but then you need to paint the grid on to the map (I see you've gone this route too.) and laying out the terrain requires a lot more care.

Anywho, Wolph42 is right (thanks for showing me the thread)-I have been using his 'foliage' macros as a slight workaround, rather than trying to figure out how to manage layering when it comes to the terrain. It is definitely not perfect (and probably not actually usable for a game) but it looks cool, I guess! Here are some screenshots.
ruins.jpg
ruins.jpg (498.33 KiB) Viewed 1657 times
transparent pillars.jpg
transparent pillars.jpg (427.23 KiB) Viewed 1657 times

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by jfrazierjr »

Wow... that's pretty darn NEAT!!! When I made onTokenMove, I had absolutely no idea of what kind of crazy stuff you guys would come up with, but I think this is about the neatest for those who like ISO type gaming.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by aliasmask »

Yeah, I toyed around with isometric maps, but there would be a few things that are built in to maptool that you'll end up losing, like all lighting effects, distance measurements, some sizing and orientation issues as well as the things you pointed out. Also, creating the terrain and tokens is a bit of a pain. I started to standardize some things making my own tileset but that was turning in to a big pain too. Wolf actually did one thing I was needing to do and that was create transparent sections (kudos). I would also need to add elevation to token props so it calcs the correct z-order in relation to the map objects. Some one flying could appear in the same square as someone north of the flying token, for example.

I decided to make my own "snap to grid" which worked out really well. If I were to continue with developing the isomaps I would have an avatar to move my token. The token would appear on the object layer and it would be of an "unusual" size while the token layer will have a standard medium token (transparent?) which will allow the player to interface with the token. I would base visibility on the marker rather than the actual image (ie can token A see token B) as well as some custom distance formulas. I went with the diamond shape because of lighting distances, but I may just go with normal squares. I found that the gridless map with tokens snapped to grid will work the best for me because of where the footprint appears in the image (at center of image). The tokens I use are taller then they are wide so the center of the base appears at the center of the image.

In the example you give, it looks like the token is on top of the column because of the layers. I was going to try and make it still appear behind the slightly transparent column, but have a marker on token layer (that only the player and gm can see) control the movement. Marker could change from transparent to a green glowing ring showing that you can move your token. I would remove ownership of token when you couldn't move your token, but you could still click it and run campaign macros to do certain things.

User avatar
RecklessEnthusiasm
Cave Troll
Posts: 61
Joined: Sat Jun 12, 2010 2:45 am
Location: Ventura, CA
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by RecklessEnthusiasm »

Ooo, is your custom 'snap to' customizable? Could you have the tokens 'snap' at 30 degree movements (true isometric) rather than 45 degrees, I mean?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by wolph42 »

ive been looking at AMs code and he 'just' uses mathematics to calculate the 'snap' position and a nifty trick to decide the drawing order (took me a while before I got that). I haven't looked closely at his calculations, but I assume that 30 degree snap just means a different calculation, so yes. However your plea for this feat should be at the feet of AM not me :D. Im not interested in iso.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Bug? setDrawOrder / setTokenDrawOrder

Post by aliasmask »

The formula I use was really kind of a hack based on the size of the tokens. If I were to formalize it, I would make a table instead. Basically, the trick is getting the proper offset from the upper left corner to the center mod and applying that to positions on the map. With the square(ish) map I would just calc if it was closer to an odd or even unit and adjust the snap. What you have is basically the same, but with a different y adjustment. I'll play around with it and see what I come up with.

Post Reply

Return to “MapTool”