Scripting: Signal states and speed.

General discussion about Train Simulator, your thoughts, questions, news and views!

Moderator: Moderators

Locked
DavidVI
Well Established Forum Member
Posts: 897
Joined: Fri Oct 29, 2010 10:30 pm

Scripting: Signal states and speed.

Post by DavidVI »

I've been adding a few scripts to an activity to display instructions with pictures. Been enjoying trying to figure out things through trial and error and looking at other scripts.

What I really want to do is what RSC went on about when hyping TS2014, they claimed you could change a signal state via script in an activity. Does anyone know the commands for this?

Also I have seen this in a few scripts
"gTrainSpeedLimitMPH"

Is this to set a limit to the player train? I tried putting it in my scenarioscript.lua and got no noticable result.

gTrainSpeedLimitMPH = 61
gTrainSpeedLimitMPHDisplay = 60

I thought this would mean it would tell you off for speeding over 60mph.. But appears not!

Any help appreiciated..
again, where is the documentation on all this?!?!?!

David
gptech
Very Active Forum Member
Posts: 19585
Joined: Fri Oct 10, 2008 5:48 pm
Location: Wakefield, West Yorkshire

Re: Scripting: Signal states and speed.

Post by gptech »

DavidVI wrote:again, where is the documentation on all this?!?!?!
I think you just wrote it... :wink:
User avatar
RobertM
Very Active Forum Member
Posts: 5907
Joined: Thu Aug 12, 2004 5:28 pm
Location: Centre of my own universe, where its scary

Re: Scripting: Signal states and speed.

Post by RobertM »

I have only just figured out how to put cameras in the start of scenarios and how to do the pop up messages and pictures. Best way I found was too just copy an already done scenario script, so find a scenario that does the scripted signals and copy that. Dunno any scenarios that do this though :-?
Cheers, Robert :)
Fireman at the Lakeside & Haverthwaite Steam Railway.
Second Valve simulation - https://www.facebook.com/secondvalve?ref=hl
User avatar
1S811985
Well Established Forum Member
Posts: 655
Joined: Wed Oct 20, 2010 8:03 pm
Location: Kelvin Valley

Re: Scripting: Signal states and speed.

Post by 1S811985 »

Documentation? Uh, we aint got no documentation. We don't need no stinking documentation!

1S81

With apologies to B. Traven

ps. It's incredibly frustrating to consider just what could be achieved scenario wise were the wider community to be given access to full and proper documentation. As things stand even the bundled scenarios make little use of the potential features that scripting offers.
I know what gold does to men's souls.
DavidVI
Well Established Forum Member
Posts: 897
Joined: Fri Oct 29, 2010 10:30 pm

Re: Scripting: Signal states and speed.

Post by DavidVI »

RobertM wrote:I have only just figured out how to put cameras in the start of scenarios and how to do the pop up messages and pictures. Best way I found was too just copy an already done scenario script, so find a scenario that does the scripted signals and copy that. Dunno any scenarios that do this though :-?
That's how I learnt what I have so far.. but as 1S811985 says, the scenarios with scripting don't really use any of the new features yet.. So it's near impossible to know what does what.. :(
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Scripting: Signal states and speed.

Post by AndiS »

The interesting bits are the lines containing Call. Those are where the information is obtained from the system (or the system is made to do something). So you need to search for gTrainSpeedLimitMPH wherever you found it and look for lines starting with
gTrainSpeedLimitMPH = ...

I would be quite interested in real communication between scenario scripts and signals or trains. However, when I read the announcement, I assumed that the scenario specific signalling will be some guy waving some flag while the signals do what they always did. It would be great if a scenario-specific trigger could influence signals. You could switch between shunting and running aspects once the shunting has been completed, at last.
User avatar
GavNormandale
Very Active Forum Member
Posts: 1028
Joined: Wed Oct 10, 2007 6:48 pm
Location: Gateshead

Re: Scripting: Signal states and speed.

Post by GavNormandale »

Hi, the 'Western Lines of Scotland' scenario 'Oil See You Later' has speed restrictions on the player train, it doesn't alter the max speed in the HUD but if you exceed the imposed limit, a window opens with a message from the fireman stating that you are over the limit.

Its doesn't affect the outcome of the scenario though, even though I did exceed the limit a few times I still passed the scenario!

Gav
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Scripting: Signal states and speed.

Post by AndiS »

This is the type of interaction I imagined. You can achieve such things easily without interfering with the game proper. You just monitor something and show an alert. Neither the scenario evaluation nor the signalling or the AI or anything else pertaining to the game core is touched by it.

I don't mean that too negative, just pragmatic. I think of it as a cost-efficient means to provide interest and variety in the player's perception of the scenarios without inducing significant software development cost by digging into the code of the original game to plug in the new feature without side effects.
DavidVI
Well Established Forum Member
Posts: 897
Joined: Fri Oct 29, 2010 10:30 pm

Re: Scripting: Signal states and speed.

Post by DavidVI »

One of the problems I was hoping to get around with scripting is the double signals on the GEML route. The player has to pull up extremely close to a signal, almost so you can't see the light from the cab, just so the aspect changes due to their being another signal underground. I want to be able to set the signal that doesn't change until you're ontop of it... I suppose this must be impossible at present without modifying the route.
GavNormandale wrote:Hi, the 'Western Lines of Scotland' scenario 'Oil See You Later' has speed restrictions on the player train, it doesn't alter the max speed in the HUD but if you exceed the imposed limit, a window opens with a message from the fireman stating that you are over the limit.

