Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (3run, AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip), 605 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Click on Entity.[CLOSED] #290732
09/20/09 22:20
09/20/09 22:20
Joined: Nov 2008
Posts: 26
France
H
Hirogens Offline OP
Newbie
Hirogens  Offline OP
Newbie
H

Joined: Nov 2008
Posts: 26
France
Hi,

How to intercept a click on Entity ?

regards

Last edited by Hirogens; 09/20/09 22:57.

A7 Commercial License.
http://www.wormhole-the-game.com

AMD64 6000+, GTX 280 2GB, 4 GB Ram, Seven
Re: Click on Entity. [Re: Hirogens] #290736
09/20/09 22:32
09/20/09 22:32
Joined: Jan 2005
Posts: 605
Deutschland, NRW
G
garv3 Offline
User
garv3  Offline
User
G

Joined: Jan 2005
Posts: 605
Deutschland, NRW
In the entity's function set "my.emask |= ENABLE_CLICK;" and for example "my.event = mouse_event;"
The function might look like:
Code:
function mouse_event() 
{
  if (event_type == EVENT_CLICK) 
  {
    //entity has been clicked! do whatever you want to do!
  }
}




GameStudio Version: A7 Pro v7.86
Re: Click on Entity. [Re: garv3] #290739
09/20/09 22:44
09/20/09 22:44
Joined: Nov 2008
Posts: 26
France
H
Hirogens Offline OP
Newbie
Hirogens  Offline OP
Newbie
H

Joined: Nov 2008
Posts: 26
France
thanks,

but have you an explicite example...

regards


A7 Commercial License.
http://www.wormhole-the-game.com

AMD64 6000+, GTX 280 2GB, 4 GB Ram, Seven
Re: Click on Entity. [Re: Hirogens] #290741
09/20/09 22:54
09/20/09 22:54
Joined: Jan 2005
Posts: 605
Deutschland, NRW
G
garv3 Offline
User
garv3  Offline
User
G

Joined: Jan 2005
Posts: 605
Deutschland, NRW
I'll write an example down:
Code:
function entity_event()
{
  if (event_type == EVENT_CLICK) 
  {
    ent_remove(me);
  }
}

action entity_action()
{
  my.emask |= ENABLE_CLICK;
  my.event = entity_event;
}



If you assign the action "entity_action" to an entity it will be removed if you click it.
But be sure that:
1st: mouse_range is at least the distance between camera and entity
2nd: mouse_mode = 1 or 2

derGarv


GameStudio Version: A7 Pro v7.86
Re: Click on Entity. [Re: garv3] #290742
09/20/09 22:57
09/20/09 22:57
Joined: Nov 2008
Posts: 26
France
H
Hirogens Offline OP
Newbie
Hirogens  Offline OP
Newbie
H

Joined: Nov 2008
Posts: 26
France
thanks,

My error was : mouse_mode missing


regards...


A7 Commercial License.
http://www.wormhole-the-game.com

AMD64 6000+, GTX 280 2GB, 4 GB Ram, Seven
Re: Click on Entity. [Re: Hirogens] #290743
09/20/09 22:58
09/20/09 22:58
Joined: Jan 2005
Posts: 605
Deutschland, NRW
G
garv3 Offline
User
garv3  Offline
User
G

Joined: Jan 2005
Posts: 605
Deutschland, NRW
You're welcome!


GameStudio Version: A7 Pro v7.86

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1