Gearswap: Issue With Precast/midcast Mechanism

Language: JP EN DE FR
New Items
2017-11-12
261 users online
Forum » Windower » Support » Gearswap: issue with precast/midcast mechanism
Gearswap: issue with precast/midcast mechanism
 Fairy.Yunachan
Offline
Server: Fairy
Game: FFXI
user: Yunachan
Posts: 27
By Fairy.Yunachan 2017-10-12 14:10:02
Link | Quote | Reply
 
ello guys,
I'm trying to implement a simple code for my scholar. It is stilla very alpha version, so please don't look too much at the structure:
Code
function get_sets()

	 sets.idle = {
       main 		= "Fay Staff",
        body		= "Pluviale",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Icesoul Ring",
        rring		= "Icesoul Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Savant's Pants +2",
        feet        = "Argute Loafers +2"
        
    }
	
	sets.idle.sublimation = set_combine(sets.idle, {body="Argute Gown +2", head="Scholar Mortarboard"} )
	
	sets.fc = {
		main 		= "Fay Staff",
        body		= "Argute Gown +2",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
		
     }
	
	
	sets.healing = {
		main 		= "Chatoyant Staff",
        body		= "Nefer Kalasiris",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
      		
	}
	
	sets.elemental = {
		main 		= "Chatoyant Staff",
        body		= "Nefer Kalasiris",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
      		
	}
	
	sets.enfeebling = {
		main 		= "Chatoyant Staff",
        body		= "Nefer Kalasiris",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
      		
	}
	
	sets.enhancing = {
		main 		= "Chatoyant Staff",
        body		= "Nefer Kalasiris",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
      		
	}
	
	sets.enhancing.stonesking = set_combine(sets.enhancing, {lear = "Earthcry earring"} )

	
	sets.dark = {
		main 		= "Chatoyant Staff",
        body		= "Nefer Kalasiris",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
      		
	}

	sets.dark.aspirdrain = set_combine(sets.dark, {neck="Stone Gorget"} )

	
	sets.rest = {
		main 		= "Chatoyant Staff",
        body		= "Nefer Kalasiris",
		head        = "Argute Mortarboard +2",
        sub         = "Raptor Strap +1",
        ammo		= "Incantor Stone",
        neck		= "Savant's Chain",
        lear		= "Bloodgem Earring",
        rear		= "Bloodbead Earring",
        hands       = "Augur's gloves",
        lring 		= "Sapphire Ring",
        rring		= "Tamas Ring",
        back		= "Merciful Cape",
        waist		= "Witful Belt",
        legs        = "Praeco slacks",
        feet        = "Argute Loafers +2"
      		
	}
	
	sets.rest.sublimation = set_combine(sets.rest, {body="Argute Gown +2", head="Scholar Mortarboard"} )
		
end
	
function equip_idle()
     windower.add_to_chat(8,'[Idle]')
    equip(sets.idle)
end

function equip_idlesublimation()
     windower.add_to_chat(8,'[Idle/Sublimation]')
    equip(sets.idle.sublimation)
end
	
function equip_fc()
     windower.add_to_chat(8,'[Fast-Cast]')
    equip(sets.fc)
end
	
	
function equip_heal()
     windower.add_to_chat(8,'[Healing]')
    equip(sets.healing)
end

function equip_elemental()
     windower.add_to_chat(8,'[Elemental]')
    equip(sets.elemental)
end

function equip_enfeebling()
     windower.add_to_chat(8,'[Enfeebling]')
    equip(sets.enfeebling)
end

function equip_enhancing()
     windower.add_to_chat(8,'[Enhancing]')
    equip(sets.enhancing)
end

function equip_enhancingstoneskin()
     windower.add_to_chat(8,'[Stoneskin]')
    equip(sets.enhancing.stonesking)
end

function equip_dark()
     windower.add_to_chat(8,'[Dark]')
    equip(sets.dark)
end

function equip_darkaspirdrain()
     windower.add_to_chat(8,'[Aspir/Drain]')
    equip(sets.dark.aspirdrain)
end

function equip_rest()
     windower.add_to_chat(8,'[Rest]')
    equip(sets.rest)
end

function equip_restsublimation()
     windower.add_to_chat(8,'[Rest/Sublimation]')
    equip(sets.rest.sublimation)
end


function precast(spell)
		if spell.type == 'JobAbility' then
		else
		equip_fc()
		end
end



function midcast(spell)
   
   if spell.skill == 'Healing Magic' then
        equip_heal()
    elseif spell.skill == 'Enfeebling Magic' then
        equip_enfeebling()
    elseif spell.skill == 'Enhancing Magic' then
        equip_enhancing()
			if spell.name == 'Stoneskin' then
			equip_enhancing.stoneskin()	
		   end	
    elseif spell.skill == 'Elemental Magic' then
        equip_nuke()
    elseif spell.skill == 'Dark Magic' then
        equip_dark()
	end	
    end

	
	
	
 
function aftercast(spell)
    if spell.type == 'JobAbility' then
		else
		equip_idle()
		if not (buffactive['Sublimation: Activated'] or buffactive['Sublimation: Complete']) then	
		 
                send_command('@wait 2;input /ja "Sublimation" <me>')
				equip_restsublimation()
	
		if (buffactive['Sublimation: Activated']) then
			equip_restsublimation()
		end
		end
