|
| NIL | buttons.read () |
| | Read the press of the buttons, saving the results in boolean constants. Thus, to determine whether you have pressed the R key, for example, will check the state of buttons.r constants directly. This is the list of the avaible constants: More...
|
| |
| NIL | buttons.homepopup (NUMBER state) |
| | Disable/enable the homescreen. More...
|
| |
| NIL | buttons.interval (NUMBER delay, NUMBER interval) |
| | Activate the function Autorepeat. More...
|
| |
| NIL | buttons.interval () |
| | Disables the function Autorepeat. More...
|
| |
| NUMBER | buttons.waitforkey () |
| | Stop the script execution until a control is pressed. More...
|
| |
| NIL | buttons.waitforkey (NUMBER key) |
| | Stop the script execution until the indicated control is pressed (is not possible to use a control combination). More...
|
| |
| NIL | buttons.analogtodpad (NUMBER deadzone) |
| | Active the analog to digital control conversion (disabled as default). When is enabled and the analog moves enough, the console "will think" it's pressing the corresponding digital directional button. More...
|
| |
| NUMBER | buttons.assign () |
| | It allows to know the allocation button. More...
|
| |
| NIL | buttons.assign (NUMBER key) |
| | It allows setting the button assignment. More...
|
| |
| NIL | buttons.portinfo (quitar) |
| | It gets the information of the control ports on the console. More...
|
| |
| NIL | buttons.rumble (NUMBER joy, NUMBER small, NUMBER large) |
| | Enable/Disable the control vibration. More...
|
| |
| NIL | buttons.lbar (NUMBER port, COLOR c) |
| | Modifies the light on the controls. More...
|
| |
Physical controls managing.
Read the press of the buttons, saving the results in boolean constants. Thus, to determine whether you have pressed the R key, for example, will check the state of buttons.r constants directly. This is the list of the avaible constants:
- select
- start
- up
- down
- left
- right
- l
- r
- triangle
- circle
- cross
- square
- analoglx (stick left)
- analogly (stick left)
- analogrx (stick right)
- analogry (stick right)
- released (newly released buttons)
- Same previous constants, except analoglx, analogly, analogrx y analogry.
- held (buttons are held pressed)
- Same previous constants, except analoglx, analogly, analogrx y analogry.
msg, contador = true, 0 --2 simple variables...
while true do
buttons.read() --That's it... reading the buttons
if buttons.cross then msg = not msg end --Simple X pulsation
if buttons.held.up then contador = contador + 1 end --arrows held pulsation
if buttons.held.down then contador = contador - 1 end
if buttons.released.start then break end --press & release Start to exit
if msg then screen.print(5, 35, "Press X to make me invisible/visible!" ) end
screen.print(5, 5, "Up/Down to modify the counter\ncurrent value: "..contador)
screen.print(5, 50, "Analog left\nX: "..buttons.analoglx.. "\nY: "..buttons.analogly)
screen.print(5, 95, "Press Start to exit")
screen.flip()
end
- Note
- You can see that analoglx, analogly, analogrx and analogry are not booleans, are numbers between -128 and 127 representing the position of the analog control. Positive means right (X) and down (for Y).
- Returns
- Nothing.
| NIL buttons.homepopup |
( |
NUMBER |
state | ) |
|
Disable/enable the homescreen.
- Parameters
-
| state | 2 options:
- 0: Disable the homescreen.
- 1: Enable the homescreen.
|
- Returns
- Nothing.
| NIL buttons.interval |
( |
NUMBER |
delay, |
|
|
NUMBER |
interval |
|
) |
| |
Activate the function Autorepeat.
- Parameters
-
| delay | It is the delay measured in cycles (A typical value here is 40). |
| interval | It is the repeat interval measured in cycles (A typical value here is 10). |
- Note
- Typical keys the user would expect to be auto-repeated are: up, down, right, left, L and R.
- Returns
- Nothing.
Disables the function Autorepeat.
- Returns
- Nothing.
| NUMBER buttons.waitforkey |
( |
| ) |
|
Stop the script execution until a control is pressed.
- Returns
- Numerical code belonging to the control that is pressed (Same as the constants).
| NIL buttons.waitforkey |
( |
NUMBER |
key | ) |
|
Stop the script execution until the indicated control is pressed (is not possible to use a control combination).
- Parameters
-
| key | Some of these constants(in parentheses their numeric values):
- __SELECT (1)
- __START (4)
- __UP (5)
- __RIGHT (6)
- __DOWN (7)
- __LEFT (8)
- __L (9)
- __R (10)
- __TRIANGLE (13)
- __CIRCLE (14)
- __CROSS (15)
- __SQUARE (16)
- __HOLD (18)
|
- Returns
- Nothing.
| NIL buttons.analogtodpad |
( |
NUMBER |
deadzone | ) |
|
Active the analog to digital control conversion (disabled as default). When is enabled and the analog moves enough, the console "will think" it's pressing the corresponding digital directional button.
- Parameters
-
| deadzone | Sensitivity of the conversion, a number from 1 to 127 (while number is higher the sensitivity is lower. A common value is 30). Ignoring this argument (or value 0) will disable the conversion. |
- Returns
- Nothing
| NUMBER buttons.assign |
( |
| ) |
|
It allows to know the allocation button.
- Returns
- 1. If the button assignment is X or 0 if the button assignment is or.
| NIL buttons.assign |
( |
NUMBER |
key | ) |
|
It allows setting the button assignment.
- Parameters
-
| key | 1 If the button assignment is X or 0 if the button assignment is O. |
- Note
- It requires restart to take effect.
- Returns
- Nothing.
| NIL buttons.portinfo |
( |
quitar |
| ) |
|
It gets the information of the control ports on the console.
- Note
- This will only work on PSV-TV.
- Returns
- A parent table with 2 subtables with the next fields:
- type: Is the port type (STRING): UNPAIRED, PHYSICAL, VIRTUAL, DS3, DS4, UNKNOW.
- raw: Is the port type (NUMBER).
| NIL buttons.rumble |
( |
NUMBER |
joy, |
|
|
NUMBER |
small, |
|
|
NUMBER |
large |
|
) |
| |
Enable/Disable the control vibration.
- Parameters
-
| joy | A number: 1 or 2, indicates the control to be assigned. |
| small | A number 0-100% will indicate the vibration percentaje on the small motor. |
| large | A number 0-100% will indicatethe vibration percentage on the large motor. |
- Note
- This will only work on PSV-TV.
- Returns
- Nothing.
| NIL buttons.lbar |
( |
NUMBER |
port, |
|
|
COLOR |
c |
|
) |
| |
Modifies the light on the controls.
- Parameters
-
| port | A number: 1 or 2, indicates the control to be assigned. |
| c | The led bar color. |
- Note
- This will only work on PSV-TV.
- Returns
- Nothing.