Ringen's RandomPOS - Lua Plugin

BECOME PART OF THE COMMUNITY - Sign up here
  • I've just finished my first Lua Plugin and I'm sharing it here: (Outdated)

    This plugin gives random pan/tilt values to the currently selected fixtures.

    It's quite fun to use and I'm sure it could be useful too.

    There's actually two plugins and this is how to use them:

    -- 1. Set your readout to percent

    -- 2. Make a note of the minimum and maximum pan and tilt values you would like

    -- 3. Run the plugin 'RndPOS Limits' and enter those values

    -- 4. Each time you run 'RandomPOS' you will get a different look

    If you see something you like, store it - it will never come back :)

    More info in the Lua file.

    Tell me what you think !

    - - -

    To anyone not familiar with how to import plugins:

    1. Download and extract the attachment

    2. Save a show to your USB stick to create the grandMA3 folder structure on your USB-stick

    3. Copy the extracted 4 files into the plugin library folder on your USB-stick:

    [driveletter]:\grandMA3\shared\resource\lib_plugins\

    4. Open a Plugin Window on your grandMA3 and Edit an empty plugin slot/tile

    5. Press Import, change drive from Internal to your USB-stick. and select ringens_randompos.xml

    6. Press Export, and Export again, if you want the plugin to reside in your internal drive, so it is easy to import into other showfiles Repeat 5 and 6 for ringens_rndpos_limits.xml

    7. Close Plugin-editor, and call the plugin whenever you need random positions

    (I stole the instructions from a post by Andreas)

    Edited once, last by Ringen (February 18, 2024 at 11:05 AM).

  • Instead of setting the value readout for the user profile to PercentFine, you can also enter the values in percent fine notation without the need to change the readout at all.

    In your case have a look at the PercentFine keyword:

    https://help2.malighting.com/Page/grandMA3/…centfine/en/1.4

    (There is a dedicated keyword available for every readout)

    And you are assuming, that the user that executes this plugin uses user profile 1, which may also fail. I would recommend using the keyword CurrentUserProfile, when you want to stick to changing the readout of the user profile.

    To make it more user-friendly, you could also first grab the current value readout, save it in a variable, set the percent fine readout for running the plugin, and at the end set the former readout instead of switching to the percent readout.

    All your variables are defined as global values so that they can be used by other plugins. As long as I don't need the same variable with its content in a different plugin, I would define them always as local. This can save troubleshooting, if I run into a situation, that 2 plugins use the same variable name...

    In case, that you have only 1 fixture selected, your plugin will apply the randomized values not to the selected fixture, but to the next fixture, as you execute first the next command and then apply the values. I know, that you have to do next first, but maybe a small if-case can save this case.

    And instead of calculating the random value with the range and the minimum value, you can directly get a random value in a defined range:

    Code
    Random_Pan = math.random(minvalue, maxvalue);

    Just my 2 - 5 cents. ;)

  • Looping based on SelectionCount() while subselecting using keyword Next, assumes a singlerow selectiongrid with no gaps or overlaps.

    To ensure that the Next command starts at the first and ends at the last fixture(s) in the selectiongrid, no matter how it is populated, you could use the size of the selectiongrid, rather than the selectioncount, to determine how many times to loop:

    local gridMinValue, gridMaxValue = SelectionComponentX()

    for counter = gridMinValue, gridMaxValue do

  • I've made an update to my plugin based on the feedback: (Outdated)

    Changes:

    Removed the unnecessary change of the Readout and used 'PercentFine'

    Used the size of the selectiongrid to determine how many times to loop

    (This makes the plugin work with MaTricks now!)

    Fixed the problem if only one fixture was selected (one grid position)
    As far as I could see 'counter' was the only variable not set as local (Except those used across plugins)

    I tried the clever code for random between two values but it only returned whole numbers so I reverted to my old version.

    I'm sure it will come handy though!

    Edited once, last by Ringen (February 18, 2024 at 11:04 AM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!