Hi,
this is just a small example how to use :
- Use the Meditation Skill
- Read out a Journal
- auto disable the use of Meditation Skill if wrong armor is worn
- cast magery Spells
I added a lot of comments to give an idea how it works,
the Journal Scan is a basic solution and as soon as you
have got the idea I would recommend to check out
TM JournalScan SUB.
His Journal Scanner is far more advanced and fail safe.
;==============================================================================
; Script Name: Rana's SUB Mediatation
; Author: Rana
;==============================================================================
; Wait Timer feel free to adjust if you have timing related Error Msg.
Set %DelayEvent 20 ; Waittime for Event Macro Function
Set %DelaySkillUse 10 ; Waittime in sec between Skill uses
; #true = use Mediation Skill for faster Mana Regneration
; #false = Skip this option, if you run out of mana script will just wait
Set %Medi_UseSkill #TRUE
; Set the Mana Level to start using the Meditation Skill to gain MANA
Set %Medi_StartLvl ( #MAXMANA / 2 )
; Internal Vars to check status and failsafe
Set %Medi_Activ #FALSE ; This will report when the Medi Skill is activ
Set %NextTimeforSkill #SCNT ; Marker when you can use the skill next Time
; MainScriptLoop
;------------------------ Main Script -------------------------
Repeat
{
; Check Mana and if needed use Meditation SUB to regain
if #MANA < %Medi_StartLvl
GoSUB Meditation
; Do what ever you like to do in your Main Loop
; In this case I simply Cast a Magery Spell
Event Macro 15 43 ; Cast Spell Invis
Wait %DelayEvent
Target
Event Macro 23 ; Target Self
Wait %DelayEvent
Wait 3s ; just wait for next Spell
}
Until #CHARGHOST = YES
; End of Script
HALT
; SUB's Area
; =================================================
; Re Gain Mana with or without the Help of MEDI Skill
;------------------------ Routine -----------------------------
SUB Meditation
While %Medi_UseSkill = #TRUE && %Medi_Activ = #FALSE
{
; Call the SUB for the Meditation Skill
GoSUB UseSkill_Meditation
; Check if the Medi Skill became active
; RESULT is TRUE if Medi Skill is active
; Medi active means, basicly stop
; "use skill Medi" and start to gain Mana
GoSUB JournalScan You_enter_a_meditative_trance
if #RESULT = #TRUE
Set %Medi_Activ #TRUE
; Failsafe routine if the Char wears any wrong
; armor, to prevent script from trying to use Medi Skill
; RESULT is TRUE will auto deactivate the Mediation part
GoSUB JournalScan penetrate
if #RESULT = #TRUE
Set %Medi_UseSkill #FALSE
}
; Wait for Mana gain
While #MANA < #MAXMANA
{
;Simply Wait until #Mana reached #Maxmana
}
; Reset Medi_Activ flag for next cylcle
Set %Medi_Activ #FALSE
RETURN
; Use Meditation Skill
;------------------------ Routine -----------------------------
SUB UseSkill_Meditation
; just wait before use the Skill to prevent error Msg
; if you do not wait you will have error Msg on screen
While #SCNT < %NextTimeforSkill
{
}
; Use Medi Skill
Event Macro 13 46 ; Use Meditation Skill
Wait %DelayEvent
; Timer for next possible skill use
Set %NextTimeforSkill ( #SCNT + %DelaySkillUse )
RETURN
; Scan the Journal Log for Keywords
;------------------------ Routine -----------------------------
SUB JournalScan %1
; %1 Text to Scan for
Set %JournalStart #jIndex
Set %ScanMessage %1
For %tmp %JournalStart #jIndex
{
Scanjournal %tmp
if %ScanMessage in #journal
RETURN #TRUE
}
RETURN #FALSE
cu