Its doesn't affect the outcome of the scenario though, even though I did exceed the limit a few times I still passed the scenario!

Gav
Ah that's where I got that script from. I was hoping it would affect the career activity I am working on which needs a max speed of 60mph. I really dislike how you can't set a limit for the player train, letting the player get away with going 100mph when pulling a 60mph RHTT :p.

I guess it's a feature that doesn't exist yet.
DavidVI
Well Established Forum Member
Posts: 897
Joined: Fri Oct 29, 2010 10:30 pm

Re: Scripting: Signal states and speed.

Post by DavidVI »

Well I can't quite believe it.

I only asked for which commands would call the signals..
"Dear Sir,

Thank you for contacting the Railsimulator.com customer support, your inquiry has been logged with a member of our dedicated customer support team.

Your enquiry is well beyond the remit of support, I suggest that you contact a university that specialises in tuition for lua scripting, and programming education."
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Scripting: Signal states and speed.

Post by AndiS »

DavidVI wrote:I really dislike how you can't set a limit for the player train, letting the player get away with going 100mph when pulling a 60mph RHTT :p.
I would have thought that wagons had their own speed limit but I must have dreamt that up.
You are right about the need for scenario specific speed limits anyway since modern wagons have different speed limits depending on being loaded or not.
DavidVI wrote:Well I can't quite believe it.

I only asked for which commands would call the signals..
Your enquiry is well beyond the remit of support, I suggest that you contact a university that specialises in tuition for lua scripting, and programming education."
At least you can be proud to do university level reasoning here. At least from the perspective of the RSC support staff.
DavidVI
Well Established Forum Member
Posts: 897
Joined: Fri Oct 29, 2010 10:30 pm

Re: Scripting: Signal states and speed.

Post by DavidVI »

AndiS wrote:
DavidVI wrote:I really dislike how you can't set a limit for the player train, letting the player get away with going 100mph when pulling a 60mph RHTT :p.
I would have thought that wagons had their own speed limit but I must have dreamt that up.
You are right about the need for scenario specific speed limits anyway since modern wagons have different speed limits depending on being loaded or not.
DavidVI wrote:Well I can't quite believe it.

I only asked for which commands would call the signals..
Your enquiry is well beyond the remit of support, I suggest that you contact a university that specialises in tuition for lua scripting, and programming education."
At least you can be proud to do university level reasoning here. At least from the perspective of the RSC support staff.
Seems rather ridiculous to market TS2014 as having these features and offering no documentation for them.. Then when you ask for a bit of help they tell you to go to university!

From what I remember they claimed you could do LUA in game and it would be easy to understand.. nevermind I guess.
User avatar
1S811985
Well Established Forum Member
Posts: 655
Joined: Wed Oct 20, 2010 8:03 pm
Location: Kelvin Valley

Re: Scripting: Signal states and speed.

Post by 1S811985 »

DavidVI wrote:Well I can't quite believe it.

I only asked for which commands would call the signals..
Thank you for contacting the Railsimulator.com customer support, your inquiry has been logged with a member of our dedicated customer support team.

Your enquiry is well beyond the remit of support, I suggest that you contact a university that specialises in tuition for lua scripting, and programming education."


Seems rather ridiculous to market TS2014 as having these features and offering no documentation for them.. Then when you ask for a bit of help they tell you to go to university!

From what I remember they claimed you could do LUA in game and it would be easy to understand.. nevermind I guess.
A truly gobsmacking response. I do wonder if this might not be case of the first-responder overstepping the mark a little (it's happened before) as the reply seems a little confused. Why bother logging it with the support team if its well beyond their remit?

That said, it's not exactly surprising as RSC do appear to be documentation averse, as evidenced by their point-blank refusal to update even the basic creator manuals. An embittered old cynic might wonder if the full panapoly of creator tools isn't being kept in-house as a sweetener for those signing up to the partnership programme. A really embittered older cynic might go so far as to suggest that the scripting is beyond the talents of the hired help at RSC.

I should add that I'm not endorsing such world-weary views but until a better explanation is forthcoming...

1S81
I know what gold does to men's souls.
User avatar
rfletcher72
Very Active Forum Member
Posts: 8643
Joined: Sat Apr 28, 2007 10:59 pm
Location: The Steel City
Contact:

Re: Scripting: Signal states and speed.

Post by rfletcher72 »

Did'nt RSC mention they would be providing a tutorial on lua scripting in scenarios when the feature was announced?

Agree with many sentiments above, especially something along the lines of the 'reach speed' option that was in MSTS would be great :)
Richard
User avatar
bristolian
Very Active Forum Member
Posts: 1695
Joined: Thu Dec 18, 2003 10:02 pm
Location: St Ives, Cambs (Formerly from Bristol)
Contact:

Re: Scripting: Signal states and speed.

Post by bristolian »

Evening everyone,

If this is to be taken at Face Value, that is a tremendous own-goal by RSC, which quite simply has no precedent anywhere. I'm gobsmacked. It beggars belief...
Virtute Et Industrial!
Locked

Return to “[TS] General Discussion”