StateFunction reverser

If you have suggestions on how to make the game better, post here. Preferred is to discuss the ideas until they mature into something worth implementing.

StateFunction reverser

Postby Peti817172M on Tue, 28th Apr 2009, 10:15

Is it possible to use the StateFunction command to changing of the states of the object depends on the state of the reverser handle? For example if I want to make the headligts to switch on, when I switch te reverser to forward.
Peti817172M
 
Posts: 6
Joined: Sun, 5th Apr 2009, 19:54

Re: StateFunction reverser

Postby Emmanuel Vallois on Tue, 28th Apr 2009, 11:49

Yes, use the variable handlereverser. It is equal to -1 when backward, 0 when neutral, and 1 when forward.

Example:
Code: Select all
StateFunction = handlereverser == 1
causes state 1 to be displayed when reverser is forward, state 0 in other cases.

this variable exists (at least in 1.0.4.1, maybe before) but is not documented in the .animated object format documentation, as are
Code: Select all
handlepowernotch
handlebrakenotch
handleairbrakenotch
handleholdbrake
handleemergencybrake
handleconstspeed
mainreservoir
equalizingreservoir
brakepipe
brakecylinder
straightairpipe
atcstate (if ATC is switched on, 0 when not transmitting or between 1 and 11 depending on speed restriction, 12 if ATC is switched off)

timetable (=0 if custom timetable is visible, else -1)
Emmanuel Vallois
 
Posts: 18
Joined: Mon, 6th Apr 2009, 17:40
Location: Nice, France

Re: StateFunction reverser

Postby Peti817172M on Wed, 29th Apr 2009, 19:34

Thanks, it worked. But if I declare an animated object as a state of an other animated object, then is says, that the extension is not supported.
Peti817172M
 
Posts: 6
Joined: Sun, 5th Apr 2009, 19:54

Re: StateFunction reverser

Postby michelle on Mon, 15th Jun 2009, 09:55

May I point out that none of the variables listed by Emmanuel Vallois are official. They may be present internally to achieve some internal functionality, but are not meant to be used externally. Please see http://openbve.trainsimcentral.co.uk/develop/object_animated.html for a full list of functions the animated objects are meant to support.

If there is interest in querying other variables than available, there is a simple solution: Say so, and support might be introduct in a future version.
User avatar
michelle
Site Admin
 
Posts: 1147
Joined: Mon, 14th Apr 2008, 20:36

Re: StateFunction reverser

Postby alvinwong on Tue, 16th Jun 2009, 06:49

There may be a rough way to "guess" the reverser state.

(speedometer>0)-(speedometer<0)
Returns:
1 - Forward
0 - Neutral
-1 - Backward

But it is stupid as it returns 0 when train stopped and return 1 or -1 if reverser suddenly changed to Neutral...
Problems, solutions, problems, solutions...
Tired on these, and trying to make openBVE train Exterior, then...
Problems... ###again### Crazy...
Please visit http://www.hochun.nets.hk/discuz/index.php
User avatar
alvinwong
 
Posts: 240
Joined: Sat, 24th Jan 2009, 05:16
Location: Hong Kong

Re: StateFunction reverser

Postby sladen on Sat, 15th Aug 2009, 00:30

michelle wrote:none of the variables ... are official
Suitable functions were introduced, documented and added in Openbve v1.1.0.0 (released later). For those still interested, they are documented at:The variable "reversernotch" is probably the one that is desired.
sladen
 
Posts: 103
Joined: Wed, 15th Apr 2009, 23:56

Re: StateFunction reverser

Postby alvinwong on Sat, 15th Aug 2009, 03:55

I known that already, and please look at the dates of our posts...
Problems, solutions, problems, solutions...
Tired on these, and trying to make openBVE train Exterior, then...
Problems... ###again### Crazy...
Please visit http://www.hochun.nets.hk/discuz/index.php
User avatar
alvinwong
 
Posts: 240
Joined: Sat, 24th Jan 2009, 05:16
Location: Hong Kong

Re: Followups; for the benefit of all those *interested*

Postby sladen on Wed, 19th Aug 2009, 21:12

alvinwong: it's great to have the confirmation that you know. Others may not know, and it is for their benefit (and particularly for anyone arriving after searching the web) that it is useful to include a followup covering the outcome and a pointer regarding how to use the newly enabled functionality.
sladen
 
Posts: 103
Joined: Wed, 15th Apr 2009, 23:56


Return to Suggestion Corner

Who is online

Users browsing this forum: No registered users and 0 guests