Jump to content


Photo

Curing rules in Lua not working


Best Answer Kenshi , 08 December 2014 - 05:26 PM

With this rule you are using same set for idle and resting, try this:

function status_change(new,old)
	if new == 'Idle' then
		equip(sets.aftercast.Idle)
        elseif new == 'Resting' then
                equip(sets.aftercast.Resting)
	elseif new == 'Engaged' then
		equip(sets.aftercast.TP)
	end
end
Go to the full post


23 replies to this topic

#1 Gukai

Gukai

    Advanced Member

  • Members
  • PipPipPip
  • 95 posts

    Posted 10 November 2014 - 12:57 AM

    Hello

    I was testing my lua, which loads fine, and everything I did was working except for curing.  I had the debug and showswaps active, and whenever I did any healing magic there was nothing - no precast, no midcast, etc

     

    Here is my lua

    http://pastebin.com/hJ76ssaY

     

    Would love some help, i bet it will be something simple and stupid but I'm stuck

     

    Thank you!!

     

     



    #2 Kenshi

    Kenshi

      Advanced Member

    • Members
    • PipPipPip
    • 334 posts

      Posted 10 November 2014 - 08:00 AM

      Everything seems ok to me, you sure its not something else.



      #3 Gukai

      Gukai

        Advanced Member

      • Members
      • PipPipPip
      • 95 posts

        Posted 10 November 2014 - 08:14 AM

        My elemental and enhancing rules, both precast and midcast, and the way they are physically written, are the exact same as i use in my blm, and both jobs work.  But when I try cursna, or any cures, nothing happens, no gear changes at all - on both jobs.  Maybe 'Healing Magic' is the wrong terminology?  I simply am at a loss because everything looks good to me too.



        #4 Arcon

        Arcon

          Advanced Member

        • Windower Staff
        • 1189 posts
        • LocationMunich, Germany

        Posted 10 November 2014 - 08:18 AM

        If someone does not work right (regardless of what) start printing. In your case, add print('bla') at the top of the precast function. If it prints, it means the precast triggers, otherwise it doesn't. That way you can pin-point where the error happens.



        #5 Gukai

        Gukai

          Advanced Member

        • Members
        • PipPipPip
        • 95 posts

          Posted 11 November 2014 - 08:18 AM

          I tried this.  Here is the snip from my precast code where i used it:

          		elseif spell.skill == 'Enhancing Magic' then
          			print('enhan')
          			if spell.name == 'Stoneskin' then
          				equip(sets.precast.HasteStoneskin)
          			else equip(sets.precast.HasteEnhancing)
          			end
          		elseif spell.skill == 'Healing Magic' then
          		print('blah')
          			if spell.english:startswith('Cur') then
          			print('blah2')
          				if spell.name == 'Cursna' then
          					equip(sets.midcast.Cursna)
          				elseif spell.cast_time < 9 then
          				print('blah3')
          					equip(sets.midcast.CureSingle)
          				else equip(sets.precast.HasteHealing)
          				end				
          			else equip(sets.precast.HasteHealing)
          			end
                  else equip(sets.precast.Fastcast)
                  end
          

          So it worked on the enhancing, i get the printed message, but nothing at all happens when i toss a cure anywhere, or cursna.. zippo



          #6 Kenshi

          Kenshi

            Advanced Member

          • Members
          • PipPipPip
          • 334 posts

            Posted 11 November 2014 - 11:21 AM

            could you try instead of spell.english:startswith('Cur')  spell.name:startswith('Cur')?



            #7 Gukai

            Gukai

              Advanced Member

            • Members
            • PipPipPip
            • 95 posts

              Posted 11 November 2014 - 04:19 PM

              I can try when I get home, but I dont think that will work.  my blm curing isnt working too, and the rules are even more simple on it: 

              		elseif spell.skill == 'Healing Magic' then
              			if spell.cast_time < 9 then
              				equip(sets.midcast['Healing Magic'])
              			elseif spell.name == 'Cursna' then
              				equip(sets.midcast.Cursna)
              			else equip(sets.precast.HasteHealing)
              			end
              


              #8 Kenshi

              Kenshi

                Advanced Member

              • Members
              • PipPipPip
              • 334 posts

                Posted 11 November 2014 - 08:53 PM

                with this rule I think cursna is not goin to work cause its healing magic and its casting time is 1second, Try this for your blm:

                 

                elseif spell.skill == 'Healing Magic' then
                	if spell.cast_time < 9 then
                              if spell.name == 'Cursna' then
                                    equip(sets.midcast.Cursna)
                              else
                		     equip(sets.midcast['Healing Magic'])
                              end
                	else
                              equip(sets.precast.HasteHealing)
                	end
                


                #9 Gukai

                Gukai

                  Advanced Member

                • Members
                • PipPipPip
                • 95 posts

                  Posted 12 November 2014 - 03:58 AM

                  crud, not working either.  

                   

                  I commented out (in your suggestion above) lines 2, 6, 7.... essentially commenting out the cast time rule and such.  Still didnt work.  



                  #10 Arcon

                  Arcon

                    Advanced Member

                  • Windower Staff
                  • 1189 posts
                  • LocationMunich, Germany

                  Posted 12 November 2014 - 04:46 AM

                  Again, printing is the one true way to find what's wrong. If this line doesn't work, even though you expect it to:

                      if spell.name == 'Something' then

                   

                  Then print the content of spell.name:

                     print(spell.name)
                      if spell.name == 'Something' then

                   

                  That way you'll see exactly why something doesn't work. So go to the very beginning of your precast function and add the following line:

                  function precast(spell)
                      print(spell.name, spell.type, spell.action_type, spell.skill)
                      --[[ Rest of the function here ]]
                  end

                   

                  This will print spell-relevant information every time you use a spell or ability.

                   

                  Also, what client language are you using? Basically you should not use .name here instead of .english, because if you check for "Cur" you're checking for the English name. Changing that will only make sure that it doesn't work if you're playing on the Japanese client.



                  #11 Gukai

                  Gukai

                    Advanced Member

                  • Members
                  • PipPipPip
                  • 95 posts

                    Posted 12 November 2014 - 04:53 AM

                    Hi Arcon

                    I had the print('blah') in various spots, i posted it above.  it printed when i did enhancing, but nothing on my cures.  i have it there at several points within the healing magic rules but none of them activated.

                     

                    I'm on english client (USA)



                    #12 Arcon

                    Arcon

                      Advanced Member

                    • Windower Staff
                    • 1189 posts
                    • LocationMunich, Germany

                    Posted 12 November 2014 - 05:35 AM

                    I fucking hate this forum so much. It cut off my reply again. Hold on, I'm reconstructing it...

                     

                    I know, and that still doesn't help you. Do exactly what I said and you'll find your problem. If a print rule inside a block does not print anything, it means it doesn't get inside that block. Hence, you need a new print rule before that block to figure out why it won't go there. In your case, this did not work:

                     

                                elseif spell.skill == 'Healing Magic' then
                                    print('blah')

                     

                    That means that spell.skill is not "Healing Magic", even though you would expect it to be. So print it out, to see what it is. Before the entire if-chain, place this line:

                               print(spell.skill)

                     

                    That will show you what the skill is, if not "Healing Magic".

                     

                    Or, you can just do what I said above and place a generic print statement at the beginning of your precast function.



                    #13 Gukai

                    Gukai

                      Advanced Member

                    • Members
                    • PipPipPip
                    • 95 posts

                      Posted 20 November 2014 - 09:28 AM

                      Okay, sorry it's been a while, I haven't had a chance to test things.  So I inputted this:

                      	if spell.action_type == 'Magic' or spell.type == 'Ninjutsu' then
                      		print(spell.skill)
                      		if spell.skill == 'Elemental Magic' then
                      			if spell.cast_time < 9 then
                      				if spell.english:startswith('Stone') then
                      					equip(sets.midcast.Stone,{head="Buremte Hat"})			
                      				else equip(sets.midcast.ElementalLow)
                      				end
                      				if spell.element == world.weather_element or spell.element == world.day_element then
                      					equip(sets.obi[spell.element])
                      				end
                      			elseif spell.name == 'Impact' then
                      				equip(sets.precast.HasteElemental,{body="Twilight Cloak"})
                      			else equip(sets.precast.HasteElemental)
                      			end
                      		elseif spell.skill == 'Enhancing Magic' then
                      			if spell.name == 'Stoneskin' then
                      				equip(sets.precast.HasteStoneskin)
                      			else equip(sets.precast.HasteEnhancing)
                      			end
                      		elseif spell.skill == 'Healing Magic' then
                      			print('reached rules')
                      			if spell.english:startswith('Cur') then
                      				print('inside cur rules')
                      				if spell.name == 'Cursna' then
                      					equip(sets.midcast.Cursna)
                      				elseif spell.cast_time < 9 then
                      					equip(sets.midcast.CureSingle)
                      				else equip(sets.precast.HasteHealing)
                      				end				
                      

                      And.... well, results are... interesting.

                       

                      If i use the magic menu to cast magic, the print rules work.  But if I do a spellcast shortcut, such as //cure   .... nothing.  I didnt realize this was going on, but it happens everywhere.  Why wouldnt the shortcuts work?

                       

                      I still need to test everything, but wanted to figure out the //shortcuts first.

                       

                      thanks!



                      #14 Arcon

                      Arcon

                        Advanced Member

                      • Windower Staff
                      • 1189 posts
                      • LocationMunich, Germany

                      Posted 20 November 2014 - 10:46 AM

                      Are you using the Shortcuts addon? GearSwap does not do any spell shortening, like Spellcast did, so you have to use the Shortcuts addon as well as GearSwap if you want that.



                      #15 Gukai

                      Gukai

                        Advanced Member

                      • Members
                      • PipPipPip
                      • 95 posts

                        Posted 20 November 2014 - 04:05 PM

                        I will give it a shot!  does this mean spellcast is totally replaced now?  I know me and some friends have kept spellcast purely for the easy in inputting commands like //c4 and whatnot



                        #16 sdahlka

                        sdahlka

                          Advanced Member

                        • Members
                        • PipPipPip
                        • 324 posts

                          Posted 20 November 2014 - 04:33 PM

                          i think this are all that gs and shortcusts does not do by default

                          but i never like these any ways

                           

                          Spell Type Fixing

                          SpellCast will automatically correct the pre-command for spells if you specify the wrong type. For example if you type /ma “Dancing Edge” <t> SpellCast will automatically process the command correctly as /ws “Dancing Edge” <t>.

                          Smart Targeting

                          In FFXI when you type /ma “Cure” and forget to add the <t>, your spell does not process and your dunes party dies T T. With SpellCast the same mistake would by default cast on whoever you have targeted! Your dunes party rejoices, for as much as a dunes party can be happy anyway. Also, any spell that is only castable on yourself, will default to <me> instead of <t>. Previously in FFXI all spells defaulted to <t> if no target was specified until one unneeded patch to the game. SpellCast brings that functionality back and improves it with <me> handling.

                          Additionally, SpellCast allows you to change this functionality on a per spell basis using the DefaultTarget action.

                          Target Auto-completion

                          For those who are typing spells, Spellcast has auto-completion of the target. You only have to type a part of someone's name. It will match anyone in the zone, but people in your party or alliance will get priority.

                          So for instance, if someone named Jimbobstoner is in your alliance, all you have to type is /ma Cure jimbob and Spellcast will make Jimbobstoner the target if Jimbob is not in your Alliance. Any part will do. So provided they don't match anyone else in your alliance, /ma Cure jimbo, /ma Cure bob or /ma Cure stoner would all work.

                           

                          and these would be nice to have as well

                          HELMSet Optional SetName Specify the set of gear you would like to use when doing HELM.

                          FishingSet Optional SetName Specify the set of gear you would like to use when fishing.



                          #17 Arcon

                          Arcon

                            Advanced Member

                          • Windower Staff
                          • 1189 posts
                          • LocationMunich, Germany

                          Posted 20 November 2014 - 04:56 PM

                          Yes, Spellcast is completely deprecated. It had three features, all of which are now split into separate addons:

                          1. Gear change engine, GearSwap

                          2. Spell/target shortening, Shortcuts

                          3. Text variable replacement, InfoReplacer



                          #18 Gukai

                          Gukai

                            Advanced Member

                          • Members
                          • PipPipPip
                          • 95 posts

                            Posted 20 November 2014 - 07:06 PM

                            Interesting to know!

                             

                            I've always liked the 'Target auto-completion' of spellcast, especially when you party with people with stupidly long or challenging names.  I'm guessing that InfoReplacer covers this aspect of spellcast?  I didnt see it listed in the Documentation link to read up on it.

                             

                            I cant wait to 'kill' spellcast and have these addons loaded so i can get a true feel of how everything works.

                             

                            I really cannot believe I never noticed that gearswap wasnt working with my typed spellcast-shortcut commands... bloody hell  /headdesk



                            #19 Arcon

                            Arcon

                              Advanced Member

                            • Windower Staff
                            • 1189 posts
                            • LocationMunich, Germany

                            Posted 20 November 2014 - 08:28 PM

                            Shortcuts is the one to use for target auto-completion and anything involving commands for spells and abilities. InfoReplacer allows you to use variables in your chat output. For example, with InfoReplacer loaded you can write this:

                            /linkshell I'm currently in %area

                             

                            And it will say "I'm currently in Kazham" (for example). This was a feature of Spellcast, although not many people used it in that fashion. It works with a whole bunch of variables (can find all in Windower/addons/InfoReplacer/reps.lua).



                            #20 Gukai

                            Gukai

                              Advanced Member

                            • Members
                            • PipPipPip
                            • 95 posts

                              Posted 08 December 2014 - 08:31 AM

                              Okay, so I finally have had time to sit down, put in a bunch of 'print' rules within the lua (aaaaall over the place) and review the debug and show swaps.  Everything went perfect.  All the rules look solid, the curaga's are having different sets than cures, and cure 1-2 was different than cure 3 based on casting times, all this is planned for, etc.  

                               

                              Thank you all!  I had one thing that annoyed me, and it's not related to curing, but was on my whm set... when i rested, i didnt change gears!   Here's the set. 

                              	sets.aftercast.Resting = set_combine(sets.aftercast.Idle, {
                              		main="Boonwell Staff",
                              		ammo="Mana Ampulla",
                              		rear="Relaxing Earring",
                              		hands="Nares Cuffs",
                              		waist="Austerity Belt",
                              		legs="Nisse Slacks"}) 

                              Here are the rules:

                              function status_change(new,old)
                              	if T{'Idle','Resting'}:contains(new) then
                              		equip(sets.aftercast.Idle)
                              	elseif new == 'Engaged' then
                              		equip(sets.aftercast.TP)
                              	end
                              end
                              

                              I didnt make this myself I copied from someone but I think the 3rd line in the rules is why.  Can I get a quick help on this?  Thanks for all the help with my cure sets, I'm very happy now.  Cant believe it took so long to test!

                               

                              Night all!






                              1 user(s) are reading this topic

                              0 members, 1 guests, 0 anonymous users