• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - mq.TLO.Me.Casting

Soandso2

Well-known member
Joined
Mar 13, 2023
RedCents
937¢
When I cast a spell from a clicky, like an illusion, does that not qualify as "casting"?

[CODE lang="Lua" title="Spam"]if not me.Buff("Illusion: Human").ID() and not me.Moving() and not invisible and goodToGo() then
useClickys("Circlet of Disguise")
end[/CODE]

In the snippet above me is shortened for mq.TLO.Me obviously. invisible is a boolean and goodToGo() is the function from LeRouge.Lua

If I have the human illusion and I stand still and invisible is false and goodToGo tells me I am good to go, and I click off the illusion, this IF-statement should evaluate is "true" and the useClickys function should be called. And this happens. But once the illusion clicky has begun its 7 second cast, goodToGo should evaluate as false, since I am casting, should it not?

But useClickys is spammed like heck. What am I missing?

[CODE lang="Lua" title="goodToGo()"]local function goodToGo()
-- Credit: LeRogue.Lua by @rawmotion at RedGuides.com
return not me.Stunned()
and not me.Dead()
and not me.Feigning()
and not me.Ducking()
and not me.Silenced()
and not me.Charmed()
and not me.Mezzed()
and not me.Invulnerable()
and not me.Casting()
end
[/CODE]
 
Never mind, that does look good, but cannot test atm.

Maybe try this?

Lua:
local function HumanIllusion()
  return goodToGo()
  and not me.Buff("Illusion: Human").ID()
  and not me.Moving()
  and not invisible
  and not me.Combat()
end

Then have a check for your illusion? Just spitballing here, not an expert in Lua by any means and cannot test atm.
 
Last edited:
It is a string - not a boolean
1688050989271.png
so when you ask if you are casting - it returns nil or not nil
1688051016794.png

What you are looking for is this:
1688051131172.png
change 'not mq.TLO.Me.Casting' to mq.TLO.Me.Casting() == nil

This will say you return if you are casting (not nil) or casting (nil - which is what you want)
 

Attachments

  • 1688051046527.png
    1688051046527.png
    9.3 KB · Views: 1
I changed it to me.Casting() == nil and that made no difference. It spams the clicky function. For good measure I changed it to ~= nil, just to see what would happen, and then it does not run the function at all. So either it wont run the function or it will spam it. Strange.
 
Last edited:
nil is falsey in Lua.
mq.TLO.Me.Casting() will be nil if not casting or the string name of the spell if casting. so you would get the same result for if mq.TLO.Me.Casting() then and if mq.TLO.Me.Casting() ~= nil then

Is a casting bar showing up on your UI when you click the illusion? Have you confirmed Casting is in fact not nil? Is there any delay between the command which starts the cast and checking these conditions again? maybe it needs to advance a frame for Casting to have the expected state.
 
nil is falsey in lua.
mq.TLO.Me.Casting() will be nil if not casting or the string name of the spell if casting. so you would get the same result for if mq.TLO.Me.Casting() then and if mq.TLO.Me.Casting() ~= nil then

Is a casting bar showing up on your UI when you click the illusion? Have you confirmed Casting is in fact not nil? Is there any delay between the command which starts the cast and checking these conditions again? maybe it needs to advance a frame for Casting to have the expected state.
Normally, when clicking an item, I get the casting bar, so also with the Circlet of Disguise. And the illusion buff lands on me, BUT as you mention it, the casting bar goes poof, for some reason. I assumed that it happens because of the spamming of the function.

When I look back at bam.mac, which I am in the process of converting to Lua, I see that I added a delay 0.5 seconds longer than the cast time of the item used to cast. In this case it was hardcoded and I knew the cast time. But useClickys is dynamic and you can send any clicky name into it. So I need to figure out the cast time of the item used.

EDIT: Not sure if this is the right way to go, but I ended up altering the useClickys function instead:
[CODE lang="Lua" title="useClickys"]local function useClickys(clickyName)
local castDelay = findItem(clickyName).CastTime() + 100
if clickyName == "combat" then
if spell("Celestial Tranquility").Stacks() and not me.Buff("Celestial Tranquility").ID() then
mq.cmdf('/useitem "%s"',"Celestial Fists")
print("Use Clicky: \amUsed Epic 1")
end
if spell("Seven Chakras Heel Technique").Stacks and not me.Song("Seven Chakras Heel Technique").ID() and findItem(chestArmour).TimerReady() == 0 then
mq.cmdf('/useitem "%s"',chestArmour)
print("Use Clicky: \am"..chestArmour)
mq.delay(castDelay)
end
else
if findItem(clickyName).ID() > 0 and findItem(clickyName).TimerReady() == 0 then
mq.cmdf('/useitem "%s"',clickyName)
print("Use Clicky: \am"..clickyName)
mq.delay(castDelay)
end
end
end[/CODE]
 
Last edited:
Normally, when clicking an item, I get the casting bar, so also with the Circlet of Disguise. And the illusion buff lands on me, BUT as you mention it, the casting bar goes poof, for some reason. I assumed that it happens because of the spamming of the function.

When I look back at bam.mac, which I am in the process of converting to Lua, I see that I added a delay 0.5 seconds longer than the cast time of the item used to cast. In this case it was hardcoded and I knew the cast time. But useClickys is dynamic and you can send any clicky name into it. So I need to figure out the cast time of the item used.
Have a look here: https://docs.macroquest.org/reference/data-types/datatype-itemspell/
Has a CastTime member, might be what you are after.
 
Should be able to use me.casting.id() to pull an int vs a string value. I’ve found it’s a lot easier logically to avoid string data where possible.
 
Should be able to use me.casting.id() to pull an int vs a string value. I’ve found it’s a lot easier logically to avoid string data where possible.
yep 100% agree

in the case of casting.id casting nothing *should* be nil and not 0 --- because remember 0 in Lua is "truthy" unlike macroquest scripting language
 
Question - mq.TLO.Me.Casting

Users who are viewing this thread

Back
Top
Cart