you set mouse_mode=3;
this will set the mouse_pos to the windows mouse_cursor position
and this is why your mouse jumps back o the "real" mouse position

what we have to do is now to set mouse_mode=1;
next step is to move the mouse_pos of your game with the mouse speed
like this
Code:
mouse_pos.x+=mickey.x*5*time_step;
mouse_pos.y+=mickey.y*5*time_step;



and the rest of your code should look like this


Code:
#include <acknex.h>

BMAP* cursor = "mouse_cursor.png";
BMAP* test_button = "test_button.jpg";

var button_pressed = 0; 

function main()
{
	video_mode = 11;
	video_screen = 1;
	mouse_mode = 1;
	mouse_map = cursor;
	level_load(""); 
	//
	while(1)
	{
		if(key_esc) sys_exit(NULL);
		
		
		mouse_pos.x+=mickey.x*5*time_step;
		mouse_pos.y+=mickey.y*5*time_step;
		
		if(button_pressed == 1)
		{
		vec_set(mouse_pos.x,screen_size.x/2);
	        vec_set(mouse_pos.y,screen_size.y/2);  
                }
		wait(1);
	}		
}

function test()
{
	button_pressed = 1;	
	wait(8);
	button_pressed = 0;
}

PANEL* test_panel =
{ 
   layer = 2; 
   pos_x = 1400; 
   pos_y = 250; 
   size_x = 300; 
   size_y = 800; 
   button(20,20,test_button,test_button,test_button,test,NULL,NULL);
   flags = SHOW;
}