So I've mainly done development with non-scripting languages in my past, but I always find it fun to come back to MQ2/EQ to script for automating character activities. One thing I've always noticed is that with MQ2 you generally perform an operation that may take place instantly or take x seconds to complete. Either way, that line of code is executed immediately and we move on.
For example, if I have:
/cast 8
/exit
I cast and instantly exit, instead of waiting for the cast to finish. What do you folks believe the advantage/disadvantages of using something like this:
In my opinion, the main disadvantage is by using these routines I've created you can't do additional processing while casting. In other words, if I started casting a complete heal, and need to cancel to do a faster heal it won't happen. Aside from not being able to do additional processing, what else am I missing?
Also, feel free to comment on my horrible scripting abilities. This functionality may exist somewhere already and I didn't even need to write this.
NOTE: Some comments about the code. The subs above will wait to cast the spell if you are already casting a spell. We delay 2s after you've finish casting the initial spell because there is the whole "refresh" cycle before spells become available again. Then we cast the spell requested, waiting for it to finish before returning.
For example, if I have:
/cast 8
/exit
I cast and instantly exit, instead of waiting for the cast to finish. What do you folks believe the advantage/disadvantages of using something like this:
Code:
|--------------------------------------------------------------------------------
|SUB: Cast a spell (int)
|--------------------------------------------------------------------------------
Sub CastSpell(int pSpellToCast)
/declare vAlreadyCasting FALSE
|/echo int=${pSpellToCast}
:StartCasting
/if ( ${Me.Casting.ID} ) {
/varset vAlreadyCasting TRUE
/goto :StartCasting
}
/if ( ${vAlreadyCasting} ) {
/delay 2s
}
/cast ${pSpellToCast}
:StillCasting
/if ( ${Me.Casting.ID} ) {
/goto :StillCasting
}
|/echo Finished casting!
/return
|--------------------------------------------------------------------------------
|SUB: Cast a spell (string)
|--------------------------------------------------------------------------------
Sub CastSpellString(pSpellToCast)
/declare vAlreadyCasting FALSE
|/echo string=${pSpellToCast}
:StartCasting
/if ( ${Me.Casting.ID} ) {
/varset vAlreadyCasting TRUE
/goto :StartCasting
}
/if ( ${vAlreadyCasting} ) {
/delay 2s
}
/cast "${pSpellToCast}"
:StillCasting
/if ( ${Me.Casting.ID} ) {
/goto :StillCasting
}
|/echo Finished casting!
/return
In my opinion, the main disadvantage is by using these routines I've created you can't do additional processing while casting. In other words, if I started casting a complete heal, and need to cancel to do a faster heal it won't happen. Aside from not being able to do additional processing, what else am I missing?
Also, feel free to comment on my horrible scripting abilities. This functionality may exist somewhere already and I didn't even need to write this.
NOTE: Some comments about the code. The subs above will wait to cast the spell if you are already casting a spell. We delay 2s after you've finish casting the initial spell because there is the whole "refresh" cycle before spells become available again. Then we cast the spell requested, waiting for it to finish before returning.