Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* example TIMERS 32@, 33@, instead of Wait
- by J16D
- */
- /*-------------------- EXAMPLE 1 ----------------------------*/
- const
- path_song1 = "cleo\mp3\MyMusic.MP3"
- end
- {$CLEO}
- 0000:
- /// check if song exist, if not, end_this_thread
- if 8AAB: not file_exists path_song1
- then 0A93: end_custom_thread
- end
- :start // main loop
- wait 0
- if and
- Player.Defined($PLAYER_CHAR)
- 0AB0: key_pressed 9 // tab
- jf @start
- ///goto @action // this "jump" isn't needed, the code anyway will continue with "action" label
- :action
- 0AAC: 0@ = load_audiostream path_song1 // load audio
- 0AAD: set_mp3 0@ perform_action 1 // play audio
- 32@ = 0 // Set the TIMER count in 0, automatically increase its value by 1 {in MilliSeconds}
- // TIMER starts at the same time you play the audio
- :loop
- wait 0
- // check if actor is defined, if not, it means is Dead or Wasted.
- if
- not Player.Defined($PLAYER_CHAR)
- jf @loop1
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- goto @isWastedOrBusted
- :loop1
- // this can be used instead of -wait 3000- which makes delay any action.
- if
- 32@ > 3000 // if has passed 3 seconds, then, continue, else go back to loop
- jf @loop
- // song has finished
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- goto @start
- :isWastedOrBusted
- wait 2500 // delay time, until actor is Not Dead, or Wasted
- goto @start
- /*-------------------- EXAMPLE 2 ----------------------------*/
- const
- path_song1 = "cleo\mp3\MyMusic.MP3"
- end
- {$CLEO}
- 0000:
- /// check if song exist, if not, end_this_thread
- if 8AAB: not file_exists path_song1
- then 0A93: end_custom_thread
- end
- :start // main loop
- wait 0
- if and
- Player.Defined($PLAYER_CHAR)
- 0AB0: key_pressed 9 // tab
- jf @start
- ///goto @action // this "jump" isn't needed, the code anyway will continue with "action" label
- :action
- 0AAC: 0@ = load_audiostream path_song1 // load audio
- 0AAD: set_mp3 0@ perform_action 1 // play audio
- 32@ = 0 // Set the TIMER count in 0, automatically increase its value by 1 {in MilliSeconds}
- // TIMER starts at the same time you play the audio
- :loop
- wait 0
- // check if actor is defined, if not, it means is Dead or Wasted.
- if
- not Player.Defined($PLAYER_CHAR)
- jf @loop1
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- goto @isWastedOrBusted
- :loop1
- if
- 32@ > 1000 // if has passed 1 second, do something; check key press, play second audio, do an animation, etc.
- jf @loop2
- // do something here
- :loop2
- if
- 32@ > 2000 // if has passed 2 seconds, do something; check key press, play second audio, do an animation, etc.
- jf @loop3
- // do something here
- :loop3
- if
- 32@ > 5000 // if has passed 5 seconds, do something; check key press, play second audio, do an animation, etc.
- jf @loop
- // song has finished
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- goto @start
- :isWastedOrBusted
- wait 2500
- goto @start
- /*-------------------- EXAMPLE 3 ----------------------------*/
- const
- path_song1 = "cleo\mp3\MyMusic.MP3"
- end
- {$CLEO}
- 0000:
- /// check if song exist, if not, end_this_thread
- if 8AAB: not file_exists path_song1
- then 0A93: end_custom_thread
- end
- :start // main loop
- wait 0
- if and
- Player.Defined($PLAYER_CHAR)
- 0AB0: key_pressed 9 // tab
- jf @start
- ///goto @action // this "jump" isn't needed, the code anyway will continue with "action" label
- :action
- 0AAC: 0@ = load_audiostream path_song1 // load audio
- 0AAF: 1@ = get_mp3_length 0@ // get length in Seconds
- 1@ *= 1001 // 1@-> in Seconds, there is need to convert the length in MilliSeconds (1@ * 1001)
- 0AAD: set_mp3 0@ perform_action 1 // play audio
- 32@ = 0 // Set the TIMER count in 0, automatically increase its value by 1 {in MilliSeconds}
- // TIMER starts at the same time you play the audio
- :loop
- wait 0
- // check if actor is defined, if not, it means is Dead or Wasted.
- if
- not Player.Defined($PLAYER_CHAR)
- jf @loop1
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- goto @isWastedOrBusted
- :loop1
- // check if counter of Timer is bigger than Audio Duration,
- // if so, song has finished, No longer needed, release the song.
- if
- 001D: 32@ > 1@ // (int)
- jf @loop
- 0AAD: set_mp3 0@ perform_action 0
- 0AAE: release_mp3 0@
- goto @start
- :isWastedOrBusted
- wait 2500
- goto @start
- /*-------------------- EXAMPLE 4 (2 songs) ----------------------------*/
- const
- path_song1 = "cleo\mp3\MyMusic.MP3"
- path_song2 = "cleo\mp3\MyMusic2.MP3"
- end
- {$CLEO}
- 0000:
- /// check if/or any song exist, if not, end_this_thread
- if or
- 8AAB: not file_exists path_song1
- 8AAB: not file_exists path_song2
- then 0A93: end_custom_thread
- end
- :start // main loop
- wait 0
- if and
- Player.Defined($PLAYER_CHAR)
- 0AB0: key_pressed 9 // tab
- jf @start
- ///goto @action // this "jump" isn't needed, the code anyway will continue with "action" label
- :action
- 0AAC: 0@ = load_audiostream path_song1 // load FIRST audio
- 0AAD: set_mp3 0@ perform_action 1 // play FIRST audio
- 32@ = 0 // Set the TIMER count in 0, automatically increase its value by 1 {in MilliSeconds}
- // TIMER starts at the same time you play the audio
- :loop
- wait 0
- // check if actor is defined, if not, it means is Dead or Wasted.
- if
- not Player.Defined($PLAYER_CHAR)
- jf @loop1
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- goto @isWastedOrBusted
- :loop1
- // this makes the game waits 1 second to continue
- if
- 32@ > 1000 // if has passed 1 second;
- jf @loop
- // LOAD and play SECOND audio, simultaneously.
- 0AAC: 5@ = load_audiostream path_song2 // load SECOND audio
- 0AAD: set_mp3 5@ perform_action 1 // play SECOND audio
- /// you can RESET the timer -here-, to start the counter Again.
- /// to play a THIRD song, and so on.
- /// Reset timer; 32@ = 0
- /*
- MORE CODE
- */
- // AUDIO is no longer needed.
- 0AAD: set_mp3 0@ perform_action 0 // stop song
- 0AAD: set_mp3 5@ perform_action 0 // stop song
- 0AAE: release_mp3 0@ // release song
- 0AAE: release_mp3 5@ // release song
- goto @start
- :isWastedOrBusted
- wait 2500
- goto @start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement