Blockland Forums > Modification Help
onTrigger [Solved]
(1/2) > >>
Aware:

--- Code: ---          function Armor::onTrigger(%this, %player, %slot, %val)
--- End code ---

I want to change this into something like onTriggerUp or onTriggerDown, so that when you hold the right mouse button it does something but when you lift up it stops. Is there any way to do this?
Headcrab Zombie:
I'm not sure what value of %slot corresponds to the right mouse button, but the function is called with a %val of 1 when you press it, and 0 when you release it

So something like


--- Code: ---function Armor::onTrigger(%this,%player,%slot,%val)
{
if(%slot == )
{
if(%val)
//do stuff when button is pressed
else
//do stuff when button is let go off

}
}
--- End code ---
Aware:

--- Quote from: Headcrab Zombie on April 21, 2012, 12:57:09 PM ---I'm not sure what value of %slot corresponds to the right mouse button, but the function is called with a %val of 1 when you press it, and 0 when you release it

So something like


--- Code: ---function Armor::onTrigger(%this,%player,%slot,%val)
{
if(%slot == )
{
if(%val)
//do stuff when button is pressed
else
//do stuff when button is let go off

}
}
--- End code ---

--- End quote ---

Okey thanks, i'll try it. And slot is like crouch, jump, right click, left click; slot == 4 is right click
Port:
0: activate
1: use
2: jump
3: crouch
4: jet
jes00:

--- Quote from: Port on April 21, 2012, 04:34:12 PM ---0: activate
1: use
2: jump
3: crouch
4: jet

--- End quote ---
When exactly is used called? And 4 is jet and/or right click.
Navigation
Message Index
Next page

Go to full version