//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\// //\/script name: object_button /\// //\/ creator: Mystro @ mystro-games.tripod.com /\// //\/ date: April 5, 2005 /\// //\/description: Makes the object a button /\// //\/ arguments: argument0 = the button's text /\// //\/ argument1 = the font colour /\// //\/ argument2 = the font colour when mouse is over/\// //\/ it(-1 for no change) /\// //\/ argument3 = the font colour when the button is/\// //\/ pressed(-1 for no change) /\// //\/ remarks: Must be placed in draw event and it returns /\// //\/ whether the button been pressed. /\// //\/ Also: the sprite of the object should have the/\// //\/ the button not pressed as image 1, the /\// //\/ mouse over it as image 2 and the button /\// //\/ presed as image 3. /\// //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\// var a; if(argument2=-1)argument2=argument1 if(argument3=-1)argument3=argument1 a=draw_get_color() image_speed=0 if(position_meeting(mouse_x,mouse_y,self)) { if(mouse_check_button(mb_left)) { image_index=2 draw_set_color(argument3) } else { image_index=1 draw_set_color(argument2) } } else { image_index=0 draw_set_color(argument1) } draw_sprite(sprite_index,image_index,x,y) if(image_index=2)draw_text(x-string_width(argument0)/2+sprite_width/2+1,y-string_height(argument0)/2+sprite_height/2+1,argument0) else draw_text(x-string_width(argument0)/2+sprite_width/2,y-string_height(argument0)/2+sprite_height/2,argument0) draw_set_color(a) if position_meeting(mouse_x,mouse_y,self)and(mouse_check_button_released(mb_left)) return true else return false