How to set the keyboard key for turn on/off lamp in statefunction formula ?
2 posters
Page 1 of 1
How to set the keyboard key for turn on/off lamp in statefunction formula ?
Hello
I wanna know how to set the keyboard key to statefunction formula as toggle to switch between object states?
I want to make a lamp that can turn on and off by clicking those key, if i remember openbve had separate command in controls menu to turn on/off headlight and turn on/off rearlight that has been assigned to some keyboard key that i forgot what keyboard key it assigned.
I have write like this.
[Object]
Position = 0, 0, 10
States = headlampOFF.b3d, headlampON.b3d
Statesfunction = ........
So how to write and assigned it when that key pressed it change the object ?
I wanna know how to set the keyboard key to statefunction formula as toggle to switch between object states?
I want to make a lamp that can turn on and off by clicking those key, if i remember openbve had separate command in controls menu to turn on/off headlight and turn on/off rearlight that has been assigned to some keyboard key that i forgot what keyboard key it assigned.
I have write like this.
[Object]
Position = 0, 0, 10
States = headlampOFF.b3d, headlampON.b3d
Statesfunction = ........
So how to write and assigned it when that key pressed it change the object ?
ADbve- Posts : 72
Join date : 2020-05-14
Re: How to set the keyboard key for turn on/off lamp in statefunction formula ?
Many trains I have seen have reverser-controlled lights, meaning that they are controlled by what direction that the reverser is set. There are some trains which use pluginstates to operate the lights.
Here is an extract of code from a train I have seen. This piece of code controls the on and off states of a set of tail lights. They are left on by default and you can press the button to turn them off and press again to turn them on again. The pluginstates used I suppose are determined by the plugin that you use. I am not an expert with animated coding so I am not 100% sure how it works but I hope it can be helpful
[Object]
States = lights\Class465_Taillights_1.csv
Position = 0, 0, -1.465
StateFunction = if[pluginstate[31] == 1, pluginstate[21] - 1, -1]
Here is an extract of code from a train I have seen. This piece of code controls the on and off states of a set of tail lights. They are left on by default and you can press the button to turn them off and press again to turn them on again. The pluginstates used I suppose are determined by the plugin that you use. I am not an expert with animated coding so I am not 100% sure how it works but I hope it can be helpful
[Object]
States = lights\Class465_Taillights_1.csv
Position = 0, 0, -1.465
StateFunction = if[pluginstate[31] == 1, pluginstate[21] - 1, -1]
SP1900- Posts : 302
Join date : 2017-12-08
Age : 22
Similar topics
» How to write this function formula ??
» keyboard not working
» openBVE Keyboard fail
» Formula One (And other Motorsport)
» Animation formula brainpicking...
» keyboard not working
» openBVE Keyboard fail
» Formula One (And other Motorsport)
» Animation formula brainpicking...
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum