How to script (lua) Mana Sapphire for Mages (auto cast at low mana) menu

User Tag List

Results 1 to 12 of 12
  1. #1
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to script (lua) Mana Sapphire for Mages (auto cast at low mana)

    As title says, I'm looking for some lua strings that allow me to auto use mana sapphire when i'm at 60% mana.

    I tried in game with /cast Mana Sapphire and it works, so I tried with PQR with CastSpellByName("Mana Sapphire") but no results, I guess because it is an object rather than a spell actually.

    So how can I do that?

    Basically my script was:

    Code:
    if 100 * UnitPower("player") / UnitPowerMax ("player") < 60
    and PQR_SpellAvailable("Mana Sapphire")
    then
    CastSpellByName("Mana Sapphire")
    end
    Any idea about how to make it work?

    Many thanks =)

    How to script (lua) Mana Sapphire for Mages (auto cast at low mana)
  2. #2
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok i solved it! If someone needs it PM me I'll give him the code with no problem!
    Last edited by dealerx; 10-03-2016 at 05:32 PM. Reason: solved

  3. #3
    bynike's Avatar Member
    Reputation
    10
    Join Date
    Mar 2010
    Posts
    50
    Thanks G/R
    26/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    UseItemByName

  4. #4
    Xewl's Avatar Active Member CoreCoins Purchaser
    Reputation
    56
    Join Date
    May 2015
    Posts
    95
    Thanks G/R
    24/19
    Trade Feedback
    6 (100%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Go ahead and just post the code :P

  5. #5
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xewl View Post
    Go ahead and just post the code :P
    I tried but the site blocks me somehow like i'm posting something harmful idk..i can't include code maybe some row is prohibited here idk I don't want to break rules. If any moderator can give me ok I will post the code! (and explain me why i get blocked when posting code)

  6. #6
    Xewl's Avatar Active Member CoreCoins Purchaser
    Reputation
    56
    Join Date
    May 2015
    Posts
    95
    Thanks G/R
    24/19
    Trade Feedback
    6 (100%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    just use pastebin.com for now

  7. #7
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Site blocks my code, wrote to you a PM, Xewl.

    If someone else needs it, just write to me

  8. Thanks Xewl (1 members gave Thanks to dealerx for this useful post)
  9. #8
    Xewl's Avatar Active Member CoreCoins Purchaser
    Reputation
    56
    Join Date
    May 2015
    Posts
    95
    Thanks G/R
    24/19
    Trade Feedback
    6 (100%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by dealerx
    Alright the pastebin.com blocks aswell my code, so I will give it to you here

    Code:
    -- [Auto Mana Gem]
    local start, duration, enable = GetContainerItemCooldown(0, 2)
    local id = GetContainerItemID(0, 2)
    if id == 33312
    and duration ~= 120
    and 100 * UnitPower("player") / UnitPowerMax ("player") < 75 
    and (UnitCastingInfo("player") == nil
    and UnitChannelInfo("player") == nil)
    then
    RunMacro("Gem")
    elseif id ~= 33312
    and 100 * UnitPower("player") / UnitPowerMax ("player") > 10 
    then
    print("Mana Gem Missing!")
    end
    1) Mana gem should be placed in Backpack, slot 2 [local id = GetContainerItemID(0, 2)], 0 is backpack, 2 is slot, you can change it (i have heartstone on slot 1)
    2) When u are less then 75% mana, and in slot 2 ther is a Mana Gem, AND you are not casting/channeling (evocation for example), it will run macro named "Gem". This is important because if you dont add the "cast check" it stops evocation/polymorph/any cast to eat the gem ><, not good . The "Gem" macro is simply "/cast Mana Sapphire"
    3) It checks if slot 2 of backpack is Mana Sapphire by itemID. I don't know how to script it best, like "check if there is a mana gem somewhere in backpack, i simply write "check if mana gem is on slot 2, backpack), so be sure that slot is only for gem or the script won't understand.
    4) If slot 2 is empty (like u already used all 3 gems), or there is another item on that slot, AND you have enough mana to conjure gems (10%), it prints on chat "Mana Gem Missing!".
    5) I didn't add the Conjure Mana Gem auto cast, since i'm writing a PvP profile, so it just says you don't have the mana gem, and they u can craft them manually when its best time for you, in arena/bg.

    Have fun
    Thank you

  10. Thanks dealerx (1 members gave Thanks to Xewl for this useful post)
  11. #9
    werewr's Avatar Member
    Reputation
    2
    Join Date
    Jan 2016
    Posts
    8
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if 100 * UnitPower("player") / UnitPowerMax("player") <= 60
    and GetItemCount("Mana Sapphire") == 1
    and GetItemCooldown("Mana Sapphire") == 0
    and UnitChannelInfo("player") == nil
    and UnitCastingInfo("player") == nil
    then
    UseItemByName("Mana Sapphire")
    return true
    end

  12. #10
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @werer does it work with 3.3.5 pqr 1.1? I dont have time to test it at the moment, I know some commands are not working with pqr 1.1 / 3.3.5 like (PQR_IsOutOfSight)

  13. #11
    werewr's Avatar Member
    Reputation
    2
    Join Date
    Jan 2016
    Posts
    8
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Work fine)

  14. Thanks dealerx (1 members gave Thanks to werewr for this useful post)
  15. #12
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by werewr View Post
    Work fine)
    Thanks tested! I did some little changes tho (so it's similar to mine)

    -- [Auto Mana Gem]
    if 100 * UnitPower("player") / UnitPowerMax ("player") < 75
    and GetItemCount("Mana Sapphire") == 1
    and GetItemCooldown("Mana Sapphire") == 0
    and UnitChannelInfo("player") == nil
    and UnitCastingInfo("player") == nil
    then
    UseItemByName("Mana Sapphire")
    elseif GetItemCount("Mana Sapphire") ~= 1
    and 100 * UnitPower("player") / UnitPowerMax ("player") > 10
    then
    print("Mana Gem Missing!")
    end

Similar Threads

  1. [Lua] How to script a quest.
    By Daimyo2704 in forum WoW EMU Guides & Tutorials
    Replies: 6
    Last Post: 06-25-2010, 10:01 AM
  2. How to script LUA complete tut.
    By Found in forum WoW EMU Guides & Tutorials
    Replies: 16
    Last Post: 04-13-2009, 10:34 PM
  3. How to make lua scripted portals
    By *Alexz* in forum WoW EMU Guides & Tutorials
    Replies: 9
    Last Post: 02-18-2008, 06:05 PM
  4. [GUIDE] How to activate LUA scripts
    By ~SaiLyn~ in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 12-25-2007, 11:52 AM
  5. How +Spell Damage Is Calculated For Mages
    By impulse102 in forum World of Warcraft Guides
    Replies: 7
    Last Post: 08-06-2006, 06:08 AM
All times are GMT -5. The time now is 09:12 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search