end
end




Everything is compiled fine.
When I change an equip, GS will inform with a chat message, of the changed equip.
I have an issue on when precast/midcast actions are taken:
If I cast a spell, like cure IV, I see the echo in the chat saying "Fast-Cast", so the precast function is executed, but immediately after, I also see the echo saying "Healing", that means that midcast function has been executed as well.

Basically, there is no difference between precast and midcast.

Where am I wrong?

Thanks for helping.

Y1
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 4116
By Asura.Sechs 2017-10-12 14:32:49
Link | Quote | Reply
 
Not sure I'm getting your question but the swap from precast to midcast is almost instant on gearswap.

Gearswap "intercepts" your attempt to execute an action and instead of directly executing it first it equips the precast set, initiates the action and then immediately swap to midcast.
It's, like, instant really.
It's so fast that it even works on spells where "instacast" happens; that means the spell has zero seconds casting time, and Gearswap still manages to correctly swap to midcast for that spell.
I think it's because the information for both (equipment before action is initiated, equipment after action is initiated) are in the same data-packet that the game sends to the server.


It's not like the old "wait" commands people used to deploy in macros, those had real time waits in between swaps.
Is that what you're using for comparison?
 Fairy.Yunachan
Offline
Server: Fairy
Game: FFXI
user: Yunachan
Posts: 27
By Fairy.Yunachan 2017-10-12 14:54:50
Link | Quote | Reply
 
Maybe it's easier if I explain what I thought it was possible:

I cast a spell.
My fast cast equip kicks in.
Right before sending the spell command, switch the equip to maximise the effect, while gained the fast cast in the precast.
Aftercast goes on Idle.

Hope it's more clear.
 Fenrir.Caiir
VIP
Offline
Server: Fenrir
Game: FFXI
user: Minjo
Posts: 199
By Fenrir.Caiir 2017-10-12 16:31:44
Link | Quote | Reply
 
If you switch gear again before the spell starts casting, then that's your precast gear.

You will never actually see your self in precast gear unless there is an issue in client-server communication or you do not have different midcast gear.
[+]
 Bahamut.Alexcennah
Offline
Server: Bahamut
Game: FFXI
user: digoserra
Posts: 112
By Bahamut.Alexcennah 2017-10-12 22:36:45
Link | Quote | Reply
 
Fairy.Yunachan said: »
I cast a spell.
My fast cast equip kicks in.
Right before sending the spell command, switch the equip to maximise the effect, while gained the fast cast in the precast.
Aftercast goes on Idle.

It seems you are making a wrong assumption: the casting time calculations are made client side. That's not true, the server does all the math. When you see your character in the "casting" animation, the server already knows what you are doing. Actually, the casting animation only shows when the server informs your client it received your command.
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 4116
By Asura.Sechs 2017-10-13 01:45:14
Link | Quote | Reply
 
Fenrir.Caiir said: »
You will never actually see your self in precast gear unless there is an issue in client-server communication or you do not have different midcast gear.
Or the game client lags and shows you in your precast gear even though you're in midcast, but that would be just a "visual lag" on your client, not representative of how data got handled server-side.

As I said before the swap is instant between precast and midcast.


If you wanna be sure your fastcast gear is correctly kicking in there's an easy easy easy test you can perform.
Pick a spell that's very long to cast, like I dunno, Impact or Reraise.
Write "//raw /ma reraise me" (this will send the casting command directly to the game, ignoring gearswap) and get yourself used to how long the spell takes to complete its casting.
Then do a "//ma reraise me" and see if you notice a difference.

If it's still very slow then it means for whatever reason your precast is being ignored and your midcast gear is being wrongly used as precast.
If instead you notice a difference (it will be very big!) you'll know your LUA is working correctly.
Easy peasy :)
 Fairy.Yunachan
Offline
Server: Fairy
Game: FFXI
user: Yunachan
Posts: 27
By Fairy.Yunachan 2017-10-13 02:17:29
Link | Quote | Reply
 
Ok so, basically:

Precast gear = fast cast gear

Midcast gear = spell related gear

The time to change is immediate.

Correct?

Thanks Sechs for the example, will give it a try.
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 4116
By Asura.Sechs 2017-10-13 02:28:45
Link | Quote | Reply
 
In the case of a spell, usually you deploy Fast Cast gear in your Precast (but it depends! I guess...) and spell related stuff in your midcast.
Let's take for example an elemental spell like Thunder V.
You want to precast in a fastcast set, then for midcast you would use your magic accuracy/magic attack bonus/magic burst bonus set.

Another example for enfeebling magic: you still want to cast in a fastcast set, and midcast in a set that's gonna have magic accuracy, enfeebling magic, INT/MND and specific items that boost that specific enfeebling spell you're casting, if you have any.


Job abilities and Weaponskills do not need a Midcast set, normally.
You can just use Precast for that :)
 Fairy.Yunachan
Offline
Server: Fairy
Game: FFXI
user: Yunachan
Posts: 27
By Fairy.Yunachan 2017-10-14 03:35:32
Link | Quote | Reply
 
That is crystal clear Sechs,

thanks a lot for your help ^.^
Log in to post.