The following should work, storing the computed distance in the variable distance_to_ground. However, when I've displayed the value in a panel it does seem to start fluctuating after the player is stationary for a few seconds. Not sure why!

vec_set (temp.x, my.x); // copy player's position to temp
temp.z -= 5000; // set temp.z 5000 quants below player's origin

// compute the distance to ground
distance_to_ground = c_trace (my.x, temp.x, ignore_me | use_box);