[PQR] Learning Fail menu

User Tag List

Results 1 to 4 of 4
  1. #1
    EternalNeko's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [PQR] Learning Fail

    So yeah, I decided to have a go at making rotations, all those pro people are doing it! how hard can it be?

    So I got it using crusader strike, so far so good.
    Got it to check if Divine Purpose had proc'd and not use crusader strike if so. sweet.

    Tried to make it check if I was in range to use the ability, F A I L.

    Much tweaking and tinkering doesn't seem to cure it.

    Lua File:
    PHP Code:
    function CheckPurpose()
         if 
    UnitBuffID("player"90174
         
    then return true
         end
    end

    function CheckMelee()
        if 
    IsSpellInRange(GetSpellInfo(35395),"target") == 0
        then 
    return true
        end
    end 
    Ability:
    PHP Code:
    if CheckPurpose() then return false end
    if CheckMelee() then return false end

        
    if UnitPower("player"9) < 
            then
            CastSpellByName
    (GetSpellInfo(35395), "target")
        
    end 
    WoW wigs out at it and says...
    PHP Code:
    Message: [string "if CheckPurpose() then return false end ..."]:3attempt to call global 'CheckMelee' (a nil value)
    Time10/24/12 08:38:26
    Count
    421
    Stack
    : [C]: in function `CheckMelee'
    [string "if CheckPurpose() then return false end ..."]:3: in function 
    `?'
    [string "if PQR_Addon_Loaded == nil then..."]:737: in function `PQR_NextAbility'
    [string "if PQR_Addon_Loaded == nil then..."]:533in function `PQR_ExecuteRotation'
    [string "if PQR_Addon_Loaded == nil then..."]:289: in function <[string "if PQR_Addon_Loaded == nil then..."]:214> 
    Dunno if this is posted in the right place, didn't notice a 'Halp i suck at learning' forum area.

    [PQR] Learning Fail
  2. #2
    kuukuu's Avatar Contributor
    Reputation
    269
    Join Date
    Jul 2012
    Posts
    619
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need more to your CheckMelee() to account for the other two options for IsSpellInRange. It can return 1,0 or nil. With your current code, if it doesn't return 0 then it's going to have no idea what to do and error out.
    Former PQR Developer

  3. #3
    firepong's Avatar Elite User
    Reputation
    384
    Join Date
    Jan 2008
    Posts
    955
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kuukuu View Post
    You need more to your CheckMelee() to account for the other two options for IsSpellInRange. It can return 1,0 or nil. With your current code, if it doesn't return 0 then it's going to have no idea what to do and error out.
    Actually, all his code is sound. The only thing he has to do is:
    PHP Code:
    function CheckMelee()
        if 
    UnitExists("Target") and IsSpellInRange(GetSpellInfo(35395),"target") == 0
        then 
    return true
        end
    end 
    Without UnitExists("Target"), when he doesn't have a target, the function will bug out. Other than that, all his coding is good.

    P.S. Ill give you a hint Eternal. On a if statement, put all the main things at the beginning, then the secondary stuff after that. Like UnitExists("Target") is a main function so it goes at the beginning, UnitBuffID() and UnitDebuffID() and mostly everything else goes after that. When your doing a statement that checks for a buff or Debuff on a target, but you have no target, some functions will bug out with the error your getting. What I do is include UnitExists(var) in all these cases, even if the function will not bug out, just to be safe. IsSpellInRange() is one of the main function's that will always bug out when you don't have UnitExists() in your code somewhere. PQR_UnitDistance(var1,var2) where var1 and var 2 can be any unit(Player, Target, Focus, etc), is the same was as IsSpellInRange()

  4. #4
    EternalNeko's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, i was messing with what firepong was saying about staging the events with more important ones to avoid errors cropping up where the whole statement should just universally come up false, and it seems to work really well, since i started doing this i haven't encountered any problems : )

    I was messing about with my DK and decided to see if i could make it behave well enough to do a rotation for blood, which it seems to be doing very well actually, i managed to make it intelligent enough to deal with the various cooldowns involved with diseases, and managed to make a toggle that switches to an AoE mode (which currently only spams death strike if the runes are frost/unholy, and blood boil with all the blood/death runes)

    Thanks for the help : )

Similar Threads

  1. [PQR] Looking for PQR 5.4.8 release and profile pack.
    By f2p in forum World of Warcraft Bots and Programs
    Replies: 11
    Last Post: 05-08-2017, 09:36 PM
  2. [PQR] LF "Use engineering gloves" pqr string code
    By dealerx in forum WoW Bot Maps And Profiles
    Replies: 2
    Last Post: 08-15-2016, 03:05 PM
  3. [PQR] Need gladiator profile for PQR
    By Esdescon in forum World of Warcraft Bots and Programs
    Replies: 0
    Last Post: 12-14-2015, 12:52 PM
  4. [Guide] "Failed to launch critical file" error popup fix for HB and PQI/PQR users
    By xcureanddisease in forum World of Warcraft Guides
    Replies: 2
    Last Post: 09-25-2013, 06:45 AM
  5. Pet Skills List - Where to learn pet skills
    By Breeze in forum World of Warcraft Guides
    Replies: 3
    Last Post: 09-23-2006, 08:54 AM
All times are GMT -5. The time now is 08:53 AM. 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