Item Search
     
BG-Wiki Search
Page 48 of 302 FirstFirst ... 38 46 47 48 49 50 58 98 ... LastLast
Results 941 to 960 of 6036

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

  1. #941
    Melee Summoner
    Join Date
    Feb 2014
    Posts
    48
    BG Level
    1

    is there a way to change spell based on recast timer not being up yet?

  2. #942
    Sea Torques
    Join Date
    Jul 2010
    Posts
    516
    BG Level
    5
    FFXI Server
    Bahamut

    You'd have to use the get_spell_recasts() function in order to check if the recast was up.
    Code:
    get_spell_recasts()
    
    Returns a table containing all spells and their cooldowns. The key of this table is the spell ID, the values are the time in 1/60 second increments that remain on the cooldown.
    It's a windower Lua interface function, not part of GearSwap. I'm not sure how to call them, but this might work(?).

    Something like
    Code:
    _recasts=windower.get_spell_recasts()
    
    function precast(spell)
    
    if spell.name == 'name' then
    if _recasts[spell id] > 0 then .................. end
    end

  3. #943
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Bleh, tons of things to answer that I missed in the last couple days. Working through them sequentially, so may duplicate some other answers.


    Quote Originally Posted by dlsmd View Post
    ok i got confused there for a min

    would this be the command for changing variables??

    //gs c set <state> <value>
    Correct. You can use the 'set' command to assign a specific value to a state variable, the 'toggle' command to change between true and false for a boolean state variable, or the 'cycle' command to increment through a list of option values associated with a state variable.


    Quote Originally Posted by dlsmd View Post
    also what function should i put it under so it can be changed at any time??
    I'm not sure I understand the question? //gs c set <state> <value> doesn't go in any function. It's handled in the include library. You can enter it at the command line, make a macro for it (prefix with /console), or use a keybind (don't use the // prefix).

    Quote Originally Posted by dlsmd View Post
    also would this work
    h??p://pastebin.com/JGWQths5
    No. Assuming you're making a _gear sidecar file, you can override the init_gear_sets() function, but you do -not- want to use the get_sets() function. That's handled within the base job lua file. Overriding it screws lots of things up. [Edit: Assuming you're using a _gear sidecar file because your file includes a user_setup() function call, which is part of my include structure.]

    However, if you just change the name of the function to init_gear_sets, you're fine in that regard.

    Code:
    if not string.find(spell.english,'Cur') then
    Don't use this to determine cure spells. It can fail in multiple different ways.

    What you want is:

    Code:
    if spell.english:startswith('Cure') or spell.english:startswith('Cura') then

    Code:
    if spell.element == world.weather_element or spell_element == world.day_element and sets.Obi[spell.element] then
    Three errors:
    spell.element, not spell_element
    Use parentheses around the two element checks, before testing the obi. Otherwise you get unexpected results.

    Code:
    if (spell.element == world.weather_element or spell.element == world.day_element) and sets.Obi[spell.element] then

  4. #944
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by Fival View Post
    I'm having trouble dealing with augments, more specifically, typing the exact description interferes with the line itself and gearswap doesn't read this because of the quotation marks around "Store TP", any advice?
    Code:
    body={name="Xaddi Mail",augments={"[1]Attack+15,[2]Accuracy+10,[3]"Store TP"+3"}}
    Need to check with Byrth, but aren't you not supposed to be using the numeric [1]/[2]/[3] prefix values when you specify an augment?

  5. #945
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by arshesney View Post
    you can define a table:
    Code:
    no_swap_spells = S{"Escape","Warp","Warp II", other spells}
    then, wherever you're handling swaps (if using Mote's files use eventArgs.handled = true to stop processing):
    Code:
    if no_swap_spells[spell.name] then
    return
    end
    Extra note: use :contains(), not the [] indexing, when searching for the existence of a value within a set. [] can sometimes break, and :contains() is faster anyway.

    So:

    Code:
    if no_swap_spells:contains(spell.english) then

  6. #946
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by dlsmd View Post
    ok thats cool but what is this S for
    = S{"E

    S{} is one of three general types of collections that are available to you in GearSwap. They're defined in the general lua libraries that Windower includes. The three types:

    T{} - A table. Standard "Item A"="Value B" collection, where order isn't important. Gives access to the various standard collection functions, which a default table {} won't have.
    S{} - A set. Arbitrary unordered list of key values. Their value is always boolean true. Useful when all you care about is whether a key value exists or not. Also useful for set operations that you may remember from your algebra class, like unions and intersections and such.
    L{} - A list. A list of values with a specific ordering. A, B, C will always show up in the order of A, B, C, and never as C, A, B or whatever. This is the only type of table that guarantees results will always retain their defined order.


    So, for the example given to you, all you care about is the specific spell names ("Escape", "Warp", etc). Their order doesn't matter, and you're not associating a value with each spell, but you want to be able to do a quick lookup to see if the spell exists in the list. That's exactly what a set S{} is good for.


    Quote Originally Posted by dlsmd View Post
    could i do it like this as well
    if spell.name == spells.transport then
    return
    end

    with this
    spells.transport = S{"Escape","Warp","Warp II", other spells}
    No. spell.name == spells.transport would be comparing the name of the spell with the entire list of transport spells. That list is a table reference, and thus a number representing a location in memory. That will never, ever be a valid comparison.

  7. #947
    Sea Torques
    Join Date
    Jul 2010
    Posts
    516
    BG Level
    5
    FFXI Server
    Bahamut

    Code:
    function get_sets()
             ws_hat = {"Otomi Helm", "Mekira-Oto +1"}
             ws_index = 1
    
    sets.precast.WS["Stardiver"][0] = { 
        ammo="Thew Bomblet",
        head=ws_hat[ws_index],
        body="Miki. Breastplate",
        hands="Miki. Gauntlets",
        legs="Cizin Breeches +1",
        feet="Mikinaak Greaves",
        neck="Light Gorget",
        waist="Light Belt",
        left_ear="Brutal Earring",
        right_ear="Moonshade Earring",
        left_ring="Pyrosoul Ring",
        right_ring="Pyrosoul Ring",
        back="Atheling Mantle"
    }
    end
    
    function precast(spell)
    	if spell.type== 'WeaponSkill' then
    		if world.day == 'Earthsday' or world.day=='Lightsday' or  world.day=='Darksday' then ws_index=2 else ws_index=1 end
    	end
    end
    I'm pretty sure I know why this doesn't work now. The get_sets() is only called once on load. I assumed that it would store the variable ws_index, but it probably stores the value ws_hat[ws_index], or Otomi Helm. Changing the value of ws_hat[ws_index] in the precast function doesn't work since the get_sets() function is never called again. In case anyone had a similar problem.

  8. #948
    Sea Torques
    Join Date
    Jun 2012
    Posts
    570
    BG Level
    5
    FFXI Server
    Asura
    WoW Realm
    The Scryers

    Quote Originally Posted by TSFFXI View Post
    Code:
    function get_sets()
             ws_hat = {"Otomi Helm", "Mekira-Oto +1"}
             ws_index = 1
    
    sets.precast.WS["Stardiver"][0] = { 
        ammo="Thew Bomblet",
        head=ws_hat[ws_index],
        body="Miki. Breastplate",
        hands="Miki. Gauntlets",
        legs="Cizin Breeches +1",
        feet="Mikinaak Greaves",
        neck="Light Gorget",
        waist="Light Belt",
        left_ear="Brutal Earring",
        right_ear="Moonshade Earring",
        left_ring="Pyrosoul Ring",
        right_ring="Pyrosoul Ring",
        back="Atheling Mantle"
    }
    end
    
    function precast(spell)
    	if spell.type== 'WeaponSkill' then
    		if world.day == 'Earthsday' or world.day=='Lightsday' or  world.day=='Darksday' then ws_index=2 else ws_index=1 end
    	end
    end
    I'm pretty sure I know why this doesn't work now. The get_sets() is only called once on load. I assumed that it would store the variable ws_index, but it probably stores the value ws_hat[ws_index], or Otomi Helm. Changing the value of ws_hat[ws_index] in the precast function doesn't work since the get_sets() function is never called again. In case anyone had a similar problem.
    this "should" work

    Code:
    function get_sets()
             ws_index = 1
    		 
             ws_hat = {}
    		 ws_hat[1] = {"Otomi Helm"}
    		 ws_hat[2] = {"Mekira-Oto +1"}
             
    
    
    sets.precast.WS["Stardiver"] = { 
        ammo="Thew Bomblet",
        head=ws_hat[ws_index],
        body="Miki. Breastplate",
        hands="Miki. Gauntlets",
        legs="Cizin Breeches +1",
        feet="Mikinaak Greaves",
        neck="Light Gorget",
        waist="Light Belt",
        left_ear="Brutal Earring",
        right_ear="Moonshade Earring",
        left_ring="Pyrosoul Ring",
        right_ring="Pyrosoul Ring",
        back="Atheling Mantle"
    }
    end
    
    function precast(spell)
    	if spell.type== 'WeaponSkill' then
    		if world.day == 'Earthsday' or world.day=='Lightsday' or  world.day=='Darksday' then 
    			ws_index=2 
    		else 
    			ws_index=1 end
    	end
    end
    actually... shouldn't... and you practically gave the reason in the last post.. but they are many works around like

    Code:
    function get_sets()
             ws_index = 1
    		 
             ws_hat = {}
    		 ws_hat[1] = {head="Otomi Helm"}
    		 ws_hat[2] = {head="Mekira-Oto +1"}
             
    
    
    sets.precast.WS["Stardiver"] = { 
        ammo="Thew Bomblet",
        body="Miki. Breastplate",
        hands="Miki. Gauntlets",
        legs="Cizin Breeches +1",
        feet="Mikinaak Greaves",
        neck="Light Gorget",
        waist="Light Belt",
        left_ear="Brutal Earring",
        right_ear="Moonshade Earring",
        left_ring="Pyrosoul Ring",
        right_ring="Pyrosoul Ring",
        back="Atheling Mantle"
    }
    end
    
    function precast(spell)
    	if spell.type== 'WeaponSkill' then
    		if world.day == 'Earthsday' or world.day=='Lightsday' or  world.day=='Darksday' then 
    			ws_index=2 
    		else 
    			ws_index=1 
    		end
    	end
    
    	if spell.name == "Stardiver" then
    			equip(sets.precast[spell.name])
    			equip(ws_hat[ws_index])
    	end
    end

  9. #949
    Sea Torques
    Join Date
    Jul 2010
    Posts
    516
    BG Level
    5
    FFXI Server
    Bahamut

    I think that's the same thing. It was my understanding that this
    Code:
    table={"apples","oranges"}
    is the same as
    Code:
    table={}
    table[1]="apples"
    table[2]="oranges"
    since they're really both short forms of
    Code:
    table={[1]="apples",[2]="oranges"}
    In the same way:
    Code:
    table = {}
    table.a = {"apples"}
    table.b = {"oranges"}
    is equivalent to
    Code:
    table={a="apples",b="oranges"}
    Or if you really want to confuse people
    Code:
    table={"apricots",a="apples",b="oranges"}
    is the same as
    Code:
    table={}
    table.a="apples"
    table.b="oranges"
    table[1]="apricots"
    If you don't pick a name for the key, Lua assigns it a number.


    Edit: Oh, sorry JSHidaka, I somehow didn't see your edit before replying. Thanks for an easy workaround.

  10. #950
    BG Content
    Join Date
    Jul 2007
    Posts
    22,393
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Everything you've said is correct, as is your analysis of why the code doesn't work.

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

    ok im having a serious issue trying to use an include

    this is my main file called SAM.lua
    http://pastebin.com/JMHJHwYB

    this is my include called WS2.lua
    http://pastebin.com/4QxMPXt9

    ever time i use a weapon skill i keep getting the same error
    Gearswap has detected an error in the user function precast:
    (removed folder info)WS2.lua:244: attempt to call index field 'ws' (a nil value)

    i have run both individualy and thay work just fine but when i add the include thats when thay error

  12. #952
    BG Content
    Join Date
    Jul 2007
    Posts
    22,393
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    You define the function get_sets() twice (once in each document). There's no need to put all your WS info in the get_sets() function, so just eliminate the function call there. Also, eliminate sets = {}.

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

    Quote Originally Posted by Byrthnoth View Post
    You define the function get_sets() twice (once in each document). There's no need to put all your WS info in the get_sets() function, so just eliminate the function call there. Also, eliminate sets = {}.
    but i have the percast() function in both as well but thay just over lap

    but anyways
    like this??
    http://pastebin.com/QNDg2kGT

  14. #954
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by TSFFXI View Post
    Code:
    function get_sets()
             ws_hat = {"Otomi Helm", "Mekira-Oto +1"}
             ws_index = 1
    
    sets.precast.WS["Stardiver"][0] = { 
        ammo="Thew Bomblet",
        head=ws_hat[ws_index],
        body="Miki. Breastplate",
        hands="Miki. Gauntlets",
        legs="Cizin Breeches +1",
        feet="Mikinaak Greaves",
        neck="Light Gorget",
        waist="Light Belt",
        left_ear="Brutal Earring",
        right_ear="Moonshade Earring",
        left_ring="Pyrosoul Ring",
        right_ring="Pyrosoul Ring",
        back="Atheling Mantle"
    }
    end
    
    function precast(spell)
    	if spell.type== 'WeaponSkill' then
    		if world.day == 'Earthsday' or world.day=='Lightsday' or  world.day=='Darksday' then ws_index=2 else ws_index=1 end
    	end
    end
    I'm pretty sure I know why this doesn't work now. The get_sets() is only called once on load. I assumed that it would store the variable ws_index, but it probably stores the value ws_hat[ws_index], or Otomi Helm. Changing the value of ws_hat[ws_index] in the precast function doesn't work since the get_sets() function is never called again. In case anyone had a similar problem.
    Very simplified method to get what you want:

    Code:
    function get_sets()
        mekira_days = S{"Earthsday", "Lightsday", "Darksday"}
        headgear_if = T{true = "Mekira-Oto +1", false = "Otomi Helm"}
        ws_headgear = {name="Otomi Helm"}
    
        set.precast.WS = {head=ws_headgear}
    end
    
    
    function precast()
        if spell.type== 'WeaponSkill' then
            ws_headgear.name = headgear_if[mekira_days:contains(world.day)]
    
            equip(set.precast.WS)
        end
    end
    Or, if you want it per weaponskill:

    Code:
    function get_sets()
        mekira_days = T{}
        mekira_days.Stardiver = S{"Earthsday", "Lightsday", "Darksday"}
    
        headgear_if = T{true = "Mekira-Oto +1", false = "Otomi Helm"}
        ws_headgear = {name="Otomi Helm"}
    
        set.precast.WS = {head=ws_headgear}
    end
    
    
    function precast()
        if spell.type== 'WeaponSkill' then
            ws_headgear.name = headgear_if[mekira_days:contains(spell.english) and mekira_days[spell.english]:contains(world.day)]
    
            equip(set.precast.WS)
        end
    end

  15. #955
    BG Content
    Join Date
    Jul 2007
    Posts
    22,393
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Yeah! You're going to want to avoid calling precast twice as well. Something like this:
    http://pastebin.com/P0X5j9f2

    And then add this line to the precast function of sam.lua:
    Code:
    elemental_ws_gear(spell)
    Then you've started to build a library (a file with a common purpose/functions that can be used in multiple documents) with your WS2.lua. Each document would have to use elemental_ws_gear(spell) in precast.


    This would be another way to do the same thing: http://pastebin.com/5WXTCh9J
    You would just call WS_Library.equip_neck(spell) when you want to equip the right gorget, WS_Library.equip_waist(spell) when you want to equip the right belt, or WS_Library.equip_hachimaki(spell) when you want to equip the right hachimaki.

  16. #956
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by dlsmd View Post
    ok im having a serious issue trying to use an include

    this is my main file called SAM.lua
    http://pastebin.com/JMHJHwYB

    this is my include called WS2.lua
    http://pastebin.com/4QxMPXt9

    ever time i use a weapon skill i keep getting the same error
    Gearswap has detected an error in the user function precast:
    (removed folder info)WS2.lua:244: attempt to call index field 'ws' (a nil value)

    i have run both individualy and thay work just fine but when i add the include thats when thay error
    Order of operations:

    1) sets = {} is defined by GearSwap.
    2) Sam.lua is loaded and processed. It's now an object in memory.
    2a) Loaded lua now includes the functions: get_sets(), precast(), midcast(), aftercast(), status_change(), buff_change().
    3) GearSwap calls the lua's get_sets() function.
    4) get_sets() calls the include() function.
    5) The include() function loads the ws2.lua file, and tries to add the things that that file defines to the existing user object in memory.
    6) ws2.lua defines precast(). This replaces the existing precast() that sam.lua defined.
    7) ws2.lua defines get_sets(). This tries to replace the existing get_sets() function. However that can be problematic because you're inside the get_sets() function right now. Most likely it doesn't work, but even if it does it will never be called (GearSwap only ever calls that function once).

    8) You attempt an action, which calls precast(). precast() is the version inside the ws2.lua file, which tries to access sets.ws.element without checking to see if it exists first.
    9) sets.ws and sets.ws.element is only defined in the get_sets() function in ws2.lua. That function was (probably) never loaded, and (definitely) wasn't run. Thus sets.ws and sets.ws.element don't exist.
    10) Error for trying to access table values that don't exist.

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

    Quote Originally Posted by Byrthnoth View Post
    Yeah! You're going to want to avoid calling precast twice as well. Something like this:
    http://pastebin.com/P0X5j9f2

    And then add this line to the precast function of sam.lua:
    Code:
    elemental_ws_gear(spell)
    Then you've started to build a library (a file with a common purpose/functions that can be used in multiple documents) with your WS2.lua. Each document would have to use elemental_ws_gear(spell) in precast.


    This would be another way to do the same thing: http://pastebin.com/5WXTCh9J
    You would just call WS_Library.equip_neck(spell) when you want to equip the right gorget, WS_Library.equip_waist(spell) when you want to equip the right belt, or WS_Library.equip_hachimaki(spell) when you want to equip the right hachimaki.
    Quote Originally Posted by Motenten View Post
    Order of operations:

    1) sets = {} is defined by GearSwap.
    2) Sam.lua is loaded and processed. It's now an object in memory.
    2a) Loaded lua now includes the functions: get_sets(), precast(), midcast(), aftercast(), status_change(), buff_change().
    3) GearSwap calls the lua's get_sets() function.
    4) get_sets() calls the include() function.
    5) The include() function loads the ws2.lua file, and tries to add the things that that file defines to the existing user object in memory.
    6) ws2.lua defines precast(). This replaces the existing precast() that sam.lua defined.
    7) ws2.lua defines get_sets(). This tries to replace the existing get_sets() function. However that can be problematic because you're inside the get_sets() function right now. Most likely it doesn't work, but even if it does it will never be called (GearSwap only ever calls that function once).

    8) You attempt an action, which calls precast(). precast() is the version inside the ws2.lua file, which tries to access sets.ws.element without checking to see if it exists first.
    9) sets.ws and sets.ws.element is only defined in the get_sets() function in ws2.lua. That function was (probably) never loaded, and (definitely) wasn't run. Thus sets.ws and sets.ws.element don't exist.
    10) Error for trying to access table values that don't exist.
    now that i know the error i think i know how im going to change it

  18. #958
    Sea Torques
    Join Date
    Jul 2010
    Posts
    516
    BG Level
    5
    FFXI Server
    Bahamut

    Quote Originally Posted by Motenten View Post
    Very simplified method to get what you want:
    Thanks, that's a really cool way of picking between helms. There's one part I don't understand- if I define set.precast.WS.head = ws_headgear in the get_sets() function, and ws_headgear is a table, won't it define the head slot as the table's identifier in memory? Will that be locked in, similar to how I was unable to change it earlier?

  19. #959
    BG Content
    Join Date
    Jul 2007
    Posts
    22,393
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Interestingly, no. Table assignments in Lua connect the key with the table reference, as you can see by printing a tostring'd table. Tables maintain the same reference until they are reassigned or nil'd, so you can change values in them and the keys that reference them will also see the change. That is another use for advanced set tables. If you look a few pages back I include it in various examples of how to solve this problem.

  20. #960
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by TSFFXI View Post
    Thanks, that's a really cool way of picking between helms. There's one part I don't understand- if I define set.precast.WS.head = ws_headgear in the get_sets() function, and ws_headgear is a table, won't it define the head slot as the table's identifier in memory? Will that be locked in, similar to how I was unable to change it earlier?
    No, because of one particular trick: name. Because of how GearSwap handles augmented items, if it finds a table in an equip slot, and that table has a name value, it treats that name as the item to be equipped. We didn't add anything else to the table for augments or order of eqiupping items, so nothing else gets changed. However, because we're changing a value -inside- the table (ie: name), it's valid to manipulate while leaving the table itself static as part of the set definition.

Page 48 of 302 FirstFirst ... 38 46 47 48 49 50 58 98 ... LastLast

Similar Threads

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