Okey, well I don't get any trouble from the engine.

This is all the code that's involved:
(I changed some of the names)
Click to reveal..

////////////////
ENTITY*temp_ptr;

var index = 0;
var entitis[100];
///////////////

action green_crystal_settings ()
{
entitis[index] = handle(me);
index += 1;

var temp_rotation = random(2)-1;
my.skill32 = 1; // identify as mineral
my.skill29 = 1;
set(my, POLYGON);
my.ambient = 100;
my.pan += random(2)-1;
my.tilt += random(2)-1;
my.scale_x = 0.2;
my.scale_y = 0.2;
my.scale_z = 0.2;
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | POLYGON | ENABLE_SCAN);
my.event = mineral_hit;
while (me)
{
my.pan += temp_rotation;
my.tilt += temp_rotation;
wait(1);
effect(mineral_green_glow,2,my.x,nullvector);
}
}

function move_entity(numb)
{
temp_ptr = ptr_for_handle(entitis[numb]);
ent_remove (temp_ptr);
}

/////////////////////

After I start it up I wait until I have some minerals and then I press tab and type: move_entity(3)
but none of the little buggers get removed.