Would like to do something like /if $char(casting)==TRUE

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Would like to do something like /if $char(casting)==TRUE

Post by GoatFoot » Wed Jun 04, 2003 12:11 am

anyone know how do get that functionality?

Currently code below, but $char(gem,"spellname") returns gem # while casting.

Code: Select all

sub Main
:BeginLoop
	/if n $char(skill,"abjuration")>=$calc($char(level)*5+5) /goto :End
	/if $char(gem,"endure cold")==0 {
		/echo Spell not memmed.
		/goto :End
	}
	
	/if n $char(mana,pct)<30 {
		:RegainMana
		/if $char(state)!="SIT" /sit
		/delay 10
		/if n $char(mana,pct)<99 /goto :RegainMana
	}
	
	:CanCast
	/if n $char(gem,"endure cold")>0 {
		/if $char(state)!="STAND" /stand
		/target myself
		/cast "endure cold"
	} else {
		/delay 3
		/goto :CanCast
	}
	/goto :BeginLoop
	
:End
/return


I could calc spell casttime, recovery, etc, but that's not as elegent. :?

fwiggles
a hill giant
a hill giant
Posts: 161
Joined: Mon Jun 17, 2002 8:29 pm

Post by fwiggles » Wed Jun 04, 2003 12:27 am

they way i get casttime and recovery etc would be from the readme
Macroquest Readme wrote: $spell("spell name",xxx)
Returns information on a spell
xxx can be: id, level, mana, range, casttime, recoverytime, recasttime, duration
casttime, recoverytime, recasttime, and duration are in seconds
duration can also return INSTANT, PERMANENT or UNKNOWN
they way i right it to calculate spell casttime and duration is

/varset HealReCastTime $calc($spell("$HealSpell",casttime)+$spell("$HealSpell",recasttime)+1)

this works very well with my powerleveling macro that i'm working on, assuming that the macro wiill work as i am still working on it
Last edited by fwiggles on Wed Jun 04, 2003 12:59 am, edited 1 time in total.
[color=red]Latest survey shows that 3 out of 4 people make up 75% of the world's population.[/color]

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Post by GoatFoot » Wed Jun 04, 2003 12:46 am

yep, been there, done that; but then I need to check for fizziles - and futher down the road - interrupts. And I'm sure there will be various other times when it would be nice to know if a toon is casting or not. :)

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Wed Jun 04, 2003 2:01 am

This used to be possible; however, it used offsets we believe do not exist anymore (ie, all the cls* offsets).

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Jun 04, 2003 9:23 am

lol I hate to say it, but I count the seconds and put in a delay statement after the /cast command. Then I edit the macro if I change the spell. I know, sucks, but the only way I know how to do it right now.
MQ2: Think of it as Evolution in action.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

spellsub.inc include file for spell handling.

Post by grimjack » Thu Jun 12, 2003 3:05 am

This should do what you want. It will calculate delay's from the spell name and recast on interupt/fizzle/ect. I have not tested any of my scripts since the patch yet. I'm pretty sure this one broke with the patch but may have been fixed with newly posted spelllist structure.

Code: Select all

|spellsub.inc
| Example: /call SpellSub Ice Comet
#Event CastStart "You begin casting"
#Event CastFizzle "Your spell fizzles!"
#Event CastInterrupt "Your spell is interrupted."
#Event CastNoMana "Insufficient Mana to cast this spell"
#Event CastTooFar "Your target is out of range, get closer!"
#Event Recovered "You haven't recovered yet..."
#Event CastResist "Your target resisted "
#Event Distracted "You are too distracted to cast a spell now!"
#Event NoTarget "You must first select a target for this spell!"
#Event Sitting "You must be standing to cast a spell."
#Event NoMem "You do not seem to have that spell memorized."
#Event Stunned "You can't cast spells while stunned!"
#define Fail v94
#define DoAgain v95
#define StartCast v96
#define SpellSlot v97
#define SpellName v98
#define CastTime v99
#define CTimer t39 

Sub SpellSub
   /sendkey up up
   /varset Fail 0
   /if n $strlen("$p0")<=0 {
      /return
   } else /if n $strlen("$p1")<=0 {
      /varset SpellName "$p0"
   } else /if n $strlen("$p2")<=0 {
      /varset SpellName "$p0 $p1"
   } else /if n $strlen("$p3)<=0 {
      /varset SpellName "$p0 $p1 $p2"
   } else {
      /varset SpellName "$p0 $p1 $p2 $p3" 
   }
   /varset SpellSlot "$char(gem,"$SpellName")"
   /varset CastTime "$spell("$SpellName",casttime)"
   :BeginCast
   /varset DoAgain 0
   /varset StartCast 0
   /call WaitForStart
   :TimerLoop
   /doevents
   /if n $DoAgain==1 /goto :BeginCast
   /if n $Fail==1 /return
   /doevents
   /if n $DoAgain==1 /goto :BeginCast
   /if n $Fail==1 /return
   /if n $CTimer>0 /goto :TimerLoop
   /delay 2
   /doevents
   /if n $DoAgain==1 /goto :BeginCast
/return


Sub WaitForStart
   /cast $SpellSlot
   :StartLoop
   /doevents
   /if n $Fail==1 /return
   /if n $DoAgain==1 /return
   /if n $StartCast==0 {
      /goto :StartLoop
   }
   /varset CTimer "$CastTime"s
/return

Sub Event_CastStart
   /varset StartCast 1
/return

Sub Event_CastFizzle
   /delay 2
   /varset DoAgain 1
/return

Sub Event_CastInterrupt
   /delay 2
   /varset DoAgain 1
/return

Sub Event_Sitting
   /stand
   /delay 2
   /varset DoAgain 1
/return

Sub Event_CastTooFar
   /varset Fail 1
   /varset CTimer 0
/return

Sub Event_Distracted
   /varset Fail 1
   /varset CTimer 0
/return

Sub Event_NoTarget
   /varset Fail 1
   /varset CTimer 0
/return

Sub Event_NoMem
   /varset Fail 1
   /varset CTimer 0
/return

Sub Event_CastNoMana
   /sit off
   /sit on
   /varset Fail 1
   /varset DoAgain 1
/return

Sub Event_Stunned
   /delay 3s
   /varset DoAgain 1
/return

Sub Event_Recovered
   /delay 2s
   /varset DoAgain 1
/return

Sub Event_CastResist
   /varset DoAgain 1
/return

Sub Event_Collapse
   /varset DoAgain 1
/return

Sub Event_NoLOS
   /varset Fail 1
   /varset CTimer 0
/return

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Thu Jun 12, 2003 7:30 pm

Using events as grimjack posted is a far better way to go.

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Thu Jun 19, 2003 5:46 pm

Actually this could be done. Now that we have the root of where the window code is called from... the cast bar could be called and if it was up that would be casting==TRUE