Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Add Spell - Is Lua Script

Featured Replies

Hello,

I tried this in my fightclass as a spell:

t="raid";
nps=1;
npe=GetNumGroupMembers();
if npe<=4 then
    nps=0;
    t="party";
end;
print(t," ",npe)

 

With the spell settings as:

  • Combat only - False
  • Not spell, is lua script - True

 

I was hoping it would spam something like:

  • "party 0" or "party nil"

 

But instead I get nothing.  Any suggestions on how to make this work?  Eventually I hope to make a fightclass that can detect if I'm in a party or raid, then using the global var "t" have it run a loop for party2, raid1..40, etc.

  • Author

Well, I figured out that my lua script wasn't working as a spell, but if I used it as a condition then it worked.  Now I'm trying to pass "t" to another 'spell', with the below as a condition:

            <LuaScript>-- Find the unit with the largest health deficit, in range, that is alive, that doesn't have Rejuvenation
print("t ",t)            
m=0;
w=f;
local SpellName = GetSpellInfo("Rejuvenation")
for i=nps,npe do
    if i==0 then
        tt="player"
    else
        tt=t..i
    end;
if UnitExists(tt) and IsSpellInRange(SpellName,tt) and not UnitIsDeadOrGhost(tt) and not UnitBuff(tt,SpellName,nil,"PLAYER") then
        a=UnitHealth(tt) / UnitHealthMax(tt);
        if a&gt;m then
            m=a w=tt
        end
    end
end;

-- Heal the unit with the largest deficit
if m &lt;= .95 then
    CastSpellByName(SpellName, w)
end
</LuaScript>

 

I get nothing, not print, not any action, etc.  Suggestions?

  • Author

I know it's not optimal, but I got it to work with this now:

            <LuaScript>m=0;
w=f;
local SpellName = GetSpellInfo("Rejuvenation")
for i=nps,npe do
    if i==0 then
        tt="player"
    else
        tt=t..i
    end;
    
    ue=UnitExists(tt) print(ue)
    isir=IsSpellInRange(SpellName,tt) print(isir)
    uidog=UnitIsDeadOrGhost(tt) print(uidog)
    ub=UnitBuff(tt,SpellName,nil,"PLAYER") print(ub)
    
    print("----------------")
    if ue and isir and not uidog then print("TRUE") else print("FALSE") end
    print("----------------")
    
    if ue and isir and not uidog then
        a=UnitHealth(tt) / UnitHealthMax(tt);
        if a&gt;m then
            m=a w=tt
        end
    end
end;

if m &lt;= 1 and not ub then
    CastSpellByName(SpellName, w)
end;
</LuaScript>

 

The part that is driving me crazy - otherwise I like solving puzzles - is that the results are not consistent.  Sometimes it works, then other times it just doesn't.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.