Author Topic: How to: Gain Mana with Meditation Skill  (Read 4367 times)

0 Members and 1 Guest are viewing this topic.

Offline rana70Topic starter

  • Elite
  • *
  • *
  • Posts: 294
  • Activity:
    0%
  • Reputation Power: 5
  • rana70 has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 2
    • View Profile
    • MyScripts
How to: Gain Mana with Meditation Skill
« on: October 12, 2009, 09:43:20 AM »
0
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.

Code: [Select]
;==============================================================================
; 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

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: How to: Gain Mana with Meditation Skill
« Reply #1 on: October 12, 2009, 11:27:21 AM »
0
Might want to bung a wait 1 in thier to give the OS a chance to do something elese while its waiting.

Code: [Select]
   ; Wait for Mana gain
   While #MANA < #MAXMANA
    {
     ;Simply Wait until #Mana reached #Maxmana
    }
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline Wakiza

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • Wakiza has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: How to: Gain Mana with Meditation Skill
« Reply #2 on: October 12, 2009, 04:00:34 PM »
0
Hi Rana70, this is very nice. It basically does exactly what i was trying to do. I really like how everything is laid out, seems very organized compared to other scripts i been trying to decipher. Now that you have taken the time to help, hopefully i can learn from it! I must admit i feel a bit overwhelmed, but i think it will just take some time.

Thanks for your help with this problem.






Offline Hoby

  • Elite
  • *
  • *
  • Posts: 1344
  • Activity:
    0%
  • Reputation Power: 14
  • Hoby barely matters.Hoby barely matters.
  • Gender: Male
  • Respect: +79
  • Referrals: 1
    • View Profile
Re: How to: Gain Mana with Meditation Skill
« Reply #3 on: November 18, 2009, 02:20:21 PM »
0
thx rana was looking for this exactly.  Now need to figure out to implement it into my script. :)
I like you, your death shall be quick and painless!!
I may have alzheimers, but at least I don't have alzheimers.
Walruses are like vampires, only awesome
Pwned-The total domination or shut down of a person or thing. 
I believe a hangover is gods way of saying you kicked ass last night!
Life's to short to remove usb safely.

Tags: