Jump to content


Photo

Gearswap: Accessing values from resource files.

Gearswap Resources

Best Answer sdahlka , 09 September 2017 - 02:04 AM

function getWeaponSkill(name)
    local wep = geaswap.res.items:with('name', name)
    return wep.skill
end
for sword use getWeaponSkill(player.equipment.main) == 3

here you go

 

you will also need to put your if in the filtered_action function

Go to the full post


    2 replies to this topic

    #1 DerianX

    DerianX

      Member

    • Members
    • PipPip
    • 13 posts
    • LocationCanada

    Posted 09 September 2017 - 12:45 AM

    I'm trying to retrieve the value for the skill associated with equipment in the main hand.

     

    I see that weapons in items.lua haves values for skill which correspond to the various weapon types (ie: 1 for hand to hand, 3 for sword, etc.)

     

    I'm trying to have gearswap check against this value when attempting to use a weaponskill. ie:

     

     

    if spell.name == "Combo" and player.equip.main[skill] == 3 then
     cancel_spell()
     send_command("input /ws \"Fast Blade\" <t>")
    end
    

    I realize this doesn't work but I can't figure out how to access the values in items.lua for function handling. I've seen some references to res.items and the variables.xlsx file has some things that I don't quite understand how to make use of like getraw but I'm not at all experienced with Lua and I can't seem to find any information on how to do so.

     

    Any help would be appreciated.


    "DX" from archived Windower forum.


    #2 sdahlka

    sdahlka

      Advanced Member

    • Members
    • PipPipPip
    • 324 posts

      Posted 09 September 2017 - 02:04 AM   Best Answer

      function getWeaponSkill(name)
          local wep = geaswap.res.items:with('name', name)
          return wep.skill
      end
      for sword use getWeaponSkill(player.equipment.main) == 3
      

      here you go

       

      you will also need to put your if in the filtered_action function



      #3 DerianX

      DerianX

        Member

      • Members
      • PipPip
      • 13 posts
      • LocationCanada

      Posted 09 September 2017 - 05:05 AM

      I did it a little bit differently but you gave me some insight on how to access the data in resources. Thanks for the quick reply.


      "DX" from archived Windower forum.





      1 user(s) are reading this topic

      0 members, 1 guests, 0 anonymous users