Script - Get closer of Paris Metro ambiance.

General discussions

Moderator: senjer

HexxOP
Posts: 89
Joined: 09 Jan 2019, 13:04

Re: Script - Get closer of Paris Metro ambiance.

Post by HexxOP »

Continuing my little updates to myself :

- Added new sounds (MF67 / MF77 / MP89 / MPL75 and a custom slot).
- Player can now choose the sound independently of the rolling stock.
- Keeping the closing door key doesn't send the sound multiple times anymore.
- Added a little panel to visualize door state from the script point of view. (and to finally understand a word in the drive cab :P )
b_doorState_christmasTree.jpg
b_doorState_christmasTree.jpg (57.56 KiB) Viewed 4751 times
User avatar
Citadis
Posts: 302
Joined: 11 Jul 2017, 12:14
Location: Grenoble, France
Contact:

Re: Script - Get closer of Paris Metro ambiance.

Post by Citadis »

Could you think you can let user choose keys config for next update?
Great work!
Citadis : French Type of trams (yes, i'm french :) )
Sorry for my english but enjoy Metro Sim Beta !
Image
HexxOP
Posts: 89
Joined: 09 Jan 2019, 13:04

Re: Script - Get closer of Paris Metro ambiance.

Post by HexxOP »

Citadis wrote: 18 Dec 2019, 21:08 Could you think you can let user choose keys config for next update?
I had time today, I swiftly updated it.

- Basic Keys can be modified (not very user friendly but it's easily doable if you don't mind reading a bit).
- F4 to revert on terminus (switch right and left side on the Door State Panel).
User avatar
Citadis
Posts: 302
Joined: 11 Jul 2017, 12:14
Location: Grenoble, France
Contact:

Re: Script - Get closer of Paris Metro ambiance.

Post by Citadis »

How do you code that?
Citadis : French Type of trams (yes, i'm french :) )
Sorry for my english but enjoy Metro Sim Beta !
Image
HexxOP
Posts: 89
Joined: 09 Jan 2019, 13:04

Re: Script - Get closer of Paris Metro ambiance.

Post by HexxOP »

Changing keys is not that hard, right now you can only change main one though.
In the directory, there is a file named "scriptHotkeys.txt" :

Code: Select all

/!\ Warning, keys are read from their position along the document, beware to no modify the lines numbers. (I work on a side .exe to auto complete this doc from direct prompts but it's not operational for the moment).
Important rules to keep the document functional :
- Only one hotkey per line (and don't add lines, if anything is not regular, the script won't work (refer to numbers to get line number).
- No blank hotkey, if you don't want to use one, just put in a too complex hotkey (for instance !^+#a , maping the hotkey on a simultanious pres of ALT+CTRL+SHIFT+WIN+A)
- Beware of syntax, if you're unsure of what is the name of a key, please refer to AHK documentation (https://www.autohotkey.com/docs/Hotkeys.htm and https://www.autohotkey.com/docs/KeyList.htm), if a web search doesn't help you out either, feel free to send me a message.
- Some keys are not used for the moment, no need to fill those, I just placed them to avoid needing to move the whole document later.
- Every combination is sent to the game, so beware to avoid choosing a hotkey on another function (do not add ~ to your keys combinations, the main script already contain those).

// Line 9 // Keys you're using in game

11 / CONTROL_TRAIN_POWERUP (throttle key) :
SC033
13 / CONTROL_TRAIN_POWERDONW :
// not used for the moment //
15 / CONTROL_TRAIN_BRAKINGUP (breaking key) :
// not used for the moment //
17 / CONTROL_TRAIN_BRAKINGDOWN :
// not used for the moment //

20 / CONTROL_TRAIN_SWITCHON :
^F4
22 / CONTROL_TRAIN_SWITCHOFF :
+F4

25 / CONTROL_TRAIN_LEVER1UP :
// not used for the moment //
27 / CONTROL_TRAIN_LEVER1DOWN :
// not used for the moment //

30 / CONTROL_TRAIN_DOORSLEFT :
// not used for the moment //
32 / CONTROL_TRAIN_DOORSLEFTOPEN :
Del
34 / CONTROL_TRAIN_DOORSRIGHT :
// not used for the moment //
36 / CONTROL_TRAIN_DOORSRIGHTOPEN :
End
38 / CONTROL_TRAIN_DOORSCLOSE :
d

41 / CONTROL_TRAIN_AICONTROL :
c

44 / CONTROL_TRAIN_BYPASS_ATP :
+^a
46 / CONTROL_TRAIN_BYPASS_DOORS :
+^d

// Line 49 // PA 

51 / Turn On PA :
!a
53 / Turn Off PA :
!z

// Line 56 // Door operation

58 / Selector on "Left side only" position :
t
60 / Selector on "Both left and right sides" position :
u
62 / Selector on "Right side only" position :
o

65 / Open doors
l

68 / Close doors (please note that hitting "CONTROL_TRAIN_DOORSCLOSE" works too for closing doors)
j

// Line 71 // Extra options

73 / Function inactive for the moment.
false
75 / Function inactive for the moment.
false
The document follows the architecture :
[Line number] / [Function action] :
[Key to press]
From line 9 to 48, you need to enter the keys you're using in the game, because when the script needs to close doors for you, it needs to know what key is used by the game to close doors (those right now are the ones I have by default).
You can see them in the simulator when you open the game and go into "options".
From line 49 to 70, you need to enter the keys you desire to press for a certain action.
For instance, you want to press CTRL + T to open doors, just replace the [Key to press] in the .txt :
65 / Open doors
^t
A quick help for basic hotkeys, certain actions are simplified :
CTRL^
ALT!
SHIFT+
WIN#

So if you want a key to be CTRL + ALT + H, you need to enter ^!h.
If you want a key to simply be a letter, you just need to enter this letter in lower case, to trigger something when hitting k, just fill the line with k.
Some keys require more complex naming that you should be able to find here : https://www.autohotkey.com/docs/Hotkeys.htm or here : https://www.autohotkey.com/docs/KeyList.htm, if you struggle with a certain key, you can send me a PM so I can take a look.
If there is an error when you open the script, either a key you replaced is not entered right, either you added/deleted a line in the .txt.

As written in the header of the .txt, I'll probably share a .exe to fulfill the document easily but it's not functional right now.
User avatar
Citadis
Posts: 302
Joined: 11 Jul 2017, 12:14
Location: Grenoble, France
Contact:

Re: Script - Get closer of Paris Metro ambiance.

Post by Citadis »

Ok ! Thanks for explain !
Other question, when or how we can see "Lâcher Boutton" in action without F5 key ?
Citadis : French Type of trams (yes, i'm french :) )
Sorry for my english but enjoy Metro Sim Beta !
Image
HexxOP
Posts: 89
Joined: 09 Jan 2019, 13:04

Re: Script - Get closer of Paris Metro ambiance.

Post by HexxOP »

When you're in PA mode, in real life, you need to keep the door closing button held for 10 seconds after depart, if it's released before, the train automatically send an emergency brake.
The indicator "Lâcher Boutton" lights up when this delay is spent to indicate that you can release the button without the train stoping right away.

I dind't added the 'braking if released too soon' function yet, but if you keep the door closing button held for 10 seconds after departure in PA mode, it should light up until you release it.
User avatar
Citadis
Posts: 302
Joined: 11 Jul 2017, 12:14
Location: Grenoble, France
Contact:

Re: Script - Get closer of Paris Metro ambiance.

Post by Citadis »

HexxOP wrote: 21 Dec 2019, 15:58 I dind't added the 'braking if released too soon' function yet, but if you keep the door closing button held for 10 seconds after departure in PA mode, it should light up until you release it.
I try it and it didn't work. Do you make an error or i did it?
Citadis : French Type of trams (yes, i'm french :) )
Sorry for my english but enjoy Metro Sim Beta !
Image
HexxOP
Posts: 89
Joined: 09 Jan 2019, 13:04

Re: Script - Get closer of Paris Metro ambiance.

Post by HexxOP »

Citadis wrote: 26 Dec 2019, 18:40 Do you make an error or i did it?
Probably coming from your end, I just tried it and the "Lâcher Boutton" lights up well.
You need to be in PA mode (so auto pilot from the scipt, ALT+A by default), at least one side open, and when you close doors, keep the key pressed (J or D by default).
The train should automatically gain speed and turn on AI, the key still pressed, the indicator should lights up, turning off when you release the key.
User avatar
Citadis
Posts: 302
Joined: 11 Jul 2017, 12:14
Location: Grenoble, France
Contact:

Re: Script - Get closer of Paris Metro ambiance.

Post by Citadis »

I understand my mistake I didn't activated PA with Alt+A but with the basic C key for the simulator. Thanks!
Citadis : French Type of trams (yes, i'm french :) )
Sorry for my english but enjoy Metro Sim Beta !
Image
Post Reply