[Testing] Text info window (QA.Win.64.885)

Discussion in 'Lua Discussions' started by Drake Aedus, Nov 10, 2019.

Thread Status:
Not open for further replies.
  1. Drake Aedus

    Drake Aedus Avatar

    Messages:
    536
    Likes Received:
    886
    Trophy Points:
    75
    Gender:
    Male
    882 code, see 885 in a reply below

    Code:
    -- this function runs every frame update
    function Update()
    
        -- lets update our variables about once a second...
        if (os.time() % 1 < 0.1) then
            x = GetStatValueByNumber(14)    -- CurrentHealth
            y = GetStatValueByNumber(30)    -- Health
            z = math.floor((x/y) * 20)        -- how many bubbles
            str = GetStatValueByNumber(46)
            dex = GetStatValueByNumber(22)
            int = GetStatValueByNumber(32)
            ea_pw = GetStatValueByNumber(159)
            ea_rs = GetStatValueByNumber(331)
            ai_pw = GetStatValueByNumber(160)
            ai_rs = GetStatValueByNumber(332)
            fi_pw = GetStatValueByNumber(157)
            fi_rs = GetStatValueByNumber(329)
            wa_pw = GetStatValueByNumber(158)
            wa_rs = GetStatValueByNumber(330)
            su_pw = GetStatValueByNumber(161)
            su_rs = GetStatValueByNumber(333)
            mo_pw = GetStatValueByNumber(162)
            mo_rs = GetStatValueByNumber(334)
            li_pw = GetStatValueByNumber(155)
            li_rs = GetStatValueByNumber(327)
            de_pw = GetStatValueByNumber(156)
            de_rs = GetStatValueByNumber(328)
            ch_pw = GetStatValueByNumber(163)
            ch_rs = GetStatValueByNumber(335)
            ma_pw = GetStatValueByNumber(439)
            ma_rs = GetStatValueByNumber(336)
        end
    
    end
    
    -- this function also runs every frame update
    function OnGUI()
      
        -- MUD style menu :P
        GUILabel(250,40,240,600,"╔════════════════════╗\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n╚════════════════════╝")
        GUILabel(439,55,240,600,"║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║")
    
        GUILabel(265,55,180,580,string.format("Health: %d/%d\n"..string.rep("■",z)..string.rep("□",20-z).."\n\nDate: "..os.date().."\n\nStr: %d   Dex: %d   Int: %d\n\n               -Power-   -Resist-\nEarth \nAir \nFire \nWater \nSun \nMoon \nLife \nDeath \nChaos \nMagic ",x,y,str,dex,int))
       GUILabel(335,190,50,300,string.format("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d",ea_pw,ai_pw,fi_pw,wa_pw,su_pw,mo_pw,li_pw,de_pw,ch_pw,ma_pw))
       GUILabel(395,190,50,300,string.format("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d",ea_rs,ai_rs,fi_rs,wa_rs,su_rs,mo_rs,li_rs,de_rs,ch_rs,ma_rs))
      
    end

    [​IMG]


    edit: I can't believe I forgot chaos? I have added it into the example but not the screen shot.
     
    Last edited: Nov 13, 2019
  2. fooBrew

    fooBrew Avatar

    Messages:
    34
    Likes Received:
    31
    Trophy Points:
    8
    Gender:
    Male
    Location:
    San Diego, CA
    Nice job!
     
  3. Drake Aedus

    Drake Aedus Avatar

    Messages:
    536
    Likes Received:
    886
    Trophy Points:
    75
    Gender:
    Male
    Updated 885 code. There is a slight chance that this breaks when first loading the QA client for some reason, but I haven't tried to reproduce it yet. Also, I may need to math.floor my current health stat... not sure yet.

    Code:
    -- initialize our variables
    
    str = ShroudGetStatValueByNumber(46)
    dex = ShroudGetStatValueByNumber(22)
    int = ShroudGetStatValueByNumber(32)
    ea_pw = ShroudGetStatValueByNumber(159)
    ea_rs = ShroudGetStatValueByNumber(331)
    ai_pw = ShroudGetStatValueByNumber(160)
    ai_rs = ShroudGetStatValueByNumber(332)
    fi_pw = ShroudGetStatValueByNumber(157)
    fi_rs = ShroudGetStatValueByNumber(329)
    wa_pw = ShroudGetStatValueByNumber(158)
    wa_rs = ShroudGetStatValueByNumber(330)
    su_pw = ShroudGetStatValueByNumber(161)
    su_rs = ShroudGetStatValueByNumber(333)
    mo_pw = ShroudGetStatValueByNumber(162)
    mo_rs = ShroudGetStatValueByNumber(334)
    li_pw = ShroudGetStatValueByNumber(155)
    li_rs = ShroudGetStatValueByNumber(327)
    de_pw = ShroudGetStatValueByNumber(156)
    de_rs = ShroudGetStatValueByNumber(328)
    ch_pw = ShroudGetStatValueByNumber(163)
    ch_rs = ShroudGetStatValueByNumber(335)
    ma_pw = ShroudGetStatValueByNumber(439)
    ma_rs = ShroudGetStatValueByNumber(336)
    
    -- this function runs every frame update
    function ShroudOnUpdate()
    
       -- lets update our healthbar about once a second...
       if (os.time() % 1 < 0.1) then
           x = ShroudGetStatValueByNumber(14)   -- CurrentHealth
           y = ShroudGetStatValueByNumber(30)   -- Health
           z = math.floor((x/y) * 20)       -- how many bubbles
       end
    
        -- lets update our stats less frequently
       if (os.time() % 10 < 0.1) then
           str = ShroudGetStatValueByNumber(46)
           dex = ShroudGetStatValueByNumber(22)
           int = ShroudGetStatValueByNumber(32)
           ea_pw = ShroudGetStatValueByNumber(159)
           ea_rs = ShroudGetStatValueByNumber(331)
           ai_pw = ShroudGetStatValueByNumber(160)
           ai_rs = ShroudGetStatValueByNumber(332)
           fi_pw = ShroudGetStatValueByNumber(157)
           fi_rs = ShroudGetStatValueByNumber(329)
           wa_pw = ShroudGetStatValueByNumber(158)
           wa_rs = ShroudGetStatValueByNumber(330)
           su_pw = ShroudGetStatValueByNumber(161)
           su_rs = ShroudGetStatValueByNumber(333)
           mo_pw = ShroudGetStatValueByNumber(162)
           mo_rs = ShroudGetStatValueByNumber(334)
           li_pw = ShroudGetStatValueByNumber(155)
           li_rs = ShroudGetStatValueByNumber(327)
           de_pw = ShroudGetStatValueByNumber(156)
           de_rs = ShroudGetStatValueByNumber(328)
           ch_pw = ShroudGetStatValueByNumber(163)
           ch_rs = ShroudGetStatValueByNumber(335)
           ma_pw = ShroudGetStatValueByNumber(439)
           ma_rs = ShroudGetStatValueByNumber(336)
       end
    
    end
    
    -- this function also runs every frame update
    function ShroudOnGUI()
     
       -- MUD style menu :P
       ShroudGUILabel(250,40,240,600,"╔════════════════════╗\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n╚════════════════════╝")
       ShroudGUILabel(439,55,240,600,"║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║")
    
       ShroudGUILabel(265,55,180,580,string.format("Health: %d/%d\n"..string.rep("■",z)..string.rep("□",20-z).."\n\nDate: "..os.date().."\n\nStr: %d   Dex: %d   Int: %d\n\n               -Power-   -Resist-\nEarth \nAir \nFire \nWater \nSun \nMoon \nLife \nDeath \nChaos \nMagic ",x,y,str,dex,int))
       ShroudGUILabel(335,190,50,300,string.format("%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f",ea_pw,ai_pw,fi_pw,wa_pw,su_pw,mo_pw,li_pw,de_pw,ch_pw,ma_pw))
       ShroudGUILabel(395,190,50,300,string.format("%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f",ea_rs,ai_rs,fi_rs,wa_rs,su_rs,mo_rs,li_rs,de_rs,ch_rs,ma_rs))
     
    end
    
     
    Last edited: Nov 13, 2019
  4. Vladamir Begemot

    Vladamir Begemot Avatar

    Messages:
    6,194
    Likes Received:
    12,076
    Trophy Points:
    153
    Gender:
    Male
    Does this count the warding skill and gems?
     
  5. Drake Aedus

    Drake Aedus Avatar

    Messages:
    536
    Likes Received:
    886
    Trophy Points:
    75
    Gender:
    Male
    I'm going to say yes, only because I started by looking for a BaseStat value to track each buff separately, but it doesn't exist, just the current total value.
     
    Vladamir Begemot likes this.
  6. Drake Aedus

    Drake Aedus Avatar

    Messages:
    536
    Likes Received:
    886
    Trophy Points:
    75
    Gender:
    Male
    I figured out what I did wrong, it was possible (and likely) to try performing math on a nil value.

    Cleaned that up and playing with initializing variables (which will completely change with the new ShroudRegisterPeriodic function coming soon!).

    Code:
    -- initialize our variables
    
    doOnce = true
    
    -- this function runs every frame update
    function ShroudOnUpdate()
    
       if doOnce then
           x = ShroudGetStatValueByNumber(14)
           y = ShroudGetStatValueByNumber(30)
           str = ShroudGetStatValueByNumber(46)
           dex = ShroudGetStatValueByNumber(22)
           int = ShroudGetStatValueByNumber(32)
           ea_pw = ShroudGetStatValueByNumber(159)
           ea_rs = ShroudGetStatValueByNumber(331)
           ai_pw = ShroudGetStatValueByNumber(160)
           ai_rs = ShroudGetStatValueByNumber(332)
           fi_pw = ShroudGetStatValueByNumber(157)
           fi_rs = ShroudGetStatValueByNumber(329)
           wa_pw = ShroudGetStatValueByNumber(158)
           wa_rs = ShroudGetStatValueByNumber(330)
           su_pw = ShroudGetStatValueByNumber(161)
           su_rs = ShroudGetStatValueByNumber(333)
           mo_pw = ShroudGetStatValueByNumber(162)
           mo_rs = ShroudGetStatValueByNumber(334)
           li_pw = ShroudGetStatValueByNumber(155)
           li_rs = ShroudGetStatValueByNumber(327)
           de_pw = ShroudGetStatValueByNumber(156)
           de_rs = ShroudGetStatValueByNumber(328)
           ch_pw = ShroudGetStatValueByNumber(163)
           ch_rs = ShroudGetStatValueByNumber(335)
           ma_pw = ShroudGetStatValueByNumber(439)
           ma_rs = ShroudGetStatValueByNumber(336)
           doOnce = false
       end
    
       -- lets update our healthbar about once a second...
       if (os.time() % 1 < 0.1) then
           x = ShroudGetStatValueByNumber(14)   -- CurrentHealth
           y = ShroudGetStatValueByNumber(30)   -- Health
           z = math.floor((x/y) * 20)       -- how many bubbles
       end
       
       -- lets update our stats less frequently
       if (os.time() % 10 < 0.1) then
           str = ShroudGetStatValueByNumber(46)
           dex = ShroudGetStatValueByNumber(22)
           int = ShroudGetStatValueByNumber(32)
           ea_pw = ShroudGetStatValueByNumber(159)
           ea_rs = ShroudGetStatValueByNumber(331)
           ai_pw = ShroudGetStatValueByNumber(160)
           ai_rs = ShroudGetStatValueByNumber(332)
           fi_pw = ShroudGetStatValueByNumber(157)
           fi_rs = ShroudGetStatValueByNumber(329)
           wa_pw = ShroudGetStatValueByNumber(158)
           wa_rs = ShroudGetStatValueByNumber(330)
           su_pw = ShroudGetStatValueByNumber(161)
           su_rs = ShroudGetStatValueByNumber(333)
           mo_pw = ShroudGetStatValueByNumber(162)
           mo_rs = ShroudGetStatValueByNumber(334)
           li_pw = ShroudGetStatValueByNumber(155)
           li_rs = ShroudGetStatValueByNumber(327)
           de_pw = ShroudGetStatValueByNumber(156)
           de_rs = ShroudGetStatValueByNumber(328)
           ch_pw = ShroudGetStatValueByNumber(163)
           ch_rs = ShroudGetStatValueByNumber(335)
           ma_pw = ShroudGetStatValueByNumber(439)
           ma_rs = ShroudGetStatValueByNumber(336)
       end
    
    end
    
    -- this function also runs every frame update
    function ShroudOnGUI()
       
       -- MUD style menu :P
       ShroudGUILabel(250,40,240,600,"╔════════════════════╗\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n╚════════════════════╝")
       ShroudGUILabel(439,55,240,600,"║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║\n║")
    
       ShroudGUILabel(265,55,180,580,string.format("Health: %d/%d\n"..string.rep("■",z)..string.rep("□",20-z).."\n\nDate: "..os.date().."\n\nStr: %d   Dex: %d   Int: %d\n\n               -Power-   -Resist-\nEarth \nAir \nFire \nWater \nSun \nMoon \nLife \nDeath \nChaos \nMagic ",x,y,str,dex,int))
       ShroudGUILabel(335,190,50,300,string.format("%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f",ea_pw,ai_pw,fi_pw,wa_pw,su_pw,mo_pw,li_pw,de_pw,ch_pw,ma_pw))
       ShroudGUILabel(395,190,50,300,string.format("%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f\n%3.2f",ea_rs,ai_rs,fi_rs,wa_rs,su_rs,mo_rs,li_rs,de_rs,ch_rs,ma_rs))
       
    end
     
Thread Status:
Not open for further replies.