Jump to content
Sign in to follow this  
Winters

Trouble with a car radio

Recommended Posts

Hi All,

well i have this cool CD Player i am working on and i as i was making the script for it i thought it would be cool to add an option that would allow you to play the next track on a disc.

Heres what i have so far:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playmusic "Reptilia"

hint "Track 1"

~221

playmusic "Explain"

hint "Track 2"

~204

playmusic "1251"

hint "Track 3"

~131

playmusic "Shot"

hint "Track 4"

~314

exit

As you see this plays each track in order but a nice additional touch would be to make it work like an actual cd player and allow you to skip tracks.

Thanks for the help biggrin_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; just activate it with a trigger with On Activation [] exec "musicplay.sqs"

; of course if you call this script musicplay.sqs

; notice the line I >= 30 it will play each track for 30 seconds

; change this number according to the duration of the music

; create a radio call on repeatedly with On Activation changetrack=true

; this way if you dont wait for the end of the track you can change it

; by this radio call

changetrack=false

#cdmusic1

changetrack=false

I=0

hint "Track 1"

playmusic "7thLifeless"

#loopmusic1

~1

I=I+1

?(changetrack) : goto "cdmusic2"

? I >= 30 : goto "cdmusic2"

goto "loopmusic1"

#cdmusic2

changetrack=false

I=0

hint "Track 2"

playmusic "7thDecide"

#loopmusic2

~1

I=I+1

?(changetrack) : goto "cdmusic3"

? I >= 30 : goto "cdmusic3"

goto "loopmusic2"

#cdmusic3

changetrack=false

I=0

hint "Track 3"

playmusic "7thIAmGonaFly"

#loopmusic3

~1

I=I+1

?(changetrack) : goto "cdmusic1"

? I >= 30 : goto "end"

goto "loopmusic3"

hint "music stop"

exit

those are built-in OFP musics , just change them to your choices

With some more work you can use addactions to make them activated by action menu instead of radio call.

Share this post


Link to post
Share on other sites

Thanks, after taking a second glance it looks like i can make this work.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×