News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: LUA Buttons Explanation  (Read 9504 times)

0 Members and 1 Guest are viewing this topic.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
LUA Buttons Explanation
« on: January 24, 2015, 02:33:47 PM »
I would like to clear up something that I see a lot of modders getting confused on regarding how the buttons work in Bully. How the "IsButtonBeingPressed", "IsButtonPressed", and "IsButtonBeingReleased" works.

If you've modded scripts for the game before, I'm sure you know how they work. Put a button number in the first argument (first number in the parenthesis) and a 0 as the 2nd. There seem to be 2 common confusions/misunderstandings though that I see and wanna clear up...

"The first number is the exact button or key that needs to get pressed, like the button Y or the key Shift"
"The second number is 0 for keyboard and 1 for an XBox360"

If you believe in either of the 2 above statements... keep reading as this will really help you.

First off, the button is something 0-15. Now... these buttons 0-15 do NOT correspond to a button on the controller, or key on the keyboard exactly. They correspond to actions that they do, such as jumping, attacking, pausing, sprinting, looking through missions and side missions, getting in vehicles, etc. So for example, the number 8 IS the button to jump. It is not exactly just "B" or "Spacebar". So for example if someone changed their control plot or button setup for Shift to jump and Spacebar to attack, then 8 (The jumping button) would become "Shift" instead of "Spacebar". The one number, also works for both the keyboard and xbox controller. There is not separate buttons for the xbox controller. 8 is jumping on both. So again, if the xbox player changes his control plot for like A to be jump, then 8 would be A for that person. If they changed it back to B, then 8 would be B.

Second, the controller should be 0 or 1 (I haven't tried past 1 as I don't have a 3rd controller... but usually you wouldn't need to anyways) 0 is Player1. It's not exactly meaning the keyboard, or the xbox controller. It's whatever input device is controlling Jimmy. So if you have an xbox controller in AND are using it to control Jimmy, then the xbox controller is Player1 and is thus the controller 0. If you have an xbox controller plugged in and are using the keyboard instead to control Jimmy as you took off the xbox control in settings, then the keyboard is now controller 0 as it is what controls Jimmy. The keyboard or controller NOT controlling Jimmy, would be Player2, meaning controller id 1. When making mods to be released, be mindful of people who may not have both a keyboard and controller and for people who can't easily use both at the same time for whatever reason. Usually, it'll just be best to use 0. Again, 0 is whatever is controlling the player! That can be either the keyboard OR xbox controller, it doesn't matter which either, because it is the device controlling Jimmy, and also because remember, both have the same 0-15 buttons that are actually binded to the actions of things Jimmy does rather than exact keys/buttons.


Here's a list of buttons too for anyone who needs it. One that is properly titled with the actions, rather than keys/buttons.

0   Show Secondary Tasks
1   Show Tasks/Objectives
2   Zoom in
3   Zoom out
4   Map Menu
5   Pause Menu
6   Melee Attack
7   Sprint
8   Jump
9   Grapple
10   Lock On
11   Previous Weapon
12   Weapon Fire
13   Next Weapon
14   Look Back
15   Crouch

Offline SWEGTA

  • Da Forum Luffs Me!
  • *****
  • Posts: 6,422
  • Gender: Male
  • Swee Gee Tee Ayy
    • View Profile
    • Bully & GTA videos
Re: LUA Buttons Explanation
« Reply #1 on: January 24, 2015, 02:42:14 PM »
This is a great explanation/overview on how it works.
Thanks, BOSS:

Offline Enderman

  • What i'm doing right now?
  • Full Member
  • ***
  • Posts: 293
  • Gender: Male
  • I'm no longer do mods for Bully ...
    • View Profile
    • bully-board.com
Re: LUA Buttons Explanation
« Reply #2 on: January 24, 2015, 09:55:53 PM »
What are next weapon,previous weapon and look back ?   :-\
« Last Edit: January 25, 2015, 12:26:38 AM by kovn123vn »

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: LUA Buttons Explanation
« Reply #3 on: January 25, 2015, 12:36:27 AM »
Well, the look back button is 14, the button that I labeled as "Look Back" in my list. Also, in-game the "Look Back" button is used to, get this, look back behind Jimmy.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: LUA Buttons Explanation
« Reply #4 on: January 25, 2015, 01:05:07 AM »
What are next weapon,previous weapon and look back ?   :-\
The change weapon is 13 for right weapon, and 11 is left weapon. if I am wrong, then it is vice versa. You can just use IsButtonPressed for it.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Buttons Explanation
« Reply #5 on: January 25, 2015, 04:18:10 AM »
People also seem to be confused about the purpose of each function.

IsButtonBeingPressed : When you press the button once

IsButtonPressed : Same as IsButtonBeingPressed but will repeat the code following after it, if you hold the button, and will stop repeating once you release it.

IsButtonBeingReleased : The code will work once you press a button and release it.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: LUA Buttons Explanation
« Reply #6 on: January 25, 2015, 02:16:23 PM »
People also seem to be confused about the purpose of each function.

IsButtonBeingPressed : When you press the button once

IsButtonPressed : Same as IsButtonBeingPressed but will repeat the code following after it, if you hold the button, and will stop repeating once you release it.

IsButtonBeingReleased : The code will work once you press a button and release it.
Nice example.  8)

IsButtonPressed is pretty much when you hold the button.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Buttons Explanation
« Reply #7 on: January 26, 2015, 02:03:35 AM »
People also seem to be confused about the purpose of each function.

IsButtonBeingPressed : When you press the button once

IsButtonPressed : Same as IsButtonBeingPressed but will repeat the code following after it, if you hold the button, and will stop repeating once you release it.

IsButtonBeingReleased : The code will work once you press a button and release it.
Nice example.  8)

IsButtonPressed is pretty much when you hold the button.

Yes but it will repeat the code until you stop holding the button. Try it yourself.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: LUA Buttons Explanation
« Reply #8 on: January 26, 2015, 08:42:59 PM »
^ Well... that is assuming the function is used in some type of loop.