How do I get the index number of currently displayed slide of a Views Slideshow into the jQuery Cycle's "Before" advanced option? According to this StackExchange Answer, you can access jQuery Cycle options like so:

//on before function
before: function (curr, next, opts) {
    alert(opts.nextSlide + " of " + opts.slideCount);
} 


However, the instructions in the views plugin say, "If one of the options you add uses a function, example fxFn, then you need to only enter what goes inside the function call" so in the Advanced Options before box I only put:

alert(opts.nextSlide + " of " + opts.slideCount);


This code yields the error Uncaught ReferenceError: opts is not defined in the console.

How do I access these jQuery Cycle variables (mainly the index of the current slide) from within my "Before" advanced option code?
Looking at the JS code for views_slideshow_cycle:

case "before":
  var beforeValue = advancedOptions[option];

  beforeValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(beforeValue);
// transition callback (scope set to element to be shown):         
function(currSlideElement, nextSlideElement, options, forwardFlag)
  settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
    pager_before_fn(currSlideElement, nextSlideElement, options);
      eval(beforeValue);
  }
  break;


Your code isn't actually executed within the scope of the before callback, it's executed afterwards. The variable that the module provides is named options rather than opts, hopefully that will resolve to what you need and the change should be as simple as:

alert(options.nextSlide + " of " + options.slideCount);