ID:2244824
 
(See the best response by Kaiochao.)

Problem description:

Morning guys, this is more of a how-to question. I my game's TBS, I'm using a lot of animate() in order to move hud objects. Now I want to have a pointer hanging over one of thosehud objects, namely this one:

hud
fighter //used for showing mobs that are fighting onscreen
layer=MOB_LAYER+11
var/id
screen_loc="12:5,10:16"


The problem is that I animate its movement quite a lot. Now I tried getting the coords of the image with f.id.screen_loc, but they are the same as when it spawned, the animation doesn't seem to be counting that as changing screen_loc. I tried with pixel_x and pixel_y, but it game me no change.

So, what vars are actually changed when I use, let's say this:

animate(fighter,transform=matrix(10,5,MATRIX_TRANSLATE)*0.75, time=2, loop=0, easing=LINEAR_EASING)


and how do I access them? I mean, it doesn't seem to be pixel_x/y or screen_loc.
And how do I access the Height/Width of an icon in a hud object? I tried fighter.icon.Width but it didn't work and told me the proc doesn't exist.
When you use animate() to change a variable, that variable is changed immediately.

In your call to animate(), you animate "fighter" by setting "transform" to a matrix. The variable changed is "fighter.transform".

animate() is simply a way to make clients see a change in appearance occur smoothly over time.
The equivalent without animate() is this, which happens instantly:
fighter.transform = matrix(10, 5, MATRIX_TRANSLATE) * 0.75

I'm not sure why, but some people seem to be conflating animate() and atom.transform. They're two completely separate features; animate() can be used to change an atom's transform, but it's the transform var that's being changed and causes the actual visual effects like sliding, scaling, rotating.

(By the way, "loop=0" and "easing=LINEAR_EASING" are the default values for those arguments, so you don't have to specify them.)

As for actually getting the position, it requires some math and knowledge of the matrix datum; all of which is described in the DM Reference pages about the matrix and transform.
Thanks man, but one more question: how do I get the vars returned from that matrix? I tried doing fighter.transform and it just gave me /matrix. I'm still not well-versed with them.
In response to Kayren
Best response
"fighter.transform" refers to a datum with the type /matrix. According to the DM Reference, the /matrix type has the variables "a", "b", "c", "d", "e", "f", which correspond to the 6 important elements (numbers) of what's known as an affine transformation matrix. Through certain mathematics (linear algebra), an atom's icon is transformed by the client by using these 6 numbers.

Just like any other datum (including "fighter" in your example), you can access its variables with the "." syntax, using a variable of the appropriate type on the left (of the "."), and the name of a variable that the type has, on the right:
// Declare a variable "m" with the type "/matrix" 
// and initialize it to the value of the "transform" variable
// of the value of the "fighter" variable.
var matrix/m = fighter.transform

// Output the values of each of the variables in the matrix.
world << "[m.a], [m.b], [m.c], [m.d], [m.e], [m.f]"
Thanks mang, I decided to just add cursor.transform=fighter.transform. That way I don't have to sift through all the variables and it also scales depending on the way the sprites scale.