GUI Buttons

What I’m trying to do:
When the player clicks the button, I’d like that player to say Activated!
(setplayerprop #c,Activated!;). Although I don’t know how to make the game detect it’s clicking the Activate image…
If anyone can help with this, please post below! Thanks.

(THE MOUSE MUST BE CLICKING ON THE IMAGE NOT ANYWHERE)

Script:

//Npc made by Ace
if (playerenters){
   if (!isweapon)toweapons -activate;
  setstring this.img,ace_activate.png;
  timeout = 0.05;
}
if (timeout && isweapon){
  showimg 300,#s(this.img),screenwidth/2-60,screenheight-50;
  changeimgpart 300,0,0,152,40;
  changeimgvis 300,4;
  }
  timeout = 0.05;
}

Image:
[ATTACH=CONFIG]3249[/ATTACH]

You will need:

[COLOR="#0000FF"]Mouse Flags		True When[/COLOR]
leftmousebutton		the left mouse button has been pushed

[COLOR="#0000FF"]Mouse Variables			Value[/COLOR]
mousescreenx 			x position of the mouse on the game screen. (in pixels)
mousescreeny 			y position of the mouse on the game screen. (in pixels)

[COLOR="#0000FF"]Special Symbols	Meaning[/COLOR]
in		tests if an array/range contains a variable (e.g. 2 in {1,2,3}; x,y in |0,64|)

a few other things as well :3 But yerr those ones are I M P O R T A N T :o

Learn to look before posting please.

@twiggy
leftmousebutton requires constant checking in a loop and isn’t exactly ideal for guis. Although if you were to make custom commands like mouseReleased you’d definately use that.

A thing I failed to mention is mousedown also provides with it information in #p(0) which says exactly what button was pressed.
Example:

if (mousedown){
  if (strequals(#p(0),left)){

  }
}

That’s awesome :smiley: I had no idea about the parameter in mousedown XD
I’ll have to mess with dem commands when I get the chance :3!

Yeah. keydown, mousedown, and a couple other functions use #p for params.