castpractice.iss

Moderator: MacroQuest Developers

onetimehero
a ghoul
a ghoul
Posts: 105
Joined: Fri Sep 05, 2003 2:42 pm

castpractice.iss

Post by onetimehero » Mon Apr 25, 2005 6:30 pm

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}"        
}
Hmm. That's odd.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Aug 17, 2005 1:43 pm

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}"       
} 
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

iluvseq
Clueless Mudslinger
Posts: 269
Joined: Mon Apr 14, 2003 10:05 am

Post by iluvseq » Mon May 15, 2006 5:33 pm

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
}

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Tue Jun 13, 2006 7:43 pm

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.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Yunto?
a grimling bloodguard
a grimling bloodguard
Posts: 502
Joined: Sat Nov 19, 2005 12:05 pm

Post by Yunto? » Tue Jun 13, 2006 8:43 pm

cpCurrentSpell is the gem it casts. At the top its set to 1.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Tue Jun 13, 2006 9:47 pm

Ok, I see that now that you told me.

Thank you.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!






xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: castpractice.iss

Post by xyilla » Tue Jan 06, 2026 2:25 am