GSC reference › Built-in
ButtonPressed()
Built-in (engine)
Server
Player Called on: player
Check if the host is pressing the button/key, "BUTTON_A", "BUTTON_B", "K", etc...
Signature
<player> ButtonPressed()
Called on an entity: player ButtonPressed(...)
Example (from Treyarch's docs)
while( self ButtonPressed( "BUTTON_A" ) ) ...
Notes
(it will only check the host player's buttons though)
Real uses in BO3's scripts
Called 171 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_puppet.gsc, line 38
if(isdefined(player) && player buttonpressed("")) - scripts/zm/gametypes/_dev.gsc, line 878
if(!dpad_left && self buttonpressed("")) - scripts/zm/zm_temple_triggers.gsc, line 295
if(!self buttonpressed(button)) - scripts/shared/ai_puppeteer_shared.gsc, line 128
if(self buttonpressed("") && self buttonpressed("")) - scripts/shared/bots/_bot.gsc, line 1738
if(self buttonpressed(""))
Related built-ins
- UseButtonPressed()Check if the player is pressing the use button
- AttackButtonPressed()Check if the player is pressing the fire button
- AdsButtonPressed()Check if the player is pressing the 'ads' button.
- MeleeButtonPressed()Check if the player is pressing the melee button
- FragButtonPressed()Check if the player is pressing the frag button
- ActionSlotFourButtonPressed()Check if the player is pressing the action slot 4 button
- JumpButtonPressed()Check if the player is pressing the 'jump' button.
- SecondaryOffhandButtonPressed()Check if the player is pressing the secondary offhand button
- StanceButtonPressed()Check if the player is pressing the 'stance' button.
- ActionSlotOneButtonPressed()Check if the player is pressing the action slot 1 button
- ActionSlotThreeButtonPressed()Check if the player is pressing the action slot 3 button
- ActionSlotTwoButtonPressed()Check if the player is pressing the action slot 2 button
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).