Item Search
     
BG-Wiki Search
Page 227 of 302 FirstFirst ... 177 217 225 226 227 228 229 237 277 ... LastLast
Results 4521 to 4540 of 6036

Thread: Gearswap Help Thread!     submit to reddit submit to twitter

  1. #4521
    Melee Summoner
    Join Date
    Jul 2015
    Posts
    43
    BG Level
    1
    FFXI Server
    Bahamut

    Quote Originally Posted by Byrthnoth View Post
    Honestly, we aren't on Pentium IIIs with 128MB of RAM anymore. Your Lua code is almost guaranteed to be so lightweight that inefficiency in it is negligible. I suspect that what GearSwap does before and after your code is going to take the vast majority of the processing time during every event until you approach an infinite loop in your code (which some people do).
    If it's worth doing, it's worth doing right, no?


    When I'm looking for Switches with a static set of outcomes, I typically just use the "table o' functions" approach. You can see this implemented around line 1770 of addons/libs/extdata.lua
    I'll take a look, thanks.

  2. #4522
    BG Content
    Join Date
    Jul 2007
    Posts
    22,372
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Quote Originally Posted by Jeanne Renault View Post
    If it's worth doing, it's worth doing right, no?
    What is "right" for code varies based on the reality of the situation. In a situation like this where there are negligible performance benefits and substantial readability benefits, "right" might be making the simpler code.

  3. #4523
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Byrthnoth View Post
    What is "right" for code varies based on the reality of the situation. In a situation like this where there are negligible performance benefits and substantial readability benefits, "right" might be making the simpler code.

    i believe in K.I.S.S (Keep It Simple Stupid) tho some of my code does not meet that but it was needed to make things smaller

  4. #4524
    trv
    trv is offline
    Melee Summoner
    Join Date
    Oct 2014
    Posts
    48
    BG Level
    1

    Quote Originally Posted by Jeanne Renault View Post
    Actually planning to use tables with the lines of code I want to execute stored as strings within them. That way it doesn't cause trouble the way storing functions in a table--like on that entry--would.
    If you're concerned about efficiency, you probably shouldn't use the loadstring function in that way. Compiling the strings is going to be much slower and more costly than the first example on the switch-case page.

  5. #4525
    Melee Summoner
    Join Date
    Jul 2015
    Posts
    43
    BG Level
    1
    FFXI Server
    Bahamut

    Quote Originally Posted by trv View Post
    If you're concerned about efficiency, you probably shouldn't use the loadstring function in that way. Compiling the strings is going to be much slower and more costly than the first example on the switch-case page.
    That's what I was afraid of. Guess I'll have to stick functions in there as functions after all.

    Quote Originally Posted by Byrthnoth View Post
    What is "right" for code varies based on the reality of the situation. In a situation like this where there are negligible performance benefits and substantial readability benefits, "right" might be making the simpler code.
    We just have different ideas of "simple" and "readable" then.

  6. #4526
    trv
    trv is offline
    Melee Summoner
    Join Date
    Oct 2014
    Posts
    48
    BG Level
    1

    There's nothing to be afraid of. All of Lua's libraries are tables full of functions (table.sort, string.find, etc.).

  7. #4527
    Melee Summoner
    Join Date
    Jan 2008
    Posts
    31
    BG Level
    1

    Quote Originally Posted by Astaro
    Quote Originally Posted by Astaro View Post
    Having issues with Mote's SCH gearswap:

    Have adjusted the equipment, but the original is giving the same error message too:

    http://pastebin.com/6ZBvQqat

    Its saying:

    lua runtime error: gearswap /flow.lua:295:
    gearswap has detected an error in the user function self_command:
    ...SCH.lua:432: attempt to index field 'Defense' (a nil value)

    Any ideas how to resolve this?
    I change the file name to BLM.lua, switched to blm to see if it loaded and it did, no issues at all, however when using it on SCH it doesn't work!
    I've got mote's includes
    Quote Originally Posted by Jeanne Renault View Post
    This makes absolutely no sense. That script doesn't even do anything with 'Defense' that far down, and there's no reason it should work for BLM but not SCH. I'm no expert, but it sounds like the Lua interpreter itself is shitting the bed. Hard.
    I've literally no idea what else to try :-/

  8. #4528
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Astaro View Post
    I've literally no idea what else to try :-/
    the only thing i can think of is your using a macro and in it its spelt "Defense" not "defense" as all of the defense's in motes code are spelt defense not Defense except thoes being written to the chat
    but this would only be true if you are using different macros for each job(are you??)

  9. #4529
    Melee Summoner
    Join Date
    Jan 2008
    Posts
    31
    BG Level
    1

    Quote Originally Posted by dlsmd View Post
    the only thing i can think of is your using a macro and in it its spelt "Defense" not "defense" as all of the defense's in motes code are spelt defense not Defense except thoes being written to the chat
    but this would only be true if you are using different macros for each job(are you??)
    I have a different macro book for each job? None of my macros call directly on the lua, they are just "/ma "Fire V" <t>" etc... unless you mean a macro within the lua? Then I'm honestly not sure, I just used Moten's and adapted the equipment. I get the same error message even with Moten's base lua file too.

  10. #4530
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    does that error show when you first change jobs
    if so try reloading gearswap like this after you change jobs
    "lua reload gearswap" (no quotes in the windower console)
    let me know if the error shows again after

  11. #4531
    Melee Summoner
    Join Date
    Jan 2008
    Posts
    31
    BG Level
    1

    Exactly the same issue.

    I wonder if I need to perhaps update my flow.lua file?
    I'm gonna delete it and redownload and see if that works. - nope that still doesn't work! Bah

  12. #4532
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    im not sure then
    but
    you can remove these
    elements.obi_of because its already in motes include with the Hachirin-no-obi
    info.helix_nukes because you would just use spell_maps[spell.en] == "Helix" to tell if its a Helix spell
    then change this
    elseif info.helix_nukes:contains(spell.english) then --line 365
    to this
    elseif spell_maps[spell.en] == "Helix" then


    i ran your and motes sch file through a file compare and that all i could see other then gear that looks odd to me (mind you i know next to nothing about motes include)

    one thing i can recommend is to start with a fresh motes include file then add in your changes one by one then reload gearswap till it crashes (you can do this with npp++)
    order for doing this(this would be the only way to narrow it down) this is how you debug code with out a debuger
    1. set motes include as your sch file(save you current file to your desktop or somewhere other then your gearswap folder)
    2. open both files with npp++(npp++ can edit gearswap files even if there open)
    3. load ffxi
    4. change jobs to sch

    5. if it loads with no errors go on
    6. add one new thing
    7. save your file
    8. use "lua reloads gearswap"
    9. if all changes are no it go to #5
    10. if all changes are in your done

  13. #4533
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    here is my ws and obi gear equip code
    Code:
    sets.WS_types={['Hand-to-Hand']={head="Tokon Hachimaki"},['Dagger']={head="Issen Hachimaki"},['Sword']={head="Kensho Hachimaki"},['Great Sword']={head="Hako Hachimaki"},
        ['Axe']={head="Ryoshi Hachimaki"},['Great Axe']={head="Senshin Hachimaki"},['Scythe']={head="Rekka Hachimaki"},['Polearm']={head="Shitotsu Hachimaki"},
        ['Katana']={head="Kanja Hachimaki"},['Great Katana']={head="Kengo Hachimaki"},['Club']={head="Rokugo Hachimaki"},['Staff']={head="Hakke Hachimaki"},
        ['Archery']={head="Shunten Hachimaki"},['Marksmanship']={head="Saika Hachimaki"},['Throwing']={},}
    sets.ws_belt={Dark={waist="Shadow Belt"},Water={waist="Aqua Belt"},Earth={waist="Soil Belt"},Ice={waist="Snow Belt"},Fire={waist="Flame Belt"},
        Wind={waist="Breeze Belt"},Lightning={waist="Thunder Belt"},Light={waist="Light Belt"},}
    sets.ws_neck={Dark={neck="Shadow Gorget"},Water={neck="Aqua Gorget"},Earth={neck="Soil Gorget"},Ice={neck="Snow Gorget"},Fire={neck="Flame Gorget"},
        Wind={neck="Breeze Gorget"},Lightning={neck="Thunder Gorget"},Light={neck="Light Gorget"},}
    sets.spell_obi={Fire={waist="Karin Obi"},Earth={waist="Dorin Obi"},Water={waist="Suirin Obi"},Wind={waist="Furin Obi"},Ice={waist="Hyorin Obi"},
        Lightning={waist="Rairin Obi"},Light={waist="Korin Obi"},Dark={waist="Anrin Obi"},}
    function WS_Gear_precast(spell)--outputs correct ws gear set
        local a = {}
        if spell.type == "WeaponSkill" then
            local spell_element = (type(spell.element)=='number' and res.elements[spell.element] or res.elements:with('name', spell.element))
            if player.inventory["Fotia Gorget"] or player.wardrobe["Fotia Gorget"] then
                a = set_combine(a, {neck="Fotia Gorget"})
            elseif player.inventory[sets.ws_neck[spell_element.en].neck] or player.wardrobe[sets.ws_neck[spell_element.en].neck] then
                a = set_combine(a, sets.ws_neck[spell_element.en])
            end
            if player.inventory["Fotia Belt"] or player.wardrobe["Fotia Belt"] then
                a = set_combine(a, {waist="Fotia Belt"})
            elseif player.inventory[sets.ws_belt[spell_element.en].waist] or player.wardrobe[sets.ws_belt[spell_element.en].waist] then
                a = set_combine(a, sets.ws_belt[spell_element.en])
            end
            if ws_head and (player.inventory[sets.WS_types[spell.skill].head] or player.wardrobe[sets.WS_types[spell.skill].head]) then
                a = set_combine(a, sets.WS_types[spell.skill])
            end
            return a
        end
    end
    WS_Gear_midcast = WS_Gear_precast
    function e_obi_midcast(spell)--outputs correct obi set
        if not Typ.abilitys:contains(spell.prefix) and spell.action_type ~= "Item" then
            local spell_element = (type(spell.element)=='number' and res.elements[spell.element] or res.elements:with('name', spell.element))
            if spell_element.name == world.weather_element or spell_element.name == world.day_element then
                if player.inventory["Hachirin-no-Obi"] or player.wardrobe["Hachirin-no-Obi"] then
                    return {waist="Hachirin-no-Obi"}
                elseif player.inventory[sets.spell_obi[spell_element.en].waist] or player.wardrobe[sets.spell_obi[spell_element.en].waist] then
                    return sets.spell_obi[spell_element.en]
                end
            end
        end
    end
    this returns the highest level AOE ws that you have available(based on current weapon)
    Code:
    aoe_ws = S{"Spinning Attack","Aeolian Edge","Cyclone","Shockwave","Fell Cleave","Spinning Scythe","Cataclysm","Earth Crusher","Uriel Blade","Glory Slash","Circle Blade"}
    function ws_to_aoews(spell)--returs the highest level AOE weaponskill you can use at this time
        for _,v in pairs(table.reverse(windower.ffxi.get_abilities().weapon_skills)) do
            local ws = res.weapon_skills[v][gearswap.language]
            if aoe_ws:contains(ws) then
                return ws
            end
        end
        return spell.name
    end

  14. #4534
    Melee Summoner
    Join Date
    Mar 2015
    Posts
    26
    BG Level
    1

    Multiple preshot sets

    Tried this function but doesnt work, still swap to precast even with flurry up:

    function job_precast(spell, action, spellMap, eventArgs)
    if spell.action_type == 'Ranged Attack' then
    if buffactive[581] then
    equip(sets.Flurry2)
    elseif buffactive[265] then
    equip(sets.Flurry)
    else
    equip(sets.precast.RA)
    end
    end
    end

    Anyone know how to tweak it so i can preshot based on what flurry i have up?

  15. #4535
    Melee Summoner
    Join Date
    Jul 2015
    Posts
    43
    BG Level
    1
    FFXI Server
    Bahamut

    Quote Originally Posted by paciokino View Post
    Tried this function but doesnt work, still swap to precast even with flurry up:

    Code:
    function job_precast(spell, action, spellMap, eventArgs)
        if spell.action_type == 'Ranged Attack' then
            if buffactive[581] then
                equip(sets.Flurry2)
            elseif buffactive[265] then
                equip(sets.Flurry)
            else
                equip(sets.precast.RA)
            end
        end
    end
    Anyone know how to tweak it so i can preshot based on what flurry i have up?
    If you're using Motes-Includes--which it looks like you are but I could be wrong--try putting an "eventArgs.handled = true" after each equip() line. Otherwise the handler's just gonna default to your regular precast set.

    If that doesn't work, here's two other possible solutions.
    Spoiler: show
    Plan B: Try adding
    Code:
    state.Buff.Flurry2 = buffactive[numbers] or false
    state.Buff.Flurry = buffactive[othernumbers] or false
    in job_setup(), then renaming sets.Flurry2 and sets.Flurry to sets.Buff.Flurry2 and sets.Buff.Flurry.

    (I still don't understand the need for the "or false" part, but everyone else does it.)

    If that doesn't work--which it might not, considering RA uses precast and this guy doesn't document half the shit his libs do--try Plan C:

    Code:
    function job_setup()
        state.Buff.Flurry2 = buffactive[numbers] or false
        state.Buff.Flurry = buffactive[othernumbers] or false
        --whatever the rest of your current job_setup() is
    end
    
    function job_precast(spell, action, spellMap, eventArgs)
        if spell.action_type == 'Ranged Attack' then
            if state.Buff.Flurry2 then
                sets.precast.RA = sets.Flurry2
            elseif state.Buff.Flurry then
                sets.precast.RA = sets.Flurry
            else
                sets.precast.RA = sets.precast.RA.Default
            end
        end
    end
    ...and rename your default RA precast set to sets.precast.RA.Default.

    Try 'em in this order, though, because I'm pretty sure you just need "eventArgs.handled = true".

  16. #4536
    Melee Summoner
    Join Date
    Mar 2015
    Posts
    26
    BG Level
    1

    Worked like a charm, the first solution.

    Happy rng, thx a lot.

  17. #4537
    Melee Summoner
    Join Date
    Jul 2015
    Posts
    43
    BG Level
    1
    FFXI Server
    Bahamut

    Quote Originally Posted by paciokino View Post
    Worked like a charm, the first solution.

    Happy rng, thx a lot.
    No problem, I'm just glad I've finally contributed to the thread. Even if it is something this small. :B

  18. #4538
    Relic Shield
    Join Date
    Jan 2013
    Posts
    1,868
    BG Level
    6

    Gear swap can tell if you have flurry 1 or 2 on?

  19. #4539
    Melee Summoner
    Join Date
    Jul 2015
    Posts
    43
    BG Level
    1
    FFXI Server
    Bahamut

    Revised the hell out of itemize_sets to process one set at a time with the second argument being whether to get it out or put it away.

    Now I just need to know how to call it from a macro line. I tried //gs c itemize_sets but it doesn't work. What am I doing wrong?

    EDIT: Gee, Jeanne, it might help if you actually gave the people something to work with.

    Code:
    --from define_sets() if it's needed
    sets.Stoneskin = {neck="Stone Gorget",ear1="Earthcry Earring",hands="Stone Mufflers",
            waist="Siegel Sash",legs="Haven Hose"}
    
    function itemize_sets(set, move)
        --put unneeded stuff away or get needed stuff out.
        for drawer,junk in pairs(set) do
            local thisThing = ''
            if type(junk) == "string" then --ignore tables and nils
                thisThing = junk
                print("Now "..move.."ting "..thisThing)
                send_command(move..' "'..thisThing..'" case')
            end
        end
    end
    
    --[[And now the command i'm trying to test. All the pieces are in my case already. I think I just don't have the function defined right to be called like this.]]
    > gs c itemize_sets(sets.Stoneskin, 'get')
    Quote Originally Posted by Trumpy View Post
    Gear swap can tell if you have flurry 1 or 2 on?
    Well, Windower can, anyway. I'm not sure which component it is. Each status effect has its own ID in the game data, so basically it just monitors for whether that one's active.

  20. #4540
    Relic Shield
    Join Date
    Jan 2013
    Posts
    1,868
    BG Level
    6

    I am not super code smart. So I might just not know it can work this way.
    to call a function (usually in a if statement in your lua) I usually do soemthing like "update_gear()" to call a self command I made i do "gs c follow". So I might not know that you can call a function in the same manner you can call a command? Is there a way to macro calling functions if it isnt the same you would use for a command? Short solution would be make a command that calls that function or convert said function into a command if possible. So if it isnt possible to call a function in the same manner u call a command Id say its failing cause you dont have a command set up.

    Code:
    function self_command(command)
    	if command == 'itemize_sets' then
    		itemize_sets()
    	end
    end

    Well I thought it couldnt tell whether you had haste 1 or 2 on, just that you had a haste effect on. I have some things that happen when buffactive.haste is true or not and it works for both haste 1 and haste 2. I assumed flurry was the same.

    Also is there a way to tell if u have 2 marches on for example? Cause I assume buffactive.march would show true whichever one u had on (not that I have messed with these particualr buffs yet) OR for example I have been playing on PUP lately and Ive thought of things like oh i can do this if i have 2 earth maneuvers on (as an example), but I wasnt sure how to determine i have 2 of the same buff.

Page 227 of 302 FirstFirst ... 177 217 225 226 227 228 229 237 277 ... LastLast

Similar Threads

  1. Replies: 6547
    Last Post: 2014-07-08, 22:45