Difference between revisions of "FF7/Field/Script/Opcodes/30 IFKEY"

From Final Fantasy Inside
< FF7‎ | Field‎ | Script‎ | Opcodes
Jump to navigation Jump to search
my_wiki>BukTop
m (9 revisions imported)
(Amend button IDs)
 
(One intermediate revision by one other user not shown)
Line 28: Line 28:
 
! style="background:rgb(204,204,204)" | ID
 
! style="background:rgb(204,204,204)" | ID
 
! style="background:rgb(204,204,204)" | Button
 
! style="background:rgb(204,204,204)" | Button
 +
|-#
 +
| 0b1 / 1
 +
| L2 / Camera
 
|-
 
|-
| style="background:rgb(255,255,204)" align="center" | 0x0001
+
| 0b10 / 2
| style="background:rgb(255,255,204)" | Assist
+
| R2 / Target
 
|-
 
|-
| align="center" | 0x0008
+
| 0b100 / 4
| Start
+
| L1 / PageUp
 
|-
 
|-
| align="center" | 0x0010
+
| 0b1000 / 8
| Up
+
| L2 / PageDown
 
|-
 
|-
| align="center" | 0x0020
+
| 0b10000 / 16
| Right
+
| Triangle / Menu
 
|-
 
|-
| align="center" | 0x0040
+
| 0b100000 / 32
| Down
+
| Circle / OK
 
|-
 
|-
| align="center" | 0x0080
+
| 0b1000000 / 64
| Left
+
| Cross / Cancel
 
|-
 
|-
| style="background:rgb(255,255,204)" align="center" | 0x0100
+
| 0b10000000 / 128
| style="background:rgb(255,255,204)" | Camera
+
| Square / Switch
 
|-
 
|-
| style="background:rgb(255,255,204)" align="center" | 0x0200
+
| 0b100000000 / 256
| style="background:rgb(255,255,204)" | Target
+
| Select / Assist
 
|-
 
|-
| align="center" | 0x0400
+
| style="background:rgb(255,255,204)" | 0b1000000000 / 512
| Page Up
+
| style="background:rgb(255,255,204)" | Unknown 1
 
|-
 
|-
| align="center" | 0x0800
+
| style="background:rgb(255,255,204)" | 0b10000000000 / 1024
| Page Down
+
| style="background:rgb(255,255,204)" | Unknown 2
 
|-
 
|-
| align="center" | 0x1000
+
| 0b100000000000 / 2048
| Menu
+
| Start / Pause
 
|-
 
|-
| align="center" | 0x2000
+
| 0b1000000000000 / 4096
| OK
+
| Up
 
|-
 
|-
| align="center" | 0x4000
+
| 0b10000000000000 / 8192
| Cancel
+
| Right
 +
|-
 +
| 0b100000000000000 / 16384
 +
| Down
 
|-
 
|-
| align="center" | 0x8000
+
| 0b1000000000000000 / 32768
| Switch
+
| Left
 
|-
 
|-
 
|}
 
|}

Latest revision as of 12:21, 11 September 2020

  • Opcode: 0x30
  • Short name: IFKEY
  • Long name: If Key Pressed

Memory layout

0x30 B A

Arguments

  • const UShort (Bit field) B: Button ID to check for.
  • const UByte A: Amount to jump if button not pressed.

Description

Checks the status of a button being pressed; if pressed, regardless of the previous condition of the button press state (see IFKEYON / IFKEYOFF), the "if" body executes (that is, the script pointer is moved to the opcode after the current IFKEY). If the checked button fails the condition check, then the script pointer moves ahead A bytes.

The highlighted keys in the button ID table below do not quite act as the rest when used with this particular opcode. For these keys, IFKEY acts in the same manner as IFKEYON; these keys cannot be checked repeatedly, and the if statement body will only execute once, regardless of whether the key is being held down.

Button IDs can be ORd with each other to produce a combination of keys to check in one statement. For example, IFKEY with a key ID of 0x00F0 will check if any of the directional buttons are being pressed.

Button IDs

ID Button
0b1 / 1 L2 / Camera
0b10 / 2 R2 / Target
0b100 / 4 L1 / PageUp
0b1000 / 8 L2 / PageDown
0b10000 / 16 Triangle / Menu
0b100000 / 32 Circle / OK
0b1000000 / 64 Cross / Cancel
0b10000000 / 128 Square / Switch
0b100000000 / 256 Select / Assist
0b1000000000 / 512 Unknown 1
0b10000000000 / 1024 Unknown 2
0b100000000000 / 2048 Start / Pause
0b1000000000000 / 4096 Up
0b10000000000000 / 8192 Right
0b100000000000000 / 16384 Down
0b1000000000000000 / 32768 Left