Global Command: createHapticEffectCondition: Difference between revisions

From The Official Visionaire Studio: Adventure Game Engine Wiki
EK (talk | contribs)
Created page with "Create a constant haptic effect for devices supporting haptic effects. {| class="ts" |- | style="width:15%" | Related functions | Global Command: createHapticEffectConstant..."
 
EK (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Create a constant haptic effect for devices supporting haptic effects.
Create a haptic effect for devices which support haptic effects.


{| class="ts"
{| class="ts"
Line 10: Line 10:
== Syntax ==
== Syntax ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
createHapticEffectConstant(effectType, length, delay, level, attack_length, attack_level, fade_length, fade_level, effectDirection [, dir0, dir1, dir2])
createHapticEffectCondition(effectType, length, delay, right_sat, left_sat, right_coeff, left_coeff, deadband, center)
</syntaxhighlight>
</syntaxhighlight>


Line 23: Line 23:
| effectType
| effectType
| string
| string
|  
| Type of the effect.
|-
|-
| length
| length
| int
| int
|  
| Duration of the effect in milliseconds.
|-
|-
| delay
| delay
Line 33: Line 33:
|  
|  
|-
|-
| level
| right_sat
| int
| int
|  
|  
|-
|-
| attack_length
| left_sat
| int
| int
|  
|  
|-
|-
| attack_level
| right_coeff
| int
| int
|  
|  
|-
|-
| fade_length
| left_coeff
| int
| int
|  
|  
|-
|-
| fade_level
| deadband
| int
| int
|  
|  
|-
|-
| effectDirection
| center
| string
|
|-
| dir0
| int
|
|-
| dir1
| int
|
|-
| dir2
| int
| int
|  
|  
Line 78: Line 66:
|-
|-
| integer
| integer
| The id of the created effect.
| The unique id of the created effect.
|}
|}


Line 84: Line 72:
== Examples ==
== Examples ==


'''Example 1:''' Create a constant haptic effect and start it.
'''Example 1:''' Create and start a haptic effect.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local effectID = createHapticEffectConstant('constant', 1000, -1, 0x6000, 1000, -1, 1000, -1, 'polar', 20000)
local effectID = createHapticEffectCondition('spring', 5000, -1, 0xFFFF, 0xFFFF, 0x2000, 0x2000, -1, 0x1000)
startHapticEffect(effectID)
startHapticEffect(effectID)
</syntaxhighlight>
</syntaxhighlight>
{{toc}}
{{toc}}

Latest revision as of 11:12, 5 August 2023

Create a haptic effect for devices which support haptic effects.

Related functions createHapticEffectConstant | createHapticEffectLeftRight | createHapticEffectPeriodic | createHapticEffectRamp | startHapticEffect | startHapticRumble | stopHapticEffect | stopHapticRumble


Syntax

createHapticEffectCondition(effectType, length, delay, right_sat, left_sat, right_coeff, left_coeff, deadband, center)


Parameters

Parameter Type Description
effectType string Type of the effect.
length int Duration of the effect in milliseconds.
delay int
right_sat int
left_sat int
right_coeff int
left_coeff int
deadband int
center int


Return values

Type Description
integer The unique id of the created effect.


Examples

Example 1: Create and start a haptic effect.

local effectID = createHapticEffectCondition('spring', 5000, -1, 0xFFFF, 0xFFFF, 0x2000, 0x2000, -1, 0x1000)
startHapticEffect(effectID)