More questions on LUA scripting

Announcements and Discussion about Dick Cowen's BritKits Development

More questions on LUA scripting

Unread postby KCJones » Mon Dec 17, 2012 3:09 pm

I am in the process of updating my GP9s and have been asked to produce one with the headlight assemblie as a child. To enable other, more complicated light arrays to be used (eg. SP) Easy to model BUT when it comes to lighting !!!@@@**^^!!!!!!.

The question is - is there any way of indicating, to the driven loco, where extra engines are in the consist. I can signal that a loco is not the main one and which way it is pointing ( at least if it is moving).

I have tried sending one way consist messages which can turn on the required lights but how can I get a message back to turn off the lights on the main loco.

Any ideas other than the obvious one - make the fancy light array part of the main model then the core sim will take care of it.

I could approach it from a different direction and convert the light switch to a 5 position rather than a 3 position switch and use 4 an 5 for the second loco lights, but that would aso affect any other locos in the consist!!!

**!!bang!!** !*don-know!*
Knit one, purl one, knit two together. Mumble mumble mumble.

Dick
User avatar
KCJones
 
Posts: 872
Joined: Fri Feb 13, 2009 4:05 pm
Location: UK Somewhere between Hereford and Shrewsbury

Re: More questions on LUA scripting

Unread postby PapaXpress » Mon Dec 17, 2012 5:01 pm

err... Mike and I already fixed your F series LUAs to do this. *!embar*!

download the latest FT repaint and you can see what we have done.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: More questions on LUA scripting

Unread postby MadMike1024 » Mon Dec 17, 2012 5:30 pm

PapaXpress wrote:err... Mike and I already fixed your F series LUAs to do this. *!embar*!

download the latest FT repaint and you can see what we have done.


The best example is 'MadMike1024-NP_FT' it has a child headlight that isn't yours.
MadMike1024
Global Mod
 
Posts: 1730
Joined: Fri Jul 30, 2010 8:11 pm
Location: Vancouver, WA

Re: More questions on LUA scripting

Unread postby KCJones » Mon Dec 17, 2012 5:36 pm

Hmm should of thought of that!!!!! Thanks
User avatar
KCJones
 
Posts: 872
Joined: Fri Feb 13, 2009 4:05 pm
Location: UK Somewhere between Hereford and Shrewsbury

Re: More questions on LUA scripting

Unread postby KCJones » Tue Dec 18, 2012 1:41 am

Fiendishly clever and very useful, BUT the problem is that the GPs have lights at both ends.

For example if you have two locos nose to tail and the front loco is the main one and I want to turn the rear lights on, how can I get the main loco's rear ligh NOT to turn on. (BUT if the main loco is uncoupled the rear lights WILL work) An interesting problem

There needs to be some sort of feedback to tell the main loco if the extra loco is to the front or back as the core code can.

MSTS could do this.

Dick
User avatar
KCJones
 
Posts: 872
Joined: Fri Feb 13, 2009 4:05 pm
Location: UK Somewhere between Hereford and Shrewsbury

Re: More questions on LUA scripting

Unread postby MadMike1024 » Tue Dec 18, 2012 2:17 am

KCJones wrote:Fiendishly clever and very useful, BUT the problem is that the GPs have lights at both ends.

For example if you have two locos nose to tail and the front loco is the main one and I want to turn the rear lights on, how can I get the main loco's rear ligh NOT to turn on. (BUT if the main loco is uncoupled the rear lights WILL work) An interesting problem

There needs to be some sort of feedback to tell the main loco if the extra loco is to the front or back as the core code can.

MSTS could do this.

Dick


No to let out any cats, but we are working on Michael's SD7 and I see the same issue here. Oddly, if the Brindley GP38 (my test loco) has the key, all works fine.
MadMike1024
Global Mod
 
Posts: 1730
Joined: Fri Jul 30, 2010 8:11 pm
Location: Vancouver, WA

Re: More questions on LUA scripting

Unread postby BNSFdude » Tue Dec 18, 2012 2:55 am

One could script it to make use of a proper MU Light control switch having Short Hood Lead, Long Hood Lead,Middle Short hood trail, Long Hood trail. Then you have to set up each locomotive in the consist to have it set properly manually.
Anthony Wood
Audio Engineer - Searchlight Simulations
User avatar
BNSFdude
 
Posts: 2721
Joined: Tue Nov 29, 2011 1:46 am

Re: More questions on LUA scripting

Unread postby PapaXpress » Tue Dec 18, 2012 10:21 am

BNSF the problem is not what to name the lights but, is to determine which way is front. I have not heard of a way to do this in the LUA yet.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: More questions on LUA scripting

Unread postby BNSFdude » Tue Dec 18, 2012 10:50 am

Like I said, use a switch to determine front like a real MU Light switch.
Anthony Wood
Audio Engineer - Searchlight Simulations
User avatar
BNSFdude
 
Posts: 2721
Joined: Tue Nov 29, 2011 1:46 am

Re: More questions on LUA scripting

Unread postby PapaXpress » Tue Dec 18, 2012 11:47 am

The switch is where the driver is. What controls the lights in the rest of the lash up is done through the LUA by sending messages through the consist. When the engine gets the message it reads it as "turn on fwd/bwd lights" but the engine may be flipped. I am saying that I need to find a way in the LUA to determine this.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: More questions on LUA scripting

Unread postby MadMike1024 » Tue Dec 18, 2012 3:03 pm

OK, what differentiates the .bin created lightglows from the Children? It appears that as a part of the body/engine combo the system treats them specially.

Could you not create a lightglow for the main headlight that consists of a stacked double glow with Pyle light spacing, making it part of the main body, and then make it relocatable to the vertical location needed ( it will always be centered)? That way, the primary light (even if a child model) would act as any light that was body mounted.

If this could be done, then all the rest of the lights e.g. E-stop could be .lua controlled
MadMike1024
Global Mod
 
Posts: 1730
Joined: Fri Jul 30, 2010 8:11 pm
Location: Vancouver, WA

Re: More questions on LUA scripting

Unread postby PapaXpress » Tue Dec 18, 2012 4:30 pm

That won't work with all the variations we are making Mike.

I haven't given up yet. I will need this to work for the three engines I have as well, so its in my best interest to solve this problem.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: More questions on LUA scripting

Unread postby KCJones » Wed Dec 19, 2012 1:34 am

You can tell which way the slave engine is pointing by checking it's speed +ve for nose first and -ve for tail first. The consist has to be moving though, even ever so slightly. I used that in my first experimentation on this issue. Does that help any? Perhaps that combined with the consist message direction and some sort of lock will work.

As a progress report on the GP upgrade. - I have now made my own set of sounds, The shapes and textures are done. I am now starting the wet windows for the cabs.

Progress pictures when I have time!!!!! !*YAAA*!

Dick
User avatar
KCJones
 
Posts: 872
Joined: Fri Feb 13, 2009 4:05 pm
Location: UK Somewhere between Hereford and Shrewsbury

Re: More questions on LUA scripting

Unread postby PapaXpress » Wed Dec 19, 2012 2:07 am

I think you are on to something. The problem I can see is that the lights will be off (or unset) until the engine starts to move.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: More questions on LUA scripting

Unread postby KCJones » Wed Dec 19, 2012 2:26 am

True. I set the trigger speed to 0.001 so the movement is very slight. Even moving the reverser leaver appeared to have an affect.
User avatar
KCJones
 
Posts: 872
Joined: Fri Feb 13, 2009 4:05 pm
Location: UK Somewhere between Hereford and Shrewsbury


Return to BritKits

Who is online

Users browsing this forum: No registered users and 1 guest

cron