Page 1 of 1

castpractice.iss

Posted: Mon Apr 25, 2005 6:30 pm
by onetimehero
Conversion of a casting macro for raising skill. FWIW.


SR.INC can be found over at http://macroquest2.com/phpBB2/viewtopic ... 5461#95461

Code: Select all

#include sr.inc

function main()
{
  declare cpCurrentSpell int script
  declare cpMaxSkill int script
  declare cpSkillName string script
  declare cpSpellName string script
  declare skillStart int script
  declare skillend int script

  varset cpCurrentSpell 1
  varset cpMaxSkill ${Math.Calc[${Me.Level}*5+5]}
  if "${cpMaxSkill}>235"
    varset cpMaxSkill 235
  
  echo Maximum skill is ${cpMaxSkill}

  Target myself
  if "${Me.Pet.ID}"
    target id ${Me.Pet.ID}

  do 
  {
    echo cpCurrentSpell=${cpCurrentSpell}
    echo casting ${Me.Gem[${cpCurrentSpell}]}

    varset cpSkillName ${Me.Gem[${cpCurrentSpell}].Skill}
    varset skillStart ${Me.Skill[${cpSkillName}]}

    if "${Me.Gem[${cpCurrentSpell}].ID}"
    {
      do
      {
        if "${Me.CurrentMana}<${Me.Gem[${cpCurrentSpell}].Mana}"
        {
          EQExecute /sit
          echo ${Math.Calc[${Me.Skill[${cpSkillName}]}-${skillStart}].Int} skillups so far in ${cpSkillName}
          call MedBreak   
        }
        call CheckGM
        if "${Me.Pet.ID}"
          target id ${Me.Pet.ID}

        wait 100 ${Me.SpellReady[${cpCurrentSpell}]}
        call sr_cast "${Me.Gem[${cpCurrentSpell}]}" gem${cpCurrentSpell}
        if "${Cursor.ID}"
        {
           EQExecute /autoinventory
           wait 20 !${Cursor.ID}
        }
      }
      while "${Me.Skill[${cpSkillName}]}<${cpMaxSkill}"
    }	
    varcalc cpCurrentSpell ${cpCurrentSpell}+1
  }
  while "${cpCurrentSpell}<10"
  EQExecute /sit
  call MedBreak
  EQExecute /camp

}


function CheckGM()
{
  if "${Spawn[gm].ID} || ${SpawnCount[pc,radius,200]}>1"
  {
    do
    {
       echo 'Cast Macro' A GM or Guide has been detected in the zone,  the macro will resume  when the zone is clear of GM/Guides 
       if "!${Me.Sitting}" 
         EQExecute /sit
       wait 300 
    } 
    while "${Spawn[gm].ID} || ${SpawnCount[pc,radius,200]}>1"
  }
}

function MedBreak()
{
    EQExecute /stand 
    EQExecute /sit 
    do
    {
      if "${Me.SpellReady[Cannibalize III]} && ${Me.PctHPs}>30"
        call sr_cast "Cannibalize III"
      if "!${Me.Sitting}"
        EQExecute /sit
      if "${Me.PctHPs}<65"
      {
        target myself
        wait 5 ${Me.ID}==${Target.ID}
        doability "Bind Wound"
        wait 150 ${Me.AbilityReady[Bind Wound]}
      }
      wait 10
      call CheckGM
    }
    while "${Me.CurrentMana}<${Me.MaxMana}"        
}

Posted: Wed Aug 17, 2005 1:43 pm
by Lax
This should work for the current version. Updated the x.ID crap to use (exists), and updated varset to var:Set


SR.INC can be found over at http://macroquest2.com/phpBB2/viewtopic ... 5461#95461

Code: Select all

#include sr.inc

function main()
{
  declare cpCurrentSpell int script 1

  declare cpMaxSkill int script
  declare cpSkillName string script
  declare cpSpellName string script
  declare skillStart int script
  declare skillend int script

  cpMaxSkill:Set[${Me.Level}*5+5]}
  if "${cpMaxSkill}>235"
    cpMaxSkill:Set[235]
 
  echo Maximum skill is ${cpMaxSkill}

  Target myself
  if "${Me.Pet(exists)}"
    target id ${Me.Pet.ID}

  do
  {
    echo cpCurrentSpell=${cpCurrentSpell}
    echo casting ${Me.Gem[${cpCurrentSpell}]}

    cpSkillName:Set[${Me.Gem[${cpCurrentSpell}].Skill}]
    skillStart:Set[${Me.Skill[${cpSkillName}]}]

    if "${Me.Gem[${cpCurrentSpell}](exists)}"
    {
      do
      {
        if "${Me.CurrentMana}<${Me.Gem[${cpCurrentSpell}].Mana}"
        {
          EQExecute /sit
          echo ${Math.Calc[${Me.Skill[${cpSkillName}]}-${skillStart}].Int} skillups so far in ${cpSkillName}
          call MedBreak   
        }
        call CheckGM
        if "${Me.Pet(exists)}"
          target id ${Me.Pet.ID}

        wait 100 ${Me.SpellReady[${cpCurrentSpell}]}
        call sr_cast "${Me.Gem[${cpCurrentSpell}]}" gem${cpCurrentSpell}
        if "${Cursor(exists)}"
        {
           EQExecute /autoinventory
           wait 20 !${Cursor.ID}
        }
      }
      while "${Me.Skill[${cpSkillName}]}<${cpMaxSkill}"
    }   
  }
  while "${cpCurrentSpell:Inc}<10"
  EQExecute /sit
  call MedBreak
  EQExecute /camp

}


function CheckGM()
{
  if "${Spawn[gm](exists)} || ${SpawnCount[pc,radius,200]}>1"
  {
    do
    {
       echo 'Cast Macro' A GM or Guide has been detected in the zone,  the macro will resume  when the zone is clear of GM/Guides
       if "!${Me.Sitting}"
         EQExecute /sit
       wait 300
    }
    while "${Spawn[gm](exists)} || ${SpawnCount[pc,radius,200]}>1"
  }
}

function MedBreak()
{
    EQExecute /stand
    EQExecute /sit
    do
    {
      if "${Me.SpellReady[Cannibalize III]} && ${Me.PctHPs}>30"
        call sr_cast "Cannibalize III"
      if "!${Me.Sitting}"
        EQExecute /sit
      if "${Me.PctHPs}<65"
      {
        target myself
        wait 5 ${Me.ID}==${Target.ID}
        doability "Bind Wound"
        wait 150 ${Me.AbilityReady[Bind Wound]}
      }
      wait 10
      call CheckGM
    }
    while "${Me.CurrentMana}<${Me.MaxMana}"       
} 

Posted: Mon May 15, 2006 5:33 pm
by iluvseq
Fixed some bugs, removed the GM checker (which didn't work anyway) and added some code to test for HP too low (say, if you are working on evocation... don't want to nuke yourself to death).

Also removed the unnecissary "" around every if statements conditional.

Code: Select all

#include sr.inc

function main()
{
  declare cpCurrentSpell int script 1

  declare cpMaxSkill int script
  declare cpSkillName string script
  declare cpSpellName string script
  declare skillStart int script
  declare skillend int script

  cpMaxSkill:Set[${Me.Level}*5+5]
  if ${cpMaxSkill}>235
    cpMaxSkill:Set[235]
 
  echo Maximum skill is ${cpMaxSkill}


  do
  {
    echo cpCurrentSpell=${cpCurrentSpell}
    echo casting ${Me.Gem[${cpCurrentSpell}]}

    cpSkillName:Set[${Me.Gem[${cpCurrentSpell}].Skill}]
    skillStart:Set[${Me.Skill[${cpSkillName}]}]

    echo ${cpSkillName} starting at ${skillStart}
    if ${Me.Gem[${cpCurrentSpell}](exists)} && ${Me.Skill[${cpSkillName}]}<${cpMaxSkill}
    {
      do
      {
        if ${Me.CurrentMana}<${Me.Gem[${cpCurrentSpell}].Mana} || ${Me.PctHPs}<40
        {
          EQExecute /sit
          echo ${Math.Calc[${Me.Skill[${cpSkillName}]}-${skillStart}].Int} skillups so far in ${cpSkillName}
          call MedBreak   
        }
	target myself
        if ${Me.Pet(exists)}
          target id ${Me.Pet.ID}

        wait 100 ${Me.SpellReady[${cpCurrentSpell}]}
        call sr_cast "${Me.Gem[${cpCurrentSpell}]}" gem${cpCurrentSpell}
        if ${Cursor(exists)}
        {
           EQExecute /autoinventory
           wait 20 !${Cursor.ID}
        }
      }
      while ${Me.Skill[${cpSkillName}]}<${cpMaxSkill}
      echo ${cpSkillName} maxed!
    }   
  }
  while ${cpCurrentSpell:Inc}<10
  EQExecute /sit
  call MedBreak
}


function MedBreak()
{
    EQExecute /stand
    EQExecute /sit
    do
    {
      if ${Me.SpellReady[Cannibalize III]} && ${Me.PctHPs}>30
        call sr_cast "Cannibalize III"
      if !${Me.Sitting}
        EQExecute /sit
      wait 10
    }
    while ${Me.CurrentMana}<${Me.MaxMana} || ${Me.PctHPs}<80
}

Posted: Tue Jun 13, 2006 7:43 pm
by aChallenged1
Ok, I'm a little lost here.

How do I know which gem it is casting, or spell?
It just is not jumping out at me and telling me.

Posted: Tue Jun 13, 2006 8:43 pm
by Yunto?
cpCurrentSpell is the gem it casts. At the top its set to 1.

Posted: Tue Jun 13, 2006 9:47 pm
by aChallenged1
Ok, I see that now that you told me.

Thank you.

Re: castpractice.iss

Posted: Tue Jan 06, 2026 2:18 am
by xyilla

Re: castpractice.iss

Posted: Tue Jan 06, 2026 2:19 am
by xyilla

Re: castpractice.iss

Posted: Tue Jan 06, 2026 2:20 am
by xyilla

Re: castpractice.iss

Posted: Tue Jan 06, 2026 2:21 am
by xyilla

Re: castpractice.iss

Posted: Tue Jan 06, 2026 2:23 am
by xyilla

Re: castpractice.iss

Posted: Tue Jan 06, 2026 2:25 am
by xyilla