Page 1 of 1
Scripting camera.
Posted: Sun May 12, 2013 7:59 pm
by SammytheShunter
I'm hoping someone can advise me how to write a snippet of lua script that will force the sim to change to cabview? I want to include that in the relevant sections of the AWS script to throw me into the cabview the moment there is an AWS warning, in the same way that the sim forces cabview when entering a tunnel. I do tend to stray from the driver's seat at the wrong moments!
Many thanks
Re: Scripting camera.
Posted: Sun May 12, 2013 8:04 pm
by DaveDewhurst
Somebody will correct me if I'm wrong but I was under the impression you can only control the camera with the scenario script, ie to make the flybys.
Pretty useless when AWS/DSD wirning can occur at any given time
Dave
Re: Scripting camera.
Posted: Sun May 12, 2013 8:33 pm
by nschichan
SammytheShunter wrote:I'm hoping someone can advise me how to write a snippet of lua script that will force the sim to change to cabview? I want to include that in the relevant sections of the AWS script to throw me into the cabview the moment there is an AWS warning, in the same way that the sim forces cabview when entering a tunnel. I do tend to stray from the driver's seat at the wrong moments!
Many thanks
Hi,
You can use this SysCall:
Code: Select all
SysCall("CameraManager:ActivateCamera", "CabCamera", 0)
This works from an engine script. (I use it in an engine script to force the camera to the cab right after loading).
Regards,
Re: Scripting camera.
Posted: Sun May 12, 2013 8:35 pm
by shanyiqua
Before the "toy train" interface came, the AWS and other warings are displayed on screen with a yellow backgrounded exclamation mark icon... but that have been removed, now only the toy train interface have something like that...
There is a better workaround for this:
These constants are need to be included at the start of the script
Code: Select all
MSG_TOP = 1
MSG_VCENTRE = 2
MSG_BOTTOM = 4
MSG_LEFT = 8
MSG_CENTRE = 16
MSG_RIGHT = 32
MSG_SMALL = 0
MSG_REG = 1
MSG_LRG = 2
And this call creates a message box.
Code: Select all
SysCall ( "ScenarioManager:ShowInfoMessageExt", "header text", "message text", 60, MSG_LEFT + MSG_TOP, MSG_SMALL, 0 );
The number 60 is probably the timeout of the message, but the user can close it earier by clicking on X.
Re: Scripting camera.
Posted: Sun May 12, 2013 9:29 pm
by DaveDewhurst
DaveDewhurst wrote:Somebody will correct me if I'm wrong .....
See

Re: Scripting camera.
Posted: Sun May 12, 2013 9:52 pm
by SammytheShunter
Thank you so much, guys. I've just tried both those syscall statements and both work brilliantly. After a long time hunting for one solution I now have two to choose from.
Re: Scripting camera.
Posted: Mon May 13, 2013 8:29 am
by Irishrailguy
This is great! I'll have to use that in my electrostar...
Just out of curiosity, what other system calls are there which work in the engine script? If this particular call is that useful I'd imagine there would be many other useful ones too...
Kev