Item Search
     
BG-Wiki Search
Closed Thread
Page 12 of 302 FirstFirst ... 2 10 11 12 13 14 22 62 ... LastLast
Results 221 to 240 of 6036

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

  1. #221
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by JSHidaka View Post
    Using only this:
    Code:
        if (spell.target.distance >21) then
            cancel_spell()
        end
    will cancel any spell if the target is 21+ right? (guess will do.. just to confirm... yesterday Soloing AATT... did waste many WS 'coz the max-distance -_-)
    Well that would normally be acceptable, if some of my WS didn't also find 8 yalms to be too far (ie: blast shot, or melee WS can't normally be used beyond 8' and it will still spend your TP anyways).

    Though I do wonder if GearSwap or Windower in general has a way of checking the spell's "max distance".

  2. #222
    BG Content
    Join Date
    Jul 2007
    Posts
    21,140
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Code:
    get_sets()
        DefaultGunAmmo = {ammo="Titanium Bullet"}
        DefaultBowAmmo = {ammo="Tulfaire Arrow"}
        DefaultXBowAmmo = {ammo="Dark Adaman Bolt"}
        DefaultAmmo = DefaultGunAmmo
    end
    
    precast(spell)
        if player.equipment.range == 'Eminent Gun' then
            DefaultAmmo = DefaultGunAmmo
        elseif player.equipment.range == 'Eminent Bow' then
            DefaultAmmo = DefaultBowAmmo
        elseif player.equipment.range == 'Eminent Crossbow' then
            DefaultAmmo = DefaultXBowAmmo
        end
    end
    The code in precast has to go above the first time you use the DefaultAmmo variable.

    Edit: Yes, JSH

  3. #223
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Far as the WS distance, could I not do something like this ?
    Code:
        if ((spell.target.distance >8 and !ranged_ws[spell.name]) or (spell.target.distance >21)) and (spell.name != 'Ranged') then
            cancel_spell()
        end
    That way there's no need to define a short WS, only the WSes that are allowed to be used above 8 but below 21. (not sure if ! negation works in Lua)

  4. #224
    BG Content
    Join Date
    Jul 2007
    Posts
    21,140
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    != is ~= in Lua. !(condition) is not (condition).

    This might be better
    Code:
    if (spell.target.distance>8 and spell.prefix == '/weaponskill' and not ranged_ws[spell.name]) or (spell.target.distance > 21 and spell.prefix == '/weaponskill') then
        cancel_spell()
    end

  5. #225
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    This is what I ended up with so far for RNG.lua in case others are curious.
    pastebin /KHeDLkPv

    Code:
    -------------------------------------------------------------------------------------------------------------------
    -- Initialization function that defines sets and variables to be used.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Last Modified: 1/4/2014 6:07:55 PM
    
    -- IMPORTANT: Make sure to also get the Mote-Include.lua file to go with this.
    
    function get_sets()
    	-- Load and initialize the include file that this depends on.
    	include('Mote-Include.lua')
    	init_include()
    	
    	-- Options: Override default values
    	options.OffenseModes = {'Normal', 'Acc'}
    	options.DefenseModes = {'Normal', 'Evasion', 'PDT'}
    	options.WeaponskillModes = {'Normal', 'Acc', 'Att', 'Mod'}
    	options.CastingModes = {'Normal'}
    	options.IdleModes = {'Normal'}
    	options.RestingModes = {'Normal'}
    	options.PhysicalDefenseModes = {'PDT', 'Evasion'}
    	options.MagicalDefenseModes = {'MDT'}
    
    	state.Defense.PhysicalMode = 'PDT'
    
    	--------------------------------------
    	-- Start defining the sets
    	--------------------------------------
    	
    	U_Shot_Ammo = S{'Aeolus Arrow','Animikii Bullet','Crossbow Bolt'}
    	DefaultGun = "Eminent Gun"
    	DefaultBow = "Eminent Bow"
    	DefaultXBow = "Eminent Crossbow"
    	DefaultGunAmmo = {ammo="Titanium Bullet"}
        DefaultBowAmmo = {ammo="Tulfaire Arrow"}
        DefaultXBowAmmo = {ammo="Dark Adaman Bolt"}
        DefaultAmmo = DefaultBowAmmo
    	
        ranged_ws = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Blast Arrow", "Arching Arrow",
    	"Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot", 
    	"Split Shot", "Sniper Shot", "Slug Shot", "Blast Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight","Wildfire"}
    	
    	SoilBeltWS = S{"Numbing Shot", "Wildfire"}
    	LightBeltWS = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Blast Arrow", "Arching Arrow",
    	"Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot", 
    	"Split Shot", "Sniper Shot", "Slug Shot", "Blast Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight"}
    	LightNeckWS = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Blast Arrow", "Arching Arrow",
    	"Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot", 
    	"Split Shot", "Sniper Shot", "Slug Shot", "Blast Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight"}
    	-- Precast Sets
    	
    	sets.precast.RangedAttack = {neck="Ocachi Gorget",ring1="K'ayres Ring",ring2="Rajas Ring",back="Libeccio Mantle",
    		ear1="Volley Earring",ear2="Moonshade Earring",waist="Scout's Belt"}
    	sets.precast.RangedAttack.Acc = set_combine(sets.precast.RangedAttack, {neck="Ej Necklace"})
    	
    	-- Precast sets to enhance JAs
    	sets.precast.Step = {ear2="Choreia Earring"}
           
    	-- Weaponskill sets
    	-- Default set for any weaponskill that isn't any more specifically defined
    	sets.precast.WS = set_combine(sets.precast.RangedAttack, {back="Vespid Mantle",ear1="Clearview Earring",
    		neck="Ocachi Gorget",ring1="K'ayres Ring",ring2="Rajas Ring"})
    		
    	sets.precast.WS.Acc = set_combine(sets.precast.WS, {neck="Ej Necklace"})
    
    	-- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
    		
    	-- Midcast Sets
    	sets.midcast.FastRecast = {
    		head="Orion Beret",ear2="Moonshade Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    		
    	-- Specific spells
    	sets.midcast.Utsusemi = {
    		head="Orion Beret",ear2="Moonshade Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    
    	
    	-- Sets to return to when not performing an action.
    	
    	-- Resting sets
    	sets.resting = {}
    	
    
    	-- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
    	sets.idle.Town = {main="Hurlbat", sub="Antican Axe",
    		head="Orion Beret",neck="Ocachi Gorget",ear1="Volley Earring",ear2="Moonshade Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Dark Ring",
    		back="Libeccio Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    	
    	sets.idle.Field = {head="Orion Beret",neck="Ocachi Gorget",ear1="Volley Earring",ear2="Moonshade Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Dark Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    
    	sets.idle.Weak = {head="Orion Beret",neck="Ocachi Gorget",ear1="Volley Earring",ear2="Moonshade Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Dark Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    	
    	-- Defense sets
    	sets.defense.Evasion = {
    		head="Orion Beret",body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Dark Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    
    	sets.defense.PDT = {head="Orion Beret",neck="Twilight Torque",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Dark Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    
    	sets.defense.MDT = {head="Orion Beret",neck="Twilight Torque",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Dark Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    
    	sets.Kiting = {}
    
    	-- Engaged sets
    
    	-- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    	-- sets if more refined versions aren't defined.
    	-- If you create a set with both offense and defense modes, the offense mode should be first.
    	-- EG: sets.engaged.Dagger.Accuracy.Evasion
    	
    	-- Normal melee group
    	sets.engaged = {head="Orion Beret",neck="Ocachi Gorget",ear1="Steelflash Earring",ear2="Bladeborn Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
    		back="Libeccio Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
    	sets.engaged.Acc = {head="Orion Beret",neck="Ocachi Gorget",ear1="Steelflash Earring",ear2="Bladeborn Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
    		back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
    	sets.engaged.Evasion = {head="Orion Beret",ear1="Steelflash Earring",ear2="Bladeborn Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    	sets.engaged.Acc.Evasion = {head="Orion Beret",ear1="Steelflash Earring",ear2="Bladeborn Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
    		back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
    	sets.engaged.PDT = {head="Orion Beret",neck="Twilight Torque",ear1="Steelflash Earring",ear2="Bladeborn Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Rajas Ring",
    		back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
    	sets.engaged.Acc.PDT = {head="Orion Beret",neck="Twilight Torque",ear1="Steelflash Earring",ear2="Bladeborn Earring",
    		body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Rajas Ring",
    		back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
    
    
    	windower.send_command('input /macro book 20;wait .1;input /macro set 1')
    	gearswap_binds_on_load()
    
    	windower.send_command('bind ^- gs c toggle target')
    	windower.send_command('bind ^= gs c cycle targetmode')
    end
    
    -- Called when this job file is unloaded (eg: job change)
    function file_unload()
    	--spellcast_binds_on_unload()
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- Job-specific hooks that are called to process player actions at specific points in time.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
    function job_pretarget(spell, action, spellMap, eventArgs)
    
    end
    
    -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
    -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
    function job_precast(spell, action, spellMap, eventArgs)
    	if spell.type:lower() == 'weaponskill' then
    		if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
    			cancel_spell()
    			return
    		elseif state.Defense.Active then
    			-- Don't gearswap for weaponskills when Defense is on.
    			eventArgs.handled = true
    		end
    	end
    	
    	if player.equipment.range == DefaultGun then
            DefaultAmmo = DefaultGunAmmo
        elseif player.equipment.range == DefaultBow then
            DefaultAmmo = DefaultBowAmmo
        elseif player.equipment.range == DefaultXBow then
            DefaultAmmo = DefaultXBowAmmo
        end
    	
    	if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
    		-- to avoid the ammo being left in, if the default ammo is not present in inventory
    		equip({ammo=empty})
    		equip(DefaultAmmo)
    	end
    	
    	-- Job Abilities
    	if spell.name == 'Spectral Jig' and buffactive.sneak then
    		send_command('cancel 71')
    	end
    	
    	if spell.english == 'Bounty Shot' then
    		equip({hands="Sylvan Glovelettes +2"})
    	elseif spell.english == 'Scavenge' then
    		equip({feet="Orion Socks"})
    	end
    	
    	-- Normal Ranged Attack
    	if spell.name == 'Ranged' then
    		equip(sets.precast.RangedAttack)
    	end
    end
    
    -- Return a customized weaponskill mode to use for weaponskill sets.
    -- Don't return anything if you're not overriding the default value.
    function get_job_wsmode(spell, action, spellMap)
    
    end
    
    -- Run after the default precast() is done.
    -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
    function job_post_precast(spell, action, spellMap, eventArgs)
    
    end
    
    
    -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
    function job_midcast(spell, action, spellMap, eventArgs)
    	if SoilBeltWS[spell.name] then
    		equip({waist="Soil Belt"})
    	end
    	
    	if LightBeltWS[spell.name] then
    		equip({waist="Light Belt"})
    	end
    	
    	if LightNeckWS[spell.name] then
    		equip({neck="Light Gorget"})
    	end
    end
    
    -- Run after the default midcast() is done.
    -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
    function job_post_midcast(spell, action, spellMap, eventArgs)
    
    end
    
    -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
    function job_aftercast(spell, action, spellMap, eventArgs)
    end
    
    -- Run after the default aftercast() is done.
    -- eventArgs is the same one used in job_aftercast, in case information needs to be persisted.
    function job_post_aftercast(spell, action, spellMap, eventArgs)
    
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- Customization hooks for idle and melee sets, after they've been automatically constructed.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Called before the Include starts constructing melee/idle/resting sets.
    -- Can customize state or custom melee class values at this point.
    -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
    function job_handle_equipping_gear(status, eventArgs)
    
    end
    
    -- Modify the default idle set after it was constructed.
    function customize_idle_set(idleSet)
    	return idleSet
    end
    
    -- Modify the default melee set after it was constructed.
    function customize_melee_set(meleeSet)
    	return meleeSet
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- General hooks for other events.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Called when the player's status changes.
    function job_status_change(newStatus, oldStatus, eventArgs)
    	--handle_equipping_gear(newStatus)
    end
    
    -- Called when a player gains or loses a buff.
    -- buff == buff gained or lost
    -- gain == true if the buff was gained, false if it was lost.
    function job_buff_change(buff, gain)
    
    end
    
    
    -------------------------------------------------------------------------------------------------------------------
    -- User code that supplements self-commands.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Called for custom player commands.
    function job_self_command(cmdParams, eventArgs)
    
    end
    
    -- Called by the 'update' self-command, for common needs.
    -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
    function job_update(cmdParams, eventArgs)
    
    end
    
    -- Handle notifications of user state values being changed.
    function job_state_change(stateField, newValue)
    
    end
    
    -- Set eventArgs.handled to true if we don't want the automatic display to be run.
    function display_current_job_state(eventArgs)
    
    end

  6. #226
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by Byrthnoth View Post
    != is ~= in Lua. !(condition) is not (condition).

    This might be better
    Code:
    if (spell.target.distance>8 and spell.prefix == '/weaponskill' and not ranged_ws[spell.name]) or (spell.target.distance > 21 and spell.prefix == '/weaponskill') then
        cancel_spell()
    end
    I went with this in the draft I just responded with.

    Code:
    	if spell.type:lower() == 'weaponskill' then
    		if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
    			cancel_spell()
    		elseif state.Defense.Active then
    			-- Don't gearswap for weaponskills when Defense is on.
    			eventArgs.handled = true
    		end
    	end

  7. #227
    BG Content
    Join Date
    Jul 2007
    Posts
    21,140
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Oh, remember to put "return" after cancel_spell(). Sorry, I forgot.

  8. #228
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by Byrthnoth View Post
    Oh, remember to put "return" after cancel_spell(). Sorry, I forgot.
    Done. Makes sense, you have to do that in Spellcast too ( <return /> )

  9. #229
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    One Final Question for the day. With spellcast, I usually like having it sort of auto-complete my typed out spells (Which I do a lot of), for example I can type /ja addendumblack and it'll do the /ja "Addendum: Black" <me> for me, or like /ma cure3 don making it /ma "Cure III" donnie [if he's in pt].

    Question is, is there any problem with me leaving spellcast enabled along side GearSwap, so as long as I'm not loading any spellcast rules for the job? Or perhaps does GearSwap also have the ability to do that kind of auto-complete functionality.

  10. #230
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    At the bottom of the precast function, this doesn't seem to be taking effect on bounty shot, It's only starting with TH2 instead of TH3.
    Code:
    	-- Job Abilities
    	if spell.name == 'Spectral Jig' and buffactive.sneak then
    		send_command('cancel 71')
    	elseif spell.name == 'Bounty Shot' then
    		equip({hands="Sylvan Glovelettes +2"})
    	elseif spell.name == 'Scavenge' then
    		equip({feet="Orion Socks"})
    	end
    Is there a debug mode like showgearswap in spellcast?

    Edit: I had to disable spellcast completely, seems when I type something like /ja bountyshot , the auto-complete being processed by spellcast won't allow gearswap to parse the actions. So seems like I'll either have to macro it in, or type it out fully like /ja "Bounty Shot" <t>

  11. #231
    Hydra
    Join Date
    Oct 2009
    Posts
    109
    BG Level
    3
    FFXI Server
    Bismarck

    I believe the add on "shortcuts" by Byrth will do what you're looking for.

  12. #232
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by JSHidaka View Post
    actually nvm.. will use that original code... now I get why the close and range ws -_-... forgot Ranged have "close range ws" -_-
    The only 3 ranged shots that come to mind that's short or melee distance is Blast Arrow, Blast Shot, and Numbing Arrow. So I don't include them in the ranged_ws set. Ending up with the following set (excluding the Cor-only mythic):

    Code:
        ranged_ws = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Arching Arrow",
    	"Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot", 
    	"Split Shot", "Sniper Shot", "Slug Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight","Wildfire"}
    And a final block that looks like this at the top of the precast function:

    Code:
    	if spell.type:lower() == 'weaponskill' then
    		if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
    			cancel_spell()
    			return
    		elseif state.Defense.Active then
    			-- Don't gearswap for weaponskills when Defense is on.
    			eventArgs.handled = true
    		end
    	end
    Essentially only gets applied to weaponskills (as normal ranged shots can be up to 25'), If it's greater than 8' but not in the list of ranged WS, or greater than 21', it'll cancel.

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

    I normally had to load Gearswap and Shortcuts manually, tried to put them to autoload.. and they freeze Windower as soon as it try to load them, not sure if is Gearswap or Shortcuts or both of them...

    But can load them w/o problem after the game is up.

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

    @haruhigumi: Since you based that on mine, there are a few of changes you'll want to make.

    1) Don't directly call cancel_spell(). Remember that the functions in the job file are shims for the Include to call into, so the Include also needs to not try any further default processing. Instead, set eventArgs.cancel = true and then return. The Include will then do a cancel_spell() and stop further processing.

    2) Remember that the Include is going to be equipping default gear sets -after- calling job_precast(). In a number of cases, it looks like you want your gear to apply on top of whatever the default is. In that case, those bits should go into job_post_precast().

    3)

    Code:
    	if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
    		-- to avoid the ammo being left in, if the default ammo is not present in inventory
    		equip({ammo=empty})
    		equip(DefaultAmmo)
    	end
    This won't work the way you think it will. equip() does not issue an immediate command to equip the specified item; it merely builds onto an internal equipment table that will be used in the final packet construction. So, equip(empty) followed by equip(item) doesn't actually force the slot to be emptied first; the second call will overwrite the first before anything is ever done.

    Unfortunately I don't have an easy solution for this issue for you. Would need to think about how to go about it.

  15. #235
    BG Content
    Join Date
    Jul 2007
    Posts
    21,140
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    In order to address that, it would probably be easiest if I just provided a player.inventory structure similar to player.equipment that is a set of all the items in your inventory.

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

    Quote Originally Posted by haruhigumi View Post
    So you can reference the spell.name direct as the index in I guess the 'array' (not sure what LUA calls it) and it'll just return the Boolean response if it's there? I been using array:contains(spell.english) in my if/then structure for equipping light/soil belts.
    There's a special structure called a 'set' (not to be confused with a gear set), defined like S{'some item'}. It's one of the general lua libraries that was built for Windower addons. It will construct a table where the values you list in the construction are the keys, and the 'values' are all the boolean value of 'true'. So you could have:

    jeunoAreas = S{"Ru'lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jueno"}

    and if you check jeunoAreas[world.area], if you're in one of the Jeuno zones it will return true. (note: not actually, because of capitalization issues for zone names, but ignoring that for simplicity) It also has a contains function you can call: jeunoAreas:contains(world.area), which makes it a bit clearer what you're doing, rather than the simple array[] check.

    Any other type of table won't work this way. jeunoAreas = {"Ru'lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jueno"} is the same as jeunoAreas = {[1]="Ru'lude Gardens", [2]="Upper Jeuno", [3]="Lower Jeuno", [4]="Port Jueno"}. In that case, contains() has to iterate over the entire list, rather than use a simple hash lookup, making it much slower for that purpose.

  17. #237
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by Motenten View Post
    @haruhigumi: Since you based that on mine, there are a few of changes you'll want to make.

    1) Don't directly call cancel_spell(). Remember that the functions in the job file are shims for the Include to call into, so the Include also needs to not try any further default processing. Instead, set eventArgs.cancel = true and then return. The Include will then do a cancel_spell() and stop further processing.

    2) Remember that the Include is going to be equipping default gear sets -after- calling job_precast(). In a number of cases, it looks like you want your gear to apply on top of whatever the default is. In that case, those bits should go into job_post_precast().

    3)

    Code:
    	if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
    		-- to avoid the ammo being left in, if the default ammo is not present in inventory
    		equip({ammo=empty})
    		equip(DefaultAmmo)
    	end
    This won't work the way you think it will. equip() does not issue an immediate command to equip the specified item; it merely builds onto an internal equipment table that will be used in the final packet construction. So, equip(empty) followed by equip(item) doesn't actually force the slot to be emptied first; the second call will overwrite the first before anything is ever done.

    Unfortunately I don't have an easy solution for this issue for you. Would need to think about how to go about it.

    Based on that information, I've adjusted the code to this:

    Code:
    -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
    -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
    function job_precast(spell, action, spellMap, eventArgs)
    	if spell.type:lower() == 'weaponskill' then
    		if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
    			add_to_chat(122,"Distance too great for WeaponSkill /Canceling")
    			eventArgs.cancel = true
    			return
    		elseif state.Defense.Active then
    			-- Don't gearswap for weaponskills when Defense is on.
    			eventArgs.handled = true
    		end
    	end
    	
    	if player.equipment.range == DefaultGun then
            DefaultAmmo = DefaultGunAmmo
        elseif player.equipment.range == DefaultBow then
            DefaultAmmo = DefaultBowAmmo
        elseif player.equipment.range == DefaultXBow then
            DefaultAmmo = DefaultXBowAmmo
        end
    	
    	if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
    		-- to avoid the ammo being left in, if the default ammo is not present in inventory
    		add_to_chat(122,"Unlimited Shot not Active or Ammo Empty, Using Default Ammo")
    		equip(DefaultAmmo)
    	end
    end
    
    -- Run after the default precast() is done.
    -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
    function job_post_precast(spell, action, spellMap, eventArgs)
    	-- Normal Ranged Attack
    	if spell.name == 'Ranged' then
    		equip(sets.precast.RangedAttack)
    	end
    
    	-- Job Abilities
    	if spell.name == 'Spectral Jig' and buffactive.sneak then
    		send_command('cancel 71')
    	elseif spell.name == 'Bounty Shot' then
    		equip({hands="Sylvan Glovelettes +2"})
    	elseif spell.name == 'Scavenge' then
    		equip({feet="Orion Socks"})
    	end
    end
    The default ammo bit in precast seems fine to me because I don't set the main/sub/ranged/ammo in any of my sets, so they won't be overwritten anyways in a later set apply. I just simply moved the ranged attack set, and job ability swaps into the post_precast as you recommended. (The belt swaps for Light Belt, Light Gorget Etc, I put in midcast, unless you know of a better place or time to gear them).

    As for Point #3, seems like the 'safest' solution, is to simply empy the ammo slot if it's being used by one of the unlimited ammo when the buff is not applied. Then a separate function if the ammo is empty to load the default, that way at worse you just get the message that you don't have a ranged item to use,and second attempt will use default ammo if present, but saving the trouble of accidentally firing the ammo.

  18. #238
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by Motenten View Post
    There's a special structure called a 'set' (not to be confused with a gear set), defined like S{'some item'}. It's one of the general lua libraries that was built for Windower addons. It will construct a table where the values you list in the construction are the keys, and the 'values' are all the boolean value of 'true'. So you could have:

    jeunoAreas = S{"Ru'lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jueno"}

    and if you check jeunoAreas[world.area], if you're in one of the Jeuno zones it will return true. (note: not actually, because of capitalization issues for zone names, but ignoring that for simplicity) It also has a contains function you can call: jeunoAreas:contains(world.area), which makes it a bit clearer what you're doing, rather than the simple array[] check.

    Any other type of table won't work this way. jeunoAreas = {"Ru'lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jueno"} is the same as jeunoAreas = {[1]="Ru'lude Gardens", [2]="Upper Jeuno", [3]="Lower Jeuno", [4]="Port Jueno"}. In that case, contains() has to iterate over the entire list, rather than use a simple hash lookup, making it much slower for that purpose.
    So it's a little like python in that respect.

  19. #239
    Hydra
    Join Date
    Aug 2011
    Posts
    140
    BG Level
    3
    FFXI Server
    Leviathan

    Quote Originally Posted by JSHidaka View Post
    I normally had to load Gearswap and Shortcuts manually, tried to put them to autoload.. and they freeze Windower as soon as it try to load them, not sure if is Gearswap or Shortcuts or both of them...

    But can load them w/o problem after the game is up.
    For me both autoload just fine, but I'm using Windower 4.1 rather than manually modifying the autoload file. Might be a matter of *when* you're trying to load those Addons (they seem to be best loaded after all the plugins are loaded first).

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

    Quote Originally Posted by haruhigumi View Post
    For me both autoload just fine, but I'm using Windower 4.1 rather than manually modifying the autoload file. Might be a matter of *when* you're trying to load those Addons (they seem to be best loaded after all the plugins are loaded first).
    ..... open launcher.. go to addons.. active Shortcuts and Gearswap.. that's AUTOLOAD...
    I didn't "modify" any file...

    and yea it freeze after loading all others addon.. coz they are the last one to load..

    PS. I don't think I have any choice of what version of windower could use...not 3.4(coz nothing works on it) not 4.0 coz it autoupdate to 4.1
    Now if the question was about DEV version or not... ya I'm using normal one...

Closed Thread
Page 12 of 302 FirstFirst ... 2 10 11 12 13 14 22 62 ... LastLast

Similar Threads

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