Item Search
     
BG-Wiki Search
Page 256 of 302 FirstFirst ... 206 246 254 255 256 257 258 266 ... LastLast
Results 5101 to 5120 of 6036

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

  1. #5101
    Hydra
    Join Date
    Sep 2012
    Posts
    118
    BG Level
    3

    So, it works, but the coroutine.close doesn't seem to terminate the thread. Any ideas?

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

    your using this exact code??
    Code:
    c_mb = 1
    function end_mb()
        state.MagicBurst = false
    end
    windower.raw_register_event('action message', function (actor_id,  target_id, actor_index, target_index, message_id, param_1, param_2,  param_3)
        if message_id > 287 and message_id < 303 then -- Skill chain message ids start at 288 and go through 302
            state.MagicBurst = true
            if type(c_mb) == "thread" then
                coroutine.close(c_mb)
            end
            c_mb = end_mb:schedule(5)
        end
    end)
    are you getting any error reports in the windower command console??

  3. #5103
    Hydra
    Join Date
    Sep 2012
    Posts
    118
    BG Level
    3

    only changes are variable names and a few add_to_chats. Here is what I am using.

    Code:
    	mb_timer = 1
    	mb_elem = nil
    
    function mb_fin()
    	state.MagicBurst = false
    	mb_elem = nil
    	add_to_chat("Skillchain window closed: Disabling Magic Burst Mode")
    
    end
    
    function detect_magic_burst(actor_id, target_id, actor_index, target_index, message_id, param_1, param_2, param_3)
    	if message_id > 287 and message_id < 303 then
    
    		add_to_chat("Skillchain detected: >>"..elements.skillchain[message_id].name.." Enabling Magic Burst Mode")
    		state.MagicBurst = true
    		mb_elem = elements.skillchain[message_id].elements
    
    		if type(mb_timer) == "thread" then
    			coroutine.close(mb_timer)
    		end
    
    		mb_timer = mb_fin:schedule(5)
    
    	end
    end
    
    windower.raw_register_event('action message', detect_magic_burst)
    I don't get any error messages. I made a function to test the routine just to see how it worked.

    Code:
    function test_magic_burst()
    
    	add_to_chat("Skillchain detected: Enabling Magic Burst Mode")
    	state.MagicBurst = true
    
    	if type(mb_timer) == "thread" then
    		coroutine.close(mb_timer)
    	end
    
    	mb_timer = mb_fin:schedule(5)
    
    end
    If I spam it with a self command, it starts the coroutine, but every single one will get to the end and run the mb_fin function

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

    Quote Originally Posted by Shadowmeld View Post
    only changes are variable names and a few add_to_chats. Here is what I am using.

    ...

    I don't get any error messages. I made a function to test the routine just to see how it worked.

    ...

    If I spam it with a self command, it starts the coroutine, but every single one will get to the end and run the mb_fin function
    there are only 3 thing i can think of
    *1. you might have to change mb_fin:schedule(5) to this coroutine.schedule(mb_fin,5) to get the thread to return correctly (this would be my mistake)
    -- the same way i have it in my cp/xp ring code "xpcpcoring = coroutine.schedule(xp_cp_ring_equip: prepare(rings[rings_count]),(ring_time > 0 and ring_time or 1))"
    2. coroutine might not work from gs commands (unlikely)
    3. coroutine.close is some how broken (the only way to check this is to build test code as a stand alone addon) (vary unlikely)

  5. #5105
    BG Content
    Join Date
    Jul 2007
    Posts
    22,379
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Some part of coroutines work with gearswap user files, but most do not.

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

    Quote Originally Posted by Byrthnoth View Post
    Some part of coroutines work with gearswap user files, but most do not.
    coroutine.schedule
    coroutine.close
    both of these work in my include setup
    the only coroutine that fails in gearswap, thats listed in the windower info, is coroutine.sleep
    but as i said in previous posts that sometime you can use
    thenameofyourfunction:schedule(timeinseconds)
    or
    coroutine.schedule(thenameofyourfunction,timeinsec onds)
    and there are things one can do but the other can not and i think returning the thread info is one of them

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

    While my Chatoyant Staff was in my wardrobe 2 I noticed that part of mote's vanilla obi system doesn't work with Wardrobe 2. Putting it in my inventory or Wardrobe 1 makes it start working immediately.

    From Mote-Utility.lua
    Code:
    -- Function to get an appropriate obi/cape/ring for the current action.
    function set_elemental_obi_cape_ring(spell)
        if spell.element == 'None' then
            return
        end
        
        local world_elements = S{world.day_element}
        if world.weather_element ~= 'None' then
            world_elements:add(world.weather_element)
        end
    
        local obi_name = get_elemental_item_name("obi", S{spell.element}, world_elements)
        gear.ElementalObi.name = obi_name or gear.default.obi_waist  or ""
        
        if obi_name then
            if player.inventory['Twilight Cape'] or player.wardrobe['Twilight Cape'] then
                gear.ElementalCape.name = "Twilight Cape"
            end
            if (player.inventory['Zodiac Ring'] or player.wardrobe['Zodiac Ring']) and spell.english ~= 'Impact' and
                not S{'Divine Magic','Dark Magic','Healing Magic'}:contains(spell.skill) then
                gear.ElementalRing.name = "Zodiac Ring"
            end
       if obi_name then
            if player.inventory['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] then
                gear.ElementalWeapon.name = "Chatoyant Staff"
            end
    		end
        else
    		gear.ElementalWeapon.name = gear.default.obi_weapon
            gear.ElementalCape.name = gear.default.obi_back
            gear.ElementalRing.name = gear.default.obi_ring
    		gear.ElementalSub.name = gear.default.obi_sub
        end
    end
    The code, "if player.inventory['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] then", would I need to add or player.wardrobe2['Chatoyant Staff'] to that?

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

    Quote Originally Posted by Roland_J View Post
    While my Chatoyant Staff was in my wardrobe 2 I noticed that part of mote's vanilla obi system doesn't work with Wardrobe 2. Putting it in my inventory or Wardrobe 1 makes it start working immediately.

    From Mote-Utility.lua
    Code:
    -- Function to get an appropriate obi/cape/ring for the current action.
    function set_elemental_obi_cape_ring(spell)
        if spell.element == 'None' then
            return
        end
        
        local world_elements = S{world.day_element}
        if world.weather_element ~= 'None' then
            world_elements:add(world.weather_element)
        end
    
        local obi_name = get_elemental_item_name("obi", S{spell.element}, world_elements)
        gear.ElementalObi.name = obi_name or gear.default.obi_waist  or ""
        
        if obi_name then
            if player.inventory['Twilight Cape'] or player.wardrobe['Twilight Cape'] then
                gear.ElementalCape.name = "Twilight Cape"
            end
            if (player.inventory['Zodiac Ring'] or player.wardrobe['Zodiac Ring']) and spell.english ~= 'Impact' and
                not S{'Divine Magic','Dark Magic','Healing Magic'}:contains(spell.skill) then
                gear.ElementalRing.name = "Zodiac Ring"
            end
       if obi_name then
            if player.inventory['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] then
                gear.ElementalWeapon.name = "Chatoyant Staff"
            end
            end
        else
            gear.ElementalWeapon.name = gear.default.obi_weapon
            gear.ElementalCape.name = gear.default.obi_back
            gear.ElementalRing.name = gear.default.obi_ring
            gear.ElementalSub.name = gear.default.obi_sub
        end
    end
    The code, "if player.inventory['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] then", would I need to add or player.wardrobe2['Chatoyant Staff'] to that?
    yes
    tho you might want to do the other 2 as well like this
    Code:
    if obi_name then
        if player.inventory['Twilight Cape'] or player.wardrobe['Twilight Cape'] or player.wardrobe2['Twilight Cape'] then
            gear.ElementalCape.name = "Twilight Cape"
        end
        if (player.inventory['Zodiac Ring'] or player.wardrobe['Zodiac Ring'] or player.wardrobe2['Zodiac Ring'])
            and spell.english ~= 'Impact' and not S{'Divine Magic','Dark Magic','Healing Magic'}:contains(spell.skill) then
            gear.ElementalRing.name = "Zodiac Ring"
        end
        if obi_name then
            if player.inventory['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] then
                gear.ElementalWeapon.name = "Chatoyant Staff"
            end
        end
    else

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

    Thanks, though I feel pretty lazy having asked that considering I could have just tested it myself >.> It'd have been a simple test afterall. I do have another, more substantial, question though. Why isn't my code for an ElementalSub working? Here is what I've added.

    Mote-Utility.lua
    Code:
    -- Function to get an appropriate obi/cape/ring for the current action.
    function set_elemental_obi_cape_ring(spell)
        if spell.element == 'None' then
            return
        end
        
        local world_elements = S{world.day_element}
        if world.weather_element ~= 'None' then
            world_elements:add(world.weather_element)
        end
    
        local obi_name = get_elemental_item_name("obi", S{spell.element}, world_elements)
        gear.ElementalObi.name = obi_name or gear.default.obi_waist  or ""
        
        if obi_name then
            if player.inventory['Twilight Cape'] or player.wardrobe['Twilight Cape'] then
                gear.ElementalCape.name = "Twilight Cape"
            end
            if (player.inventory['Zodiac Ring'] or player.wardrobe['Zodiac Ring']) and spell.english ~= 'Impact' and
                not S{'Divine Magic','Dark Magic','Healing Magic'}:contains(spell.skill) then
                gear.ElementalRing.name = "Zodiac Ring"
            end
            if player.inventory['Chatoyant Staff'] or player.wardrobe['Chatoyant Staff'] then
                gear.ElementalWeapon.name = "Chatoyant Staff"
            end
    	if player.inventory['Niobid strap'] or player.wardrobe['Niobid strap'] then
                gear.ElementalSub.name = "Niobid Strap"
            end
        else
    	gear.ElementalWeapon.name = gear.default.obi_weapon
            gear.ElementalCape.name = gear.default.obi_back
            gear.ElementalRing.name = gear.default.obi_ring
    	gear.ElementalSub.name = gear.default.obi_sub
        end
    end
    Mote-Mappings.lua
    Code:
    elements.sub_of = {['Light']='Niobid strap'}--temporary. no, I wouldn't cure in a niobid strap!--
    WHM.lua
    Code:
    	-- Cure sets
    	gear.default.obi_waist = "Pythia sash"
    	gear.default.obi_weapon = "Queller rod"
    	gear.default.obi_sub = "Genbu's shield"
    	gear.default.obi_back = "Mending Cape"
    
    	sets.midcast.Cure = {		
    		main=gear.ElementalWeapon,
    		sub=gear.ElementalSub,
    		ammo="Esper stone +1",
    		head="Gende. caubeen +1",
    		neck="Incanter's torque",
    		ear1="Glorious earring",
    		ear2="Nourish. earring +1",
    		body="Ebers bliaud +1",
    		hands="Kaykaus cuffs",
    		ring1="Kuchekula ring",
    		ring2="Sirona's ring",
    		back=gear.ElementalCape,
    		waist=gear.ElementalObi,
    		legs="Ebers pant. +1",
    		feet="Kaykaus boots"}
    Please note that all of the ElementalEquip code except the ElementalSub was already working beforehand and is still working. I added the ElementalSub myself but I can't get it to work. Nothing is equipped in my sub slot during a cure midcast with or without weather.

    (Yes, gearswap can go from club/shield to weapon/grip without failing the grip equip. I tested this with just sub="Niobid strap" and it equips correctly)

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

    Quote Originally Posted by Roland_J View Post
    Thanks, though I feel pretty lazy having asked that considering I could have just tested it myself >.> It'd have been a simple test afterall. I do have another, more substantial, question though. Why isn't my code for an ElementalSub working? Here is what I've added.

    Mote-Utility.lua
    ...

    Mote-Mappings.lua
    ...

    WHM.lua
    ...

    Please note that all of the ElementalEquip code except the ElementalSub was already working beforehand and is still working. I added the ElementalSub myself but I can't get it to work. Nothing is equipped in my sub slot during a cure midcast with or without weather.

    (Yes, gearswap can go from club/shield to weapon/grip without failing the grip equip. I tested this with just sub="Niobid strap" and it equips correctly)
    that i can not tell you as im not vary versed on motes include

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

    Quote Originally Posted by Shadowmeld View Post
    only changes are variable names and a few add_to_chats. Here is what I am using.

    Code:
    	mb_timer = 1
    	mb_elem = nil
    
    function mb_fin()
    	state.MagicBurst = false
    	mb_elem = nil
    	add_to_chat("Skillchain window closed: Disabling Magic Burst Mode")
    
    end
    
    function detect_magic_burst(actor_id, target_id, actor_index, target_index, message_id, param_1, param_2, param_3)
    	if message_id > 287 and message_id < 303 then
    
    		add_to_chat("Skillchain detected: >>"..elements.skillchain[message_id].name.." Enabling Magic Burst Mode")
    		state.MagicBurst = true
    		mb_elem = elements.skillchain[message_id].elements
    
    		if type(mb_timer) == "thread" then
    			coroutine.close(mb_timer)
    		end
    
    		mb_timer = mb_fin:schedule(5)
    
    	end
    end
    
    windower.raw_register_event('action message', detect_magic_burst)
    I don't get any error messages. I made a function to test the routine just to see how it worked.

    Code:
    function test_magic_burst()
    
    	add_to_chat("Skillchain detected: Enabling Magic Burst Mode")
    	state.MagicBurst = true
    
    	if type(mb_timer) == "thread" then
    		coroutine.close(mb_timer)
    	end
    
    	mb_timer = mb_fin:schedule(5)
    
    end
    If I spam it with a self command, it starts the coroutine, but every single one will get to the end and run the mb_fin function
    did the below info fix it??
    Quote Originally Posted by dlsmd View Post
    there are only 3 thing i can think of
    *1. you might have to change mb_fin:schedule(5) to this coroutine.schedule(mb_fin,5) to get the thread to return correctly (this would be my mistake)
    -- the same way i have it in my cp/xp ring code "xpcpcoring = coroutine.schedule(xp_cp_ring_equip: prepare(rings[rings_count]),(ring_time > 0 and ring_time or 1))"
    2. coroutine might not work from gs commands (unlikely)
    3. coroutine.close is some how broken (the only way to check this is to build test code as a stand alone addon) (vary unlikely)

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

    I have progress as far as detecting what the problem is. I was editing the wrong Mote-Utility.lua. Since my WHM.lua uses mote-include version 1, I needed to edit the one in the rev1 folder. Adding the edits to those mote-utility and mote-mappings prints the following error when i cast cure ingame.

    ...indower4\/addons/GearSwap/libs/rev1/Mote-Utility.lua:474: attempt to index field 'ElementalSub' (a nil value)

    I'm not sure why it would print that unless there's another place that I need to edit where these values are assigned other than mote-utility, mote-mappings, and potentially within a job.lua.

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

    Quote Originally Posted by Roland_J View Post
    I have progress as far as detecting what the problem is. I was editing the wrong Mote-Utility.lua. Since my WHM.lua uses mote-include version 1, I needed to edit the one in the rev1 folder. Adding the edits to those mote-utility and mote-mappings prints the following error when i cast cure ingame.

    ...indower4\/addons/GearSwap/libs/rev1/Mote-Utility.lua:474: attempt to index field 'ElementalSub' (a nil value)

    I'm not sure why it would print that unless there's another place that I need to edit where these values are assigned other than mote-utility, mote-mappings, and potentially within a
    job.lua.
    did you build your gear.ElementalSub table like
    gear.ElementalSub = {name=""}
    around line 143

    also dont forget that when gearswap gets updated it will overwrite your additions
    but you can save it by(i think)
    1. creat a new folder in libs called rev0 and pitting all the mote files in there as well as your changed files
    2. set mote_include_version = 0

  14. #5114
    TIME OUT MOTHERFUCKER

    Join Date
    Nov 2007
    Posts
    3,885
    BG Level
    7
    FFXI Server
    Ragnarok

    I have two questions.

    1. How do I test for if MP is below a specific percentage? Is this possible?

    2. How do I have a global variable that I can set and have a default value? What I want to have happen is that when I first start playing, I use a default idle set. Then, if I use a specific set of blood pacts, I switch to a different idle set, and keep using that idle set, until I use a second set of blood pacts, in which case it switches back to the original idle set. I know that I can set a bool for these cases, but I don't know if it's possible to have that bool persist, or to have it have a default state. Is this possible?

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

    Quote Originally Posted by Tarage View Post
    I have two questions.

    1. How do I test for if MP is below a specific percentage? Is this possible?

    2. How do I have a global variable that I can set and have a default value? What I want to have happen is that when I first start playing, I use a default idle set. Then, if I use a specific set of blood pacts, I switch to a different idle set, and keep using that idle set, until I use a second set of blood pacts, in which case it switches back to the original idle set. I know that I can set a bool for these cases, but I don't know if it's possible to have that bool persist, or to have it have a default state. Is this possible?
    Examples(do not put directly in to code thay might cause errors)
    1: use(for less then 75 % hp)
    Code:
    if player.mpp < 75 then
    2a. if its just a set of specific ones but not in a set order(these are absolute)
    Code:
    if {"<name1>","<name2>","<name3>"}:contains(spell.name) then
        <variable> = true
    if {"name4","name5","name6"}:contains(spell.name) then
        <variable> = false
    2.if you want to only trigger after a specif set of them in a sequence its a lot harder(these are absolute)
    if this is what you want it will take time to figure it out

  16. #5116
    TIME OUT MOTHERFUCKER

    Join Date
    Nov 2007
    Posts
    3,885
    BG Level
    7
    FFXI Server
    Ragnarok

    Yeah, I know how to set a variable, I'm just not sure if the variable can persist. So, for example, if I'm focusing on magic blood pacts, I want to be in my magic blood pact idle. So I need to store that off somewhere so that when it goes to check what idle set to use, it uses the right one. So it has to be a global variable. I'm not sure if I can do that or not. I also need to have it set to a default value so I actually use an idle set before I BP.

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

    Quote Originally Posted by Tarage View Post
    Yeah, I know how to set a variable, I'm just not sure if the variable can persist. So, for example, if I'm focusing on magic blood pacts, I want to be in my magic blood pact idle. So I need to store that off somewhere so that when it goes to check what idle set to use, it uses the right one. So it has to be a global variable. I'm not sure if I can do that or not. I also need to have it set to a default value so I actually use an idle set before I BP.
    put the variable in get_sets

  18. #5118
    BG Content
    Join Date
    Jul 2007
    Posts
    22,379
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    All Lua variables default to global (persistent). You need to define them as local if you want them to be anything else.

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

    Quote Originally Posted by dlsmd View Post
    did you build your gear.ElementalSub table like
    gear.ElementalSub = {name=""}
    around line 143

    also dont forget that when gearswap gets updated it will overwrite your additions
    but you can save it by(i think)
    1. creat a new folder in libs called rev0 and pitting all the mote files in there as well as your changed files
    2. set mote_include_version = 0
    Ah, I forgot to do that! I didn't even mention it in my post where I listed all of my code but I did do that in the mote-include for version 2. I forgot to add it to the rev1's mote-include. Adding it makes it all work!! :D ty once again dlsmd ^^

  20. #5120
    Hydra
    Join Date
    Sep 2012
    Posts
    118
    BG Level
    3

    Quote Originally Posted by dlsmd View Post
    did the below info fix it??
    I haven't had an opportunity to test it yet. I've been pretty busy the last few days.

Page 256 of 302 FirstFirst ... 206 246 254 255 256 257 258 266 ... LastLast

Similar Threads

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