waterblast

MA2 Effect Inspector

Jun 17th, 2024 (edited)
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.53 KB | Source Code | 0 0
  1. -- Plugin: effect Inspector
  2. -- Description: Lists effect lines and their attributes with user input
  3. -- Author: Marvin Franssen
  4. -- Date: 2024-06-17
  5.  
  6. function main()
  7.     -- Prompt the user to enter the effect number
  8.     local effectNumber = gma.textinput("Enter Effect Number", "1")
  9.     if effectNumber == nil then
  10.         gma.gui.confirm("Error", "No effect number entered. Exiting plugin.")
  11.         return
  12.     end
  13.  
  14.     -- Convert input to a number
  15.     effectNumber = tonumber(effectNumber)
  16.     if effectNumber == nil then
  17.         gma.gui.confirm("Error", "Invalid effect number. Exiting plugin.")
  18.         return
  19.     end
  20.  
  21.     -- Get the effect handle
  22.     local effectHandle = gma.show.getobj.handle("Effect " .. effectNumber)
  23.     if effectHandle == nil then
  24.         gma.gui.confirm("Error", "Effect " .. effectNumber .. " not found.")
  25.         return
  26.     end
  27.  
  28.     -- Get the effect name
  29.     local effectName = gma.show.getobj.name(effectHandle)
  30.     if effectName == nil then
  31.         gma.gui.confirm("Error", "Unable to retrieve effect name.")
  32.         return
  33.     end
  34.  
  35.     -- Prepare the results message
  36.     local message = "Effect Name: " .. effectName .. "\n\n"
  37.  
  38.     -- Iterate through the effect lines
  39.     local lineIndex = 1
  40.     local lineHandle = gma.show.getobj.child(effectHandle, lineIndex)
  41.     while lineHandle do
  42.         -- Read line attributes
  43.         local form = gma.show.property.get(lineHandle, "form")
  44.         local speed = gma.show.property.get(lineHandle, "speed")
  45.         local speedgroup = gma.show.property.get(lineHandle, "speedgroup")
  46.         local groups = gma.show.property.get(lineHandle, "groups")
  47.         local blocks = gma.show.property.get(lineHandle, "blocks")
  48.         local wings = gma.show.property.get(lineHandle, "wings")
  49.  
  50.         -- Append line details to message
  51.         message = message .. "Line " .. lineIndex .. ":\n"
  52.         message = message .. "Form: " .. (form or "N/A") .. "\n"
  53.         message = message .. "Speed: " .. (speed or "N/A") .. "\n"
  54.         message = message .. "Speed Group: " .. (speedgroup or "N/A") .. "\n"
  55.         message = message .. "Groups: " .. (groups or "N/A") .. "\n"
  56.         message = message .. "Blocks: " .. (blocks or "N/A") .. "\n"
  57.         message = message .. "Wings: " .. (wings or "N/A") .. "\n\n"
  58.  
  59.         -- Move to next line
  60.         lineIndex = lineIndex + 1
  61.         lineHandle = gma.show.getobj.child(effectHandle, lineIndex)
  62.     end
  63.  
  64.     -- Show the results in a dialog box
  65.     gma.gui.confirm("Effect Parameters", message)
  66. end
  67.  
  68. return main
  69.  
Advertisement
Add Comment
Please, Sign In to add comment