Hard Light Productions Forums

Modding, Mission Design, and Coding => The Scripting Workshop => Topic started by: Admiral MS on November 05, 2012, 12:50:23 pm

Title: LUA_FULL_CONTROLS - what is this supposed to do?
Post by: Admiral MS on November 05, 2012, 12:50:23 pm
Even after looking at some parts of the code I have no idea what LUA_FULL_CONTROLS is really good for and what it is supposed to do besides inexplicable messing up things. Same goes for LUA_ADDITIVE_BUTTON_CONTROL, LUA_OVERRIDE_BUTTON_CONTROL and LUA_STEERING_CONTROLS which don't seem to have any effect I was expecting.

So can someone help me?
Title: Re: LUA_FULL_CONTROLS - what is this supposed to do?
Post by: zookeeper on November 05, 2012, 02:11:32 pm
I've always been kinda fuzzy as to what the exact difference in behaviour between some of those is, but they allow you to control the player via the control info handle (which you can get via ba.getControlInfo()).

Code: [Select]
ba.setControlMode(LUA_FULL_CONTROLS)
ba.getControlInfo().ForwardCruise = 0.2
Title: Re: LUA_FULL_CONTROLS - what is this supposed to do?
Post by: Nuke on November 05, 2012, 06:18:16 pm
it lets you override joystick input and the like. things like the zoom scrip use it, and my cockpit script uses it for some fancy hotas features (reversing throttle and lateral/vertical thrusters), and hackish 6dof support. i should probibly try to use it to stream some of this imu data ive been playing with and use it to control things in freespace.

getControlInfo() gives you a control info handle, and you use that hanle to let wou tweak various input settings. im a little rusty about how it all works, but i think once you get the control info object most of the things in it are axis and button overrides. so yea you can do alternate interfaces, interface screws, etc with it.
Title: Re: LUA_FULL_CONTROLS - what is this supposed to do?
Post by: WMCoolmon on November 10, 2012, 04:48:06 pm
I've always been kinda fuzzy as to what the exact difference in behaviour between some of those is, but they allow you to control the player via the control info handle (which you can get via ba.getControlInfo()).

Code: [Select]
ba.setControlMode(LUA_FULL_CONTROLS)
ba.getControlInfo().ForwardCruise = 0.2

:(

Code: [Select]
ba.ControlMode = LUA_FULL_CONTROLS
ba.ControlInfo.ForwardCruise = 0.2

Edit: The advantages of this approach are:

These are known as ADE_VIRTVAR, for coders who are adding to the Lua API.

If the operation may reasonably fail, you may have an argument for a function.
Title: Re: LUA_FULL_CONTROLS - what is this supposed to do?
Post by: Admiral MS on November 10, 2012, 06:04:15 pm
The button part of control info is something I still don't get at all...

I've always been kinda fuzzy as to what the exact difference in behaviour between some of those is, but they allow you to control the player via the control info handle (which you can get via ba.getControlInfo()).

Code: [Select]
ba.setControlMode(LUA_FULL_CONTROLS)
ba.getControlInfo().ForwardCruise = 0.2

:(

Code: [Select]
ba.ControlMode = LUA_FULL_CONTROLS
ba.ControlInfo.ForwardCruise = 0.2

Edit: The advantages of this approach are:
  • Reduces documentation creep (only one entry for get/set)
  • Reduces code creep (only one function needed for get/set)
  • Simplifies syntax
  • Removes question of error-checking
  • Generally speaking, you'll need to implement both set and get anyway

These are known as ADE_VIRTVAR, for coders who are adding to the Lua API.

If the operation may reasonably fail, you may have an argument for a function.
I guess you are right but since this was added some time ago it is used by a number of scripts so you can't change it without breaking them.
Title: Re: LUA_FULL_CONTROLS - what is this supposed to do?
Post by: WMCoolmon on November 10, 2012, 06:26:04 pm
:( (http://www.youtube.com/watch?v=G-Vg2YS-sFE)