summaryrefslogtreecommitdiffstatshomepage
path: root/docs/source/techspecs
diff options
context:
space:
mode:
author feos <vadosnaprimer@users.noreply.github.com>2022-02-27 18:12:25 +0300
committer GitHub <noreply@github.com>2022-02-28 02:12:25 +1100
commit300206e308c2c5f9ad8898fb62f1873be682df5a (patch)
treecb780133d4b724eb390bf84fa9c14a7b7ee4dc1a /docs/source/techspecs
parent029f4232fe9779cbe7d2f9cf2d3e991108da75dc (diff)
Lua engine: Make setting analog I/O port field values user-friendly. (#9322)
Exposed minimum/maximum values for analog fields. together with defvalue, they can be used to check range of values and neutral position. Previously you had to send a normalised value between -65535 and 65535 which would be scaled depending on machine specifics. You could read the scaled value from the port, but you couldn't send scaled values in. This allows scripts to set scaled values as seen by the machine.
Diffstat (limited to 'docs/source/techspecs')
-rw-r--r--docs/source/techspecs/luareference.rst13
1 files changed, 10 insertions, 3 deletions
diff --git a/docs/source/techspecs/luareference.rst b/docs/source/techspecs/luareference.rst
index 68704b95951..bc896c34ebc 100644
--- a/docs/source/techspecs/luareference.rst
+++ b/docs/source/techspecs/luareference.rst
@@ -1962,7 +1962,7 @@ Wraps MAME’s ``ioport_field`` class, representing a field within an I/O port.
Instantiation
^^^^^^^^^^^^^
-manager.machine.ioport.ports[tag]:field[mask]
+manager.machine.ioport.ports[tag]:field(mask)
Gets a field for the given port by bit mask.
manager.machine.ioport.ports[tag].fields[name]
Gets a field for the given port by display name.
@@ -1974,6 +1974,9 @@ field:set_value(value)
Set the value of the I/O port field. For digital fields, the value is
compared to zero to determine whether the field should be active; for
analog fields, the value must be right-aligned and in the correct range.
+field:clear_value()
+ Clear programmatically overridden value and restore the field’s regular
+ behaviour.
field:set_input_seq(seqtype, seq)
Set the :ref:`input sequence <luareference-input-iptseq>` for the
specified sequence type. This is used to configure per-machine input
@@ -2018,9 +2021,13 @@ field.player (read-only)
field.mask (read-only)
Bits in the I/O port corresponding to this field.
field.defvalue (read-only)
- The field’s default value
+ The field’s default value.
+field.minvalue (read-only)
+ The minimum allowed value for analog fields, or nil for digital fields.
+field.maxvalue (read-only)
+ The maximum allowed value for analog fields, or nil for digital fields.
field.sensitivity (read-only)
- The sensitivity or gain for analog fields
+ The sensitivity or gain for analog fields.
field.way (read-only)
The number of directions allowed by the restrictor plate/gate for a digital
joystick, or zero (0) for other inputs.