ehem. OMSI - Forum
Würden Sie gerne auf diese Nachricht reagieren? Erstellen Sie einen Account in wenigen Klicks oder loggen Sie sich ein, um fortzufahren.
ehem. OMSI - Forum

Dieses Forum wurde geschlossen. Das neue Forum befindet sich auf www.omnibussimulator.de/forum !
 
StartseiteStartseite  Neueste BilderNeueste Bilder  SuchenSuchen  AnmeldenAnmelden  LoginLogin  

 

 Key Button Scripting

Nach unten 
3 verfasser
AutorNachricht
antmc




Anzahl der Beiträge : 15
Anmeldedatum : 31.03.11

Key Button Scripting  Empty
BeitragThema: Key Button Scripting    Key Button Scripting  Icon_minitimeDi 17 Mai - 21:40

I've found some sounds that i want to add to key buttons such as termination diversion E.T.C but i don't know how or where to script them please can someone help me as its for my modification due for release soon ive completed door mods so far Smile please help Smile

Anyone that helps wiill be mentioned in the Read me files Smile
Nach oben Nach unten
Thiago

Thiago


Anzahl der Beiträge : 252
Anmeldedatum : 18.02.11
Ort : Brazil

Key Button Scripting  Empty
BeitragThema: Re: Key Button Scripting    Key Button Scripting  Icon_minitimeDo 19 Mai - 4:32

Hey mate, try to do the following (it worked for me):

0) Copy your sound file to \m-r-software\Omsi\Vehicles\MAN_SD202\Sound\ (I'm using SD202 D92 for this example)
1) Open keyboard.cfg located at \m-r-software\Omsi\Inputs

2) Add an entry with a command name like that:
Code:
[entry]
key_mycustomsound
7
0

* I chose 'key_mycustomsound' as the name of the keyboard event.

3) Open sound_D92.cfg located at \m-r-software\Omsi\Vehicles\MAN_SD202\Sound\ (Again, I'm using SD202 D92 for this example)

4) Add an entry as shown below:

Code:
[sound]
yoursoundfile.wav
0.5

[3d]
-0.8
5.289
1.519
0.7


[trigger]
ev_mycustomsound


Please note that here we have a 3d entry. If you want, you can change this coordinates to set where in 3D-space this sound will "play", relative to your bus model. In this case, these are the coordinates for the bus cockpit. That 0.5 under yoursoundfile.wav is the volume, I presume. The name ev_mycustomsound is a name I gave to our EVENT.

5) Now we need to insert some lines to the script. Open the Script folder. I'm going to use the script Cockpit.osc. Open it on Notepad.

6) We will assign the TRIGGER key_mycustomsound to the EVENT ev_mycustomsound, which will be triggered. I prefer to add a line at the begining of the script.

Add an entry like this:

Code:
{trigger:key_mycustomsound}
   (T.L.ev_mycustomsound)
{end}

T.L.ev_mycustomsound is loading the EVENT ev_mycustomsound, which has been linked to our sound file in Sound_D92.cfg

7) Save these files, open OMSI and go to the Keyboard (or Joystick) settings and search for our new created event. Assign it to a key of your taste, open D92 and make a test. It worked here for me. I don't know how to do this in less steps, but what matters is that works Very Happy
Obviously this can be improved, for example, to only make the sound play when the bus electrical supply is on. OMSI scripting universe is great!

Hope I have helped you.
Regards,
Thiago
Nach oben Nach unten
http://www.tooo.com.br/omsi
antmc




Anzahl der Beiträge : 15
Anmeldedatum : 31.03.11

Key Button Scripting  Empty
BeitragThema: Re: Key Button Scripting    Key Button Scripting  Icon_minitimeDo 19 Mai - 10:46

Thiago Very Happy thank You Mate it worked can finally complete my modification Smile
Nach oben Nach unten
nik57




Anzahl der Beiträge : 15
Anmeldedatum : 09.05.11

Key Button Scripting  Empty
BeitragThema: Re: Key Button Scripting    Key Button Scripting  Icon_minitimeSo 29 Mai - 6:03

Hello!
As with the keyboard, I can raise and lower the sun-protection curtain. Can someone tell me how to do this?
Sincerely, Nikolay.
Nach oben Nach unten
Gesponserte Inhalte





Key Button Scripting  Empty
BeitragThema: Re: Key Button Scripting    Key Button Scripting  Icon_minitime

Nach oben Nach unten
 
Key Button Scripting
Nach oben 
Seite 1 von 1
 Ähnliche Themen
-
» Turbocharger scripting help,
» Scripting Operators
» To those creating buses and scripting their vehicles...
» a PAUSE button
» Door button

Befugnisse in diesem ForumSie können in diesem Forum nicht antworten
ehem. OMSI - Forum :: OMSI-Design (english) :: Script programming-
Gehe zu: