IfThen

IfThen

Allows you to create your own IF THEN statements that will dynamically change the function of a button.

This addon is intended for people that have a basic understanding of programming. Specifically conditional If-Then statements.

The addon allows you to write your own if-then statements that will be evaluated and run whenever you press a button, or they can trigger on certain events ingame.
It provides a simple text editor, a fully documented API and some simple If-Then syntax so that you can string together almost anything you want to react to.

Examples:

IF HasOpenQuest("My daily fishing quest") AND InZone("Stormwind") 
THEN Cast("Fishing");
OnEvent("GroupInvite") AND InLFGQueue() 
THEN DeclineInvite() AND Reply("Sorry, I am already in the LFG queue");


Look at the FAQ page for the most asked questions, and the Examples page for examples.

Please post bugreports and feature requests on the Curseforge.com project page

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of Jarod24 Jarod24 Jul 09, 2015 at 21:06 UTC - 0 likes

    Version 1.9.7 released.

    • Screenshot() works again.
    • %InstanceDifficulty% support Mythic dungeon and Timewalking.
  • Avatar of Jarod24 Jarod24 Jun 28, 2015 at 18:39 UTC - 0 likes

    Update: Seems that patch 6.2.0 among other things broke the screenshot feature. I will look into it later this week (vacation).

  • Avatar of Jarod24 Jarod24 May 23, 2015 at 11:47 UTC - 0 likes

    @mcbobbo: Go

    Thanks for that well formatted code :-D
    The changes you made are added to version 1.9.6.

    If you find any more bugs in the future, don't hesitate to submit stuff.

  • Avatar of mcbobbo mcbobbo May 22, 2015 at 04:36 UTC - 0 likes

    @mcbobbo: Go

    Okay, so this seems to work....

    Modified Documentation.lua starting at 1204 to...

    	p[ARG]	=	{
    				"INT[1;400]",	"REQ{Value}    -Value to compare.",
    				"OP[]",		"OPT{OP}        -Comparison operator: @OP@.",
    				"STR[blood;unholy;frost;death;lunar;solar;combo]",	"OPT{Type}     -Runetype for DeathKnights: 'VAL{Blood}', 'VAL{Unholy}', 'VAL{Frost}', 'VAL{Death}'. Balance-type for Druids: 'VAL{Lunar}', 'VAL{Solar}', 'VAL{Combo}'. Ignored for other classes."
    				};
    

    And modified Methods.lua starting line 5273 like so:

    	elseif (strClass == "DRUID") then --For Druids we return balance, for other than balance spec it will return 0
    		local intActive	= GetActiveSpecGroup(false, false); --Returns 1 or 2 (Primary/Secondary)
    		local intSpec	= GetSpecialization(false, false, intActive); --Returns nil,1,2,3 or 4 (druids got 4th spec). Returns nil if the player isnt specced
    		--Balance (spec 1) is the only spec that uses Balance
    		if (intSpec ~= 1 and intSpec ~= 2) then return false; end --IfThen:msg_error("HavePowerPoints(): Current Druid spec do not have Balance or Feral.")
    		if (strType ~= "lunar" and strType ~= "solar" and strType ~= "combo") then
    			IfThen:msg_error("HavePowerPoints(): You must specify a type (lunar/solar/combo) when used with Druid class.");
    			return false;
    		end--if
    		if (intSpec == 1) then
    			intCurr = tonumber(UnitPower("player" , SPELL_POWER_ECLIPSE)); -- from [-100 Lunar to Solar +100]. WOD: Values change automatically as combat happens.
    
    			if (intCurr ~= 0) then --if its exactly 0 then just do the compare without looking at strType
    				if strType == "lunar" and intCurr > 0 then return false; end --Lunar are negative numbers
    				if strType == "solar" and intCurr < 0 then return false; end
    			end--if intCurr
    			if (intCurr < 0) then intCurr = intCurr *-1; end --Negate number
    		elseif (intSpec == 2) then
    			intCurr = tonumber(GetComboPoints("player")); end --WOD: Combopoints are now shared for all targets while in combat.
    

    This might not be the best way to do it, and at first I tried hooking into the Rogue section. But couldn't get that to work. Confirmed this, though, with some smoke testing.

  • Avatar of mcbobbo mcbobbo May 22, 2015 at 03:49 UTC - 0 likes

    @mcbobbo: Go

    Actually, I see it in the methods file. No the combo points only fires for the rogue class, and the druid section filters for balance.

    I think I can tweak it, though... Stay tuned.

  • Avatar of mcbobbo mcbobbo May 22, 2015 at 03:38 UTC - 0 likes

    @Jarod24: Go

    Sorry, I meant to say that it seems not to work for my druid. This syntax works for my Rogue, but not for my cat:

    IF InCombat() AND HavePowerPoints("5") THEN Print("Full stack of combopoints");

  • Avatar of Jarod24 Jarod24 May 21, 2015 at 23:43 UTC - 0 likes

    @mcbobbo: Go

    Dont know, i dont have a druid. Try it and give me a reply.

  • Avatar of mcbobbo mcbobbo May 20, 2015 at 18:45 UTC - 0 likes

    Does the HavePowerPoints("5") argument work for cat druids?

  • Avatar of Jarod24 Jarod24 Mar 26, 2015 at 16:01 UTC - 0 likes

    @loudwhitenoise: Go

    Like your story.
    I'm adding a HaveProfession() function in the next version. For now you could use HasItem(), HasName() or something like that

    There is as far as i know no way to determine if a mob is skinnable, except using tooltip scanning and that is a shaky method at best (mouseover or not, target tapped by player, localization etc), so i can't make a reliable IsSkinnable() function. Using %TargetCreatureType% is your best bet.

    Last edited Mar 26, 2015 by Jarod24
  • Avatar of loudwhitenoise loudwhitenoise Mar 24, 2015 at 21:54 UTC - 0 likes

    storytime: I wanted to print a reminder for any character that has skinning to remember to skin. I couldn't find anything that sees what profession skills I, the player, have. That might be a feature worth adding. I got around it by using HasItem("Skinning Knife"), which works ok as long as I'm not using a Gnomish Army Knife. Now to figure out how to get it to only show up for beasts and dragonkin... I tried Compare with %TargetCreatureType% and it looked great in theory... In practice, targets are deselected when they die so it doesn't really work as I hoped. Oh well.

Facts

Date created
Oct 06, 2011
Categories
Last update
Jul 09, 2015
Development stage
Release
Language
  • enUS
License
All Rights Reserved
Curse link
IfThen
Downloads
8,383
Recent files

Authors