A Gearswap Academia - Class 4

Eorzea Time
 
 
 
Language: JP EN FR DE
Version 3.1
New Items
users online
Forum » Windower » General » A Gearswap Academia - Class 4
A Gearswap Academia - Class 4
 Asura.Elizabet
Offline
Server: Asura
Game: FFXI
user: Elizabet
Posts: 496
By Asura.Elizabet 2020-01-21 21:47:30
Link | Quote | Reply
 
Node 387
[+]
 Shiva.Zerowone
Offline
Server: Shiva
Game: FFXI
user: Zerowone
Posts: 655
By Shiva.Zerowone 2020-01-22 02:20:42
Link | Quote | Reply
 
You're doing great so far in keeping it simple. One caveat and I'm sure it might be discussed or planned to be brought up in a future thread.

JAs and Catch Alls in general will work for all jobs. However, some jobs will require you to identify and call out specific JA categories.

Example for instance, Rune Fencer:
Code
function precast(spell,act)
if spell.type == 'JobAbility' then
		if sets.JA[spell.english] then
			equip(sets.JA[spell.english])
		end
	end


Will still need the following to cover all JA's:
Code
     
if spell.type == 'Ward' then
		equip(sets.JA[spell.english])
	end
	
	if spell.type == 'Effusion' then
		equip(sets.JA[spell.english])
	end
end 


Just pointing this out for anyone that's going along on a job other than the example RDM template. One will run into the odd occurrence of the catch all not applying to all their defined JA sets. Luckily there is a built in resource directory to identify "sub category JA's"... "sub directory JAs" (might be a better descriptor).
 Asura.Elizabet
Offline
Server: Asura
Game: FFXI
user: Elizabet
Posts: 496
By Asura.Elizabet 2020-01-22 02:49:34
Link | Quote | Reply
 
Right here is exactly the place to post about those type of caveat as it's very on topic with this part! You are right and I had forgotten about the ward / effusion.

However, simply restructuring the function this way:
Code
function precast(spell)
	if spell.type ~= 'JobAbility' then
 	    equip(sets.precast.casting)
	end

	if sets.ja[spell.name] then
	    equip(sets.ja[spell.name])        
	elseif sets.ws[spell.name] then
	    equip(sets.ws[spell.name])        
	end        
end


Should keep the catch all spirit as regardless of the "sub directory ja" such as wards and effusion, they'll just be caught on by name with a set like sets.ja['Valiance'].

Explanation of the restructure: By ending the first if checking for the "JobAbility" type with "end" and moving on completely with a new if after instead of the previous "elseif", catching a set by spell name no longer require it to be a JA, it can now be anything as long as a matching set name exist. That's because the check is now independant of the result of the previous type check since we removed the "elseif" for a new if.
[+]
 Cerberus.Shadowmeld
Offline
Server: Cerberus
Game: FFXI
Posts: 1649
By Cerberus.Shadowmeld 2020-01-22 09:09:32
Link | Quote | Reply
 
Asura.Elizabet said: »
Right here is exactly the place to post about those type of caveat as it's very on topic with this part! You are right and I had forgotten about the ward / effusion.

However, simply restructuring the function this way:
Code
function precast(spell)
	if spell.type ~= 'JobAbility' then
 	    equip(sets.precast.casting)
	end

	if sets.ja[spell.name] then
	    equip(sets.ja[spell.name])        
	elseif sets.ws[spell.name] then
	    equip(sets.ws[spell.name])        
	end        
end


Should keep the catch all spirit as regardless of the "sub directory ja" such as wards and effusion, they'll just be caught on by name with a set like sets.ja['Valiance'].

Explanation of the restructure: By ending the first if checking for the "JobAbility" type with "end" and moving on completely with a new if after instead of the previous "elseif", catching a set by spell name no longer require it to be a JA, it can now be anything as long as a matching set name exist. That's because the check is now independant of the result of the previous type check since we removed the "elseif" for a new if.

Can I just say, the sets.<precast/midcast> convention isn't absolutely necessary. I understand why people use it, but if you're not going to use it universally you should probably drop it.

I only say this because in this example you're using:
sets.precast.casting
sets.ja

You should probably use sets.precast.ja, or drop precast from casting, or rearrange it to sets.casting, cause then you can do sets.casting.precast and sets.casting.midcast

The other way do deal with special JAs like wards, or corsair rolls is instead of abbreviating your categories, you can spell them out.
Code
sets.precast.JobAbility = {}
sets.precast.Ward = {}
sets.precast.Effusion = {}
sets.precast.CorsairRoll = {}
sets.precast.CorsairRoll["Tactician's Roll"] = {}
sets.precast.CorsairShot = {}
sets.precast.CorsairShot["Light Shot"] = {}

sets.precast.WeaponSkill = {}

function precast(spell)
  if sets.precast[spell.type] then
    if sets.precast[spell.type][spell.name] then
      equip(sets.precast[spell.type][spell.name])
    else
      equip(sets.precast[spell.type])
    end
  else
    equip(sets.precast.casting)
  end
end
 Cerberus.Shadowmeld
Offline
Server: Cerberus
Game: FFXI
Posts: 1649
By Cerberus.Shadowmeld 2020-01-22 09:42:11
Link | Quote | Reply
 
In the interest of making more compact code, you can also get rid of one level or <if/then> in my senario above if you want.
Code
function precast(spell)
  if sets.precast[spell.type] then
    equip(sets.precast[spell.type][spell.name] or sets.precast[spell.type])
  else
    equip(sets.precast.casting)
  end
end