Page 1 of 1

Is there a way to make the horn trigger the bell?

Unread postPosted: Sat May 31, 2014 1:56 pm
by Scott
Since I got Canadian Mountain Passes I noticed when i sounded the horn the bell rang on its own, is there a way to make the horn trigger the bell?

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sat May 31, 2014 2:00 pm
by buzz456
Scott wrote:Since I got Canadian Mountain Passes I noticed when i sounded the horn the bell rang on its own, is there a way to make the horn trigger the bell?


Huh? !*roll-laugh*! You said that's what it is doing?

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sat May 31, 2014 3:19 pm
by Antwerp
Allow me to fix his question to make it more understandable.

"Since I got Canadian Mountain Passes. I noticed when I sounded the horn, the bell rang on its own. Is there a way to make the horn trigger the bell for other locomotives?"

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sat May 31, 2014 10:28 pm
by Chacal
Yes, with lua scripting.

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sun Jun 01, 2014 12:17 am
by Scott
How do you do lua scripting?

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sun Jun 01, 2014 1:03 am
by Chacal
That's a big question that I can't answer in a post.
Like asking "How do I do brain surgery?".

In short, scripts let you program what happens when a player interacts with the controls of an engine.
The engine blueprint lists the control values and links them to actions from the player (e.g. pulling the horn lever).
Default results are already built-in (e.g. sounding the horn), but you can add extra results (e.g. sounding the bell) by writing a script.

Have a look at the developer docs in the RWA file library. There is one about signals.
It is the basic reference for scripting in Railworks.

Then find some lua scripts in your Railworks engines, for example the Centipede or the recently published Alco RS1 for the RW&A route.
Open them in your favorite text editor and compare them with the docs, and read the comments in the scripts.
You will also find posts about this topic here at RWA, on the UKTrainsim forum and in various tutorials found with a Google search.

Here are a few examples of engine lua scripts:
Assets\Britkits\Alco\RailVehicles\Diesel\RS3\Default\Engine\RS3_EngineScript.lua
Assets\GreatNortherner\EMD-SD7-9\RailVehicles\Engines\SD7\Simulation\sd7 simulation.lua
Assets\Kuju\RailSimulatorUS\RailVehicles\Diesel\ES44AC\Black\Engine\ES44ACEngineScript.lua
Assets\Kuju\RailSimulatorUS\RailVehicles\Diesel\F7\Default\UPRR\F7A_EngineScript.lua
Assets\Kuju\RailSimulatorUS\RailVehicles\Diesel\SD40-2\Black\Engine\SD40-2EngineScript.lua

You can find all of them by opening a command window in your railworks\assets folder and typing this command:
dir /B /W /S *.lua > lua.txt

Then open lua.txt and you'll see a list of all your scripts. Several hundreds of them.

Hope this helps.
Have fun.

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sun Jun 01, 2014 7:39 am
by Scott
Thanks for the answer I'll look in to it.

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sun Jun 01, 2014 3:18 pm
by HankySpanky
I thought that I read somewhere that you can delete *.lua files because they aren't necessary and just take up space.
!*don-know!*

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sun Jun 01, 2014 3:23 pm
by Chacal
You can delete the .lua files if you have the corresponding .out files, which are the compiled sripts.
If you don't, then deleting the lua files will result in your engines not working correctly.
Also by deleting the lua files you won't be able to see the source code anymore and learn about scripting.

Re: Is there a way to make the horn trigger the bell?

Unread postPosted: Sun Jun 01, 2014 7:08 pm
by Scott
It's a shame you can't see the out files to see how it was done.