Item Search
     
BG-Wiki Search
Page 271 of 302 FirstFirst ... 221 261 269 270 271 272 273 281 ... LastLast
Results 5401 to 5420 of 6036

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

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

    Quote Originally Posted by Roland_J View Post
    I would like some assistance dissecting some code to understand what it's doing. I'll post the code and then list my current understanding/impressions of different parts of the code. Here is the code

    Code:
      if player.target.name then
                match = original:match(''..player.target.name..' uses ([%s%w]+)% Shot.The '..player.target.name..' take ([%s%w]+)% points of damage.')
               match2 = original:match(''..player.target.name..' uses '..match..' Shot.The '..player.target.name..' take ([%s%w]+)% points of damage.')
                    add_to_chat(204, '*-*-*-*-*-*-*-*-* [ SHOT = '..match..' for '..match2..' dmg - on '..player.target.name..' ] *-*-*-*-*-*-*-*-*')
    1. ([%s%w]+)% --- I partially understand this. %s represents spaces, %w represents alphanumeric characters, the [] surrounding %s and %s represent a set comprised of spaces and alphanumeric characters, the + afterwards looks for a pattern of repeated instances of that set , and the ()s encapsulating them all makes the interpreter capture all the info within the parenthesis and store it all for future use... Am I right so far? Assuming I'm on the right track, what is the % for? If what I've said so far is wrong, where did I go wrong?

    2. Is this assigning the values found by ([%s%w]+)% to the match and match2 variables? If so, how? I'm assuming that is being handled by the :match of original:match but I'm not sure if adding :match after original can accomplish that.
    its string.match
    http://lua-users.org/wiki/PatternsTutorial

  2. #5402
    Puppetmaster
    Join Date
    Sep 2015
    Posts
    73
    BG Level
    2

    Actually, this seems to be functioning without string.match; unless you mean that the :match in original:match refers to string.match. I hope that's not the case because if so idk how I'd trace that to the string feature, as string isn't stated anywhere within that function. That code that I posted is found within
    Code:
    windower.register_event('incoming text', function(original, modified, mode)
        local match

    And I'm trying to understand how he's doing what he's doing. I would like for questions 1 and 2 to be answered. I especially can't find what the trailing % is doing. I found out what the rest of that bit is doing from reading http://www.lua.org/manual/5.1/manual.html#5.4.1

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

    Quote Originally Posted by Roland_J View Post
    Actually, this seems to be functioning without string.match; unless you mean that the :match in original:match refers to string.match. I hope that's not the case because if so idk how I'd trace that to the string feature, as string isn't stated anywhere within that function. That code that I posted is found within
    ...
    And I'm trying to understand how he's doing what he's doing. I would like for questions 1 and 2 to be answered. I especially can't find what the trailing % is doing. I found out what the rest of that bit is doing from reading http://www.lua.org/manual/5.1/manual.html#5.4.1
    yes :match in original:match refers to string.match
    % denotes the next char is a special char
    (...)% this says grab this only

    --edit--
    he could have just done this(i think)
    Code:
    ability,damage = original:match(''..player.target.name..' uses ([%s%w]+)% Shot.The '..player.target.name..' take ([%s%w]+)% points of damage.')
    add_to_chat(204, '*-*-*-*-*-*-*-*-* [ SHOT = '..ability..' for '..damage..' dmg - on '..player.target.name..' ] *-*-*-*-*-*-*-*-*')

  4. #5404
    Puppetmaster
    Join Date
    Sep 2015
    Posts
    73
    BG Level
    2

    Neat, thanks dlsmd! I'll try to start looking for where I can use captures and sets in productive ways.

  5. #5405
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Roland_J View Post
    Neat, thanks dlsmd! I'll try to start looking for where I can use captures and sets in productive ways.
    np but i got this qwrong
    (...) this says grab this to variable
    but i have no idea what the % outside of the () does because to search for a % you need to use %%

  6. #5406
    Relic Shield
    Join Date
    Oct 2007
    Posts
    1,552
    BG Level
    6

    So I've just come back to the game and am in need of a simple gearswap for BLU - nothing like the ones circulating right now with a million gearsets, as I don't have the gear, and I'm finding gearswap to be a lot harder to 'read' than spellcast XMLs.

    I just want to have:

    idle - not engaged
    tp - engaged
    ws
    physmagic
    magic

    sets for now. Any info out there for something this basic? I've looked around and can't seem to find anything.

  7. #5407
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Fallyn View Post
    So I've just come back to the game and am in need of a simple gearswap for BLU - nothing like the ones circulating right now with a million gearsets, as I don't have the gear, and I'm finding gearswap to be a lot harder to 'read' than spellcast XMLs.

    I just want to have:

    idle - not engaged
    tp - engaged
    ws
    physmagic
    magic

    sets for now. Any info out there for something this basic? I've looked around and can't seem to find anything.
    here is a vary basic version
    Code:
    function get_sets()
        sets.Engaged = {}-- your engaged gear
        sets.Idle = {}-- your idle gear
        sets.Physical = {}-- your Physical Magic gear
        sets.Magic = {}-- your normal Magic gear
        sets.WeaponSkill = {}-- your WeaponSkill gear
    end
    function status_change(new,old)
        if sets[new] then
            equip(sets[new])
        end
    end
    function precast(spell)
        if sets[spell.element] then
            equip(sets[spell.element])
        elseif sets[spell.type] then
            equip(sets[spell.type])])
        elseif spell.action_type == "Magic" then
            equip(sets.Magic)
        end
    end
    function aftercast(spell)
        if sets[player.status] then
            equip(sets[player.status])
        end
    end

  8. #5408
    Relic Shield
    Join Date
    Oct 2007
    Posts
    1,552
    BG Level
    6

    Marvellous! That's just want i wanted dlsmd, thanks.

    Is there room to stick precast gearset in too? Totally forgot about that, I have a fair bit of FC gear I can stick on.

  9. #5409
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Fallyn View Post
    Marvellous! That's just want i wanted dlsmd, thanks.

    Is there room to stick precast gearset in too? Totally forgot about that, I have a fair bit of FC gear I can stick on.
    every thing in what i showed you was in precast
    Fast Cast is harder to do and is way more complicated and for that your better off not rebuilding what others have done

  10. #5410
    Relic Shield
    Join Date
    Oct 2007
    Posts
    1,552
    BG Level
    6

    Quote Originally Posted by dlsmd View Post
    every thing in what i showed you was in precast
    Fast Cast is harder to do and is way more complicated and for that your better off not rebuilding what others have done
    Ah right okay! Thanks again.

  11. #5411
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Fallyn View Post
    Ah right okay! Thanks again.
    you are welcome

    if you need help with code that you cant get to work correctly please don't hesitate to as for help
    writing all your code would take more time then i have

    for example my gearswap include took me over a year to create and its still a work in progress
    --2200+ lines
    --100000+ char length

  12. #5412
    Relic Shield
    Join Date
    Oct 2007
    Posts
    1,552
    BG Level
    6

    Quote Originally Posted by dlsmd View Post
    you are welcome

    if you need help with code that you cant get to work correctly please don't hesitate to as for help
    writing all your code would take more time then i have

    for example my gearswap include took me over a year to create and its still a work in progress
    --2200+ lines
    --100000+ char length
    Yeah I will be back if I run into issues - used to ahve some pretty long spellcasts but the .lua format is throwing me off a bit, just need to get my head around it.

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

    Quote Originally Posted by Fallyn View Post
    Yeah I will be back if I run into issues - used to have some pretty long spellcasts but the .lua format is throwing me off a bit, just need to get my head around it.
    it works like a formal programing language this might be some help https://www.lua.org/pil/1.html

  14. #5414
    Graduate of the BG School of FFXI
    Join Date
    Apr 2010
    Posts
    4,927
    BG Level
    7
    FFXIV Character
    Misses Beansman
    FFXIV Server
    Adamantoise
    FFXI Server
    Quetzalcoatl

    Does anyone have a recent SCH lua? I cant seem to find one that doesn't date back to 2014.

  15. #5415
    CDF
    CDF is offline
    Sea Torques
    Join Date
    Dec 2007
    Posts
    599
    BG Level
    5

    There's one based off Mote's includes...
    https://drive.google.com/drive/u/0/f...U5xLWZEMEFUNWM

  16. #5416
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    Is it possible to reload/update the Get_sets() function manually, with a command?

    If you're wondering why, spoiler!
    Spoiler: show
    I want to use a variable for my main hand on several sets. Of course we all know that what happens is Gearswap reads the content of Get_sets() and "translates" the content of a variable into a fixed set.
    So if you change the content of that variable during the course of your Lua somwhere else, that change won't reflect on the sets which use that variable, which will use whatever the content of the variable was at start.
    For example:

    Code:
    Get_sets()
    WeaponVar = Bravura
    Set1 {main=WeaponVar}
    end
    
    custom function
    WeaponVar = Ragnarok
    end
    In the above example me changing WeaponVar to Ragnarok will produce no effect on Set1 which will be a "fixed" set with the "main" value set to "Bravura" once Gearswap reaches the line "end" of the Get_sets() function.

    Now I could of course address this issue in a completely different way like I did in other Luas, but that would require me to change A FUCKTON of stuff in this current Lua, and I'm very lazy.
    If I could just manually reload/update the content of Get_sets() I'd be able to avoid doing that <3

  17. #5417
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Sechs View Post
    Is it possible to reload/update the Get_sets() function manually, with a command?

    If you're wondering why, spoiler!
    Spoiler: show
    I want to use a variable for my main hand on several sets. Of course we all know that what happens is Gearswap reads the content of Get_sets() and "translates" the content of a variable into a fixed set.
    So if you change the content of that variable during the course of your Lua somwhere else, that change won't reflect on the sets which use that variable, which will use whatever the content of the variable was at start.
    For example:

    Code:
    Get_sets()
    WeaponVar = Bravura
    Set1 {main=WeaponVar}
    end
    
    custom function
    WeaponVar = Ragnarok
    end
    In the above example me changing WeaponVar to Ragnarok will produce no effect on Set1 which will be a "fixed" set with the "main" value set to "Bravura" once Gearswap reaches the line "end" of the Get_sets() function.

    Now I could of course address this issue in a completely different way like I did in other Luas, but that would require me to change A FUCKTON of stuff in this current Lua, and I'm very lazy.
    If I could just manually reload/update the content of Get_sets() I'd be able to avoid doing that <3
    you really dont need to because you can do it like i did for smn staves
    Code:
    function get_sets()
        Pettype = {}
        Pettype.Summon = {}
        Pettype.Summon.weapon = {
            ['None'] = {name="Eminent Pole"},
            ['Fire'] = {name="Atar III"},
            ['Ice'] = {name="Vourukasha III"},
            ['Wind'] = {name="Vayuvata III"},
            ['Earth'] = {name="Vishrava III"},
            ['Thunder'] = {name="Apamajas III"},
            ['Water'] = {name="Haoma III"},
            ['Light'] = {name="Arka III"},
            ['Dark'] = {name="Xsaeta III"},
        }
        pet_main = Pettype.Summon.weapon['None']
        sets.weapon['Staff'] = {main=pet_main,sub="Danger Grip"}
    end
        
    function self_command(command)
        if command == "tchangeSMNstaff" then
            Changesumstaff = not Changesumstaff
            if Changesumstaff then
                pet_main.name = Pettype.Summon.weapon[pet.element].name
            else
                pet_main.name = Pettype.Summon.weapon["None"].name
            end
        end
    end
    here is an example
    Code:
    function get_sets()
        Weapons = {
                    ['Bravura'] = {name="Bravura"},
                    ['Ragnarok'] = {name="Ragnarok"},
                  }
        WeaponVar = Weapons["Bravura"]
        sets[1] = {main=WeaponVar}
    end
    
    function custom()
        WeaponVar.name = Weapons["Ragnarok"].name
    end
    but if you really want to run get_sets() again just do so but any variables that are in get_sets() will be reset to what your file says
    example:
    if you have this
    Code:
    function get_sets()
        WeaponVar = "Bravura"
        sets[1] = {main=WeaponVar}
    end
    when you run get_sets() you will always reset back to WeaponVar = "Bravura"

  18. #5418
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    Oh... a set and then a variable, that's a neat idea.
    The way I solve it in another Lua is in the Aftercast and Status_change functions.
    Basically there I have a lot of stuff among which lines that equip my idle set and my TP (engaged) sets.
    I removed the "main" from my idle and TP sets (which have no Main slot at all) and then inside Aftercast and Status_change I combine the sets with "equip (sets.tp, sets[varname])", and I do the same for TP of course.
    It kinda works but going that way with my current lua would require a lot of work. Tbf your double set solution would require a lot of work.

    In the end I don't really like to run Get_sets() again... so I guess I will have to un-lazy myself.


    Thanks for the source of inspiration regardless! <3

  19. #5419
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Sechs View Post
    Oh... a set and then a variable, that's a neat idea.
    The way I solve it in another Lua is in the Aftercast and Status_change functions.
    Basically there I have a lot of stuff among which lines that equip my idle set and my TP (engaged) sets.
    I removed the "main" from my idle and TP sets (which have no Main slot at all) and then inside Aftercast and Status_change I combine the sets with "equip (sets.tp, sets[varname])", and I do the same for TP of course.
    It kinda works but going that way with my current lua would require a lot of work. Tbf your double set solution would require a lot of work.

    In the end I don't really like to run Get_sets() again... so I guess I will have to un-lazy myself.


    Thanks for the source of inspiration regardless! <3
    then you have not seen how my include works my WAR get_sets() is this
    Code:
    function gear_setup()
        if dwsj() then
            sets.weapon['Axe'] = {main="Eminent Axe",sub="Eminent Scimitar"}
            sets.weapon['Dagger'] = {main="Eminent Dagger",sub="Eminent Scimitar"}
            sets.weapon['Sword'] = {main="Eminent Scimitar",sub="Eminent Dagger"}
        end
        sets.weapon['Great_Axe'] = {main="Eminent Voulge",sub="Uther's Grip"}
        sets.weapon['Great_Sword'] = {main="Eminent Sword",sub="Uther's Grip"}
        sets.weapon['Hand-to-Hand'] = {main="Em. Baghnakhs",ammo=empty}
        sets.weapon['Scythe'] = {main="Eminent Sickle",sub="Uther's Grip"}
        sets.weapon['None'] = {main=empty,sub=empty}
        sets.weapon['Great_Axe Su2'] = {main="Blurred Cleaver",sub="Uther's Grip"}
        sets.range['Marksmanship'] = {range="Lion Crossbow",ammo="Crossbow Bolt"}
        sets.range['Throwing'] = {range="Snakeeye",ammo=empty}
        sets.armor['Basic'] = {}
        sets.armor['Capacity_Points'] = {back="Aptitude Mantle +1",}
        sets.Engaged = {
            head="Gefechtschaller",
            body="Gefechtbrust",
            hands="Gefechthentzes",
            legs="Gefechtdiechlings",
            feet="Gefechtschuhs",
            neck={ name="Wivre Gorget", augments={'"Subtle Blow"+4','MP+3',}},
            waist="Marid Belt",
            left_ear="Impreg. Earring",
            right_ear="Upsurge Earring",
            left_ring="Enlivened Ring",
            right_ring="Vehemence Ring",
            back="Cerberus Mantle",
            }
        sets.Idle = {
            head="Gefechtschaller",
            body="Gefechtbrust",
            hands="Gefechthentzes",
            legs="Gefechtdiechlings",
            feet="Gefechtschuhs",
            neck={ name="Wivre Gorget", augments={'"Subtle Blow"+4','MP+3',}},
            waist="Marid Belt",
            left_ear="Impreg. Earring",
            right_ear="Upsurge Earring",
            left_ring="Enlivened Ring",
            right_ring="Vehemence Ring",
            back="Cerberus Mantle",
            }
        sets.Resting = {
            head="Gefechtschaller",
            body="Gefechtbrust",
            hands="Gefechthentzes",
            legs="Gefechtdiechlings",
            feet="Gefechtschuhs",
            neck={ name="Wivre Gorget", augments={'"Subtle Blow"+4','MP+3',}},
            waist="Marid Belt",
            left_ear="Sanative Earring",
            right_ear="Upsurge Earring",
            left_ring="Enlivened Ring",
            right_ring="Vehemence Ring",
            back="Cerberus Mantle",
            }
        sets.pretarget["Tomahawk"] = {range=empty,ammo="Thr. Tomahawk"}
        sets.precast["Mighty Strikes"] = {hands="Agoge Mufflers +1"}
        sets.precast["Berserk"] = {body="Pumm. Lorica +1",feet="Agoge Calligae +1"}
        sets.precast["Warcry"] = {head="Agoge Mask +1"}
        sets.precast["Aggressor"] = {head="Pumm. Mask +1",body="Agoge Lorica +1"}
        sets.precast["Retaliation"] = {hands="Pumm. Mufflers +1",feet="Boii Calligae +1"}
        sets.precast["Warrior's Charge"] = {legs="Agoge Cuisses +1"}
        sets.precast["Tomahawk"] = {range=empty,ammo="Thr. Tomahawk",feet="Agoge Calligae +1"}
        sets.precast["Restraint"] = {hands="Boii Mufflers +1"}
        sets.precast["Blood Rage"] = {body="Boii Lorica +1"}
    end
    then i build my sets like this
    Code:
    function gear_equip_check(tab,event)
        if tab and type(tab) == "table" and tab.type and S{"WeaponSkill","Samba","Waltz"}:contains(tab.type) and event == "precast" then
            return false
        end
        return true
    end
    function gear_equip(tab,event)
        sets.building[event] = sets[player.status]
        if sets.armor[armor_types[armor_types_count]] then
            sets.building[event] = set_combine(sets.building[event], sets.armor[armor_types[armor_types_count]])
        end
        if gear_equip_check(tab,event) then
            if sets.weapon[weapon_types[weapon_types_count]] then
                sets.building[event] = set_combine(sets.building[event], sets.weapon[weapon_types[weapon_types_count]])
            end
            if sets.range[range_types[range_types_count]] then
                sets.building[event] = set_combine(sets.building[event], sets.range[range_types[range_types_count]])
            end
        end
    end
    and then i equip my gear with equip(sets.building[event])

  20. #5420
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    I love you dlsmd <3

Page 271 of 302 FirstFirst ... 221 261 269 270 271 272 273 281 ... LastLast

Similar Threads

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