Simplify my trigger!

edited May 2017 in Mechanic's Corner
Rather than try and fail to write some kind of narrative about what I'm trying to accomplish, I thought I'd just post the code for one of the triggers and let you go from there.

Quick background: in Astrology, you can cast spheres that have different modifiers/qualities based on the current alignment of the stars. There are seven modifiers (aspects) and seven planetary bodies. When you STARGAZE a particular sign, it returns that sign's alignment, effectively giving you a breakdown of how effective (or ineffective) the sphere will be.

Here's my trigger line for one of the twelve signs: 
^(.*) in (.*) is (.*) Volcano.$
And the code that is executed:
planet=matches[2]
aspect=matches[4]
selectCurrentLine()
replace("")
cecho("<span>VOLCANO: ")
if (planet=="Sun") then
	if (aspect=="conjunct") then
		cecho("Impact on Strength of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on Strength of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on Strength of Sphere is <span>NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on Strength of Sphere is <span>MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on Strength of Sphere is <span>POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on Strength of Sphere is <span>MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on Strength of Sphere is <span>MAJOR NEGATIVE")
	end
elseif (planet=="Moon") then
	if (aspect=="conjunct") then
		cecho("Impact on Duration of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on Duration of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on Duration of Sphere is <span>NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on Duration of Sphere is <span>MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on Duration of Sphere is <span>POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on Duration of Sphere is <span>MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on Duration of Sphere is <span>MAJOR NEGATIVE")
	end
elseif (planet=="Eroee") then
	if (aspect=="conjunct") then
		cecho("Impact on Mana Cost of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on Mana Cost of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on Mana Cost of Sphere is <span>NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on Mana Cost of Sphere is <span>MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on Mana Cost of Sphere is <span>POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on Mana Cost of Sphere is <span>MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on Mana Cost of Sphere is <span>MAJOR NEGATIVE")
	end
elseif (planet=="Sidiak") then
	if (aspect=="conjunct") then
		cecho("Impact on EQ Cost of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on EQ Cost of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on EQ Cost of Sphere is <span>NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on EQ Cost of Sphere is <span>MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on EQ Cost of Sphere is <span>POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on EQ Cost of Sphere is <span>MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on EQ Cost of Sphere is <span>MAJOR NEGATIVE")
	end
elseif (planet=="Tarox") then
	if (aspect=="conjunct") then
		cecho("Impact on Health Cost of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on Health Cost of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on Health Cost of Sphere is <span>NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on Health Cost of Sphere is <span>MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on Health Cost of Sphere is <span>POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on Health Cost of Sphere is <span>MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on Health Cost of Sphere is <span>MAJOR NEGATIVE")
	end
elseif (planet=="Papaxi") then
	if (aspect=="conjunct") then
		cecho("Impact on Random of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on Random of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on Random of Sphere is <span>NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on Random of Sphere is <span>MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on Random of Sphere is <span>POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on Random of Sphere is <span>MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on Random of Sphere is <span>MAJOR NEGATIVE")
	end
elseif (planet=="Aapek") then
	if (aspect=="conjunct") then
		cecho("Impact on Power Cost of Sphere is <span>HUGELY POSITIVE")
	elseif (aspect=="trine") then
		cecho("Impact on Power Cost of Sphere is <span>MAJOR POSITIVE")
	elseif (aspect=="square") then
		cecho("Impact on Power Cost of Sphere is NEGATIVE")
	elseif (aspect=="quincunx") then
		cecho("Impact on Power Cost of Sphere is MINOR NEGATIVE")
	elseif (aspect=="sextile") then
		cecho("Impact on Power Cost of Sphere is POSITIVE")
	elseif (aspect=="semisextile") then
		cecho("Impact on Power Cost of Sphere is MINOR POSITIVE")
	elseif (aspect=="opposite") then
		cecho("Impact on Power Cost of Sphere is MAJOR NEGATIVE")
	end
end
resetFormat()

I'm sure that with tables I could simply this one trigger down to a few lines, but I'm having trouble figuring out where to get started. Can anyone take a shot at this so that I don't have to create 11 more of these triggers?

EDIT: For some reason, when posting, it replaced my <red> and <green> tags in the cechoes with <span>, or removed them entirely.

Comments

  • SelenitySelenity My first MC to stay in Serenwilde
    edited May 2017
    I'm not home so I can't work on this exactly. I can offer pseudocode.



    planetEffects = {["Sun"]="Strength", ["Moon"]="Duration", ["Eroee"]="Mana Cost", ["Sidiak"]="EQ Cost", ["Tarox"]="Health Cost", ["Papaxi"] = "Random", ["Aapek"]="Power Cost"}
    aspectEffects = {["conjunct"]="HUGELY POSITIVE", ["trine"]="MAJOR POSITIVE", ["square"]="NEGATIVE", ["quincunx"]="MINOR NEGATIVE", ["sextile"]="POSITIVE", ["semisextile"]="MINOR POSITIVE", ["opposite"]="MAJOR NEGATIVE"}

    selectCurrentLine()
    replace("")
    cecho("<span>VOLCANO: ")
    cecho("Impact on " .. planetEffects[matches[2]] .. " of Sphere is " .. aspectEffects[matches[4]])

    resetFormat()
  • Worked like a charm. Thanks, @Selenity!
  • SelenitySelenity My first MC to stay in Serenwilde
    Brauthik said:
    Worked like a charm. Thanks, @Selenity!
    No problem!
Sign In or Register to comment.