00E2

From GTAMods Wiki
Revision as of 03:56, 8 January 2015 by Spaceeinstein (talk | contribs) (Created page with "{{Icon|3}} '''GET_PAD_STATE''' <hr /> '''Description''' : Gets the current button pressed '''Syntax''' : 00E2: get_player [''int1''] key [''int2''] state_to [''var''] '''Param...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GTA III GET_PAD_STATE


Description

Gets the current button pressed

Syntax

00E2: get_player [int1] key [int2] state_to [var]

Parameter

[int1]
Pad, normally 0 for pad 1 (player 1), 1 for pad 2 (player 2)
[int2]
Button index
[var]
Variable to store the value

This opcode gets the status of the button. It returns a value between 0 and 255, 255 meaning the button is completely pressed down.

For Vice City

This opcode does not exist in Vice City but it is possible to retrieve the status of the button in the same manner as GTA III. The following example, using Sanny Builder with CLEO for Vice City in an external script (not the main one) and tested on US v1.0, retrieves the value of the status of the button for pad 0.

:opcode_00E2
// 0@ - input param (button)
0@ *= 2  // offset in memory
0@ += 0x7DBCB0  // add to base memory location
05E0: 0@ = read_memory 0@ size 1 virtual_protect 1  // retrieve status of button
05F6: ret 1 0@

Use this line as a substitute for opcode 00E2. This can be placed anywhere within the external script:

05F5: call_scm_func @opcode_00E2 inputs 1 button [button] result [variable]

Keywords

get, button, key, press, pressed, keypress