# Creating loop+transition regions using the scripting API?

**URL:** <https://qa.fmod.com/t/creating-loop-transition-regions-using-the-scripting-api/15170>\
**Category:** FMOD Studio\
**Created:** [October 28, 2019, 7:40pm UTC](https://qa.fmod.com/t/creating-loop-transition-regions-using-the-scripting-api/15170 "2019-10-28T19:40:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![usdivad](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/usdivad/32/767_2.png) [@usdivad](https://qa.fmod.com/u/usdivad)\
**Post date:** [October 28, 2019, 7:40pm UTC](https://qa.fmod.com/t/creating-loop-transition-regions-using-the-scripting-api/15170/1 "2019-10-28T19:40:35Z")

</div>

Hi! I’m wondering if there’s a way to create loop regions, transitions, and transition regions using FMOD Studio’s scripting API?

I’m able to successfully create a marker track by using `Event.addMarkerTrack()` and then calling `MarkerTrack.addNamedMarker()`, but so far I haven’t found a way to add loop or transition regions. Is this functionality available / am I missing something in the Scripting API Reference?

Thanks!

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [November 24, 2019, 11:09pm UTC](https://qa.fmod.com/t/creating-loop-transition-regions-using-the-scripting-api/15170/2 "2019-11-24T23:09:43Z")

</div>

Once you have the event in a variable you can add different markers and regions through the `markerTracks` array. The following is for version 2.00.06 and older.

```auto
var event = studio.window.browserCurrent(); // Grab the currently selected event in the browser
var markerTrack = event.markerTracks[0]; // Grab the first marker track
var namedMarker = markerTrack.addNamedMarker("Start", 0); // Creates a named marker called 'Start' at the beginning (0 second) position of the timeline
var region = markerTrack.addRegion(5, 10, project.regionLoopMode.Looping); // Creates a loop region at the 5 second position that is 10 seconds long
var transitionMarker = markerTrack.addTransitionMarker (5, "Start"); // Creates a named marker called 'Start' at the beginning (0 second) position of the timeline

```

---

<div class="post-metadata">

**Author:** ![usdivad](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/usdivad/32/767_2.png) [@usdivad](https://qa.fmod.com/u/usdivad)\
**Post date:** [November 30, 2019, 11:43pm UTC](https://qa.fmod.com/t/creating-loop-transition-regions-using-the-scripting-api/15170/3 "2019-11-30T23:43:47Z")

</div>

Thanks so much for the response Richard! Just updated to 2.00.06 and with a few adjustments the code you provided works perfectly.

(I changed `project.regionLoopMode.Looping` to `studio.project.regionLoopMode.Looping` in line 4, and `"Start"` to `namedMarker` in line 5)

I can see these methods (and more) in the scripting reference now as well – [https://fmod.com/resources/documentation-studio?version=2.0&page=scripting-api-reference-project.html#markertrackaddregionposition-length-name-loopmode](https://fmod.com/resources/documentation-studio?version=2.0&page=scripting-api-reference-project.html#markertrackaddregionposition-length-name-loopmode)

Thanks again for your help!
