ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: VicVega on May 18, 2009, 07:59:16 AM

Title: Spirit Speak 0.1 for Public Testing
Post by: VicVega on May 18, 2009, 07:59:16 AM
Code: [Select]
=================================================================
; Script Name: Spirit Speak
; Author: VicVega
; Version: 0.2
; Shard OSI / FS: UO Legends
; Revision Date: 20/5/2009
; Purpose: Trains Spirit Speak to GM
; Globals: None
;=================================================================
; Instructions: Just press play
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub checkskill
  while #mana >= %minManaToCast
    gosub useSpiritSpeakSkill
  gosub meditate
  while #mana < #maxMana
    gosub checkMeditateStatus
until #charGhost = yes
;************************* Subs **********************************
sub setup
  chooseskill spir real
  set %startingskill #skill
  str len %startingskill
  str ins %startingskill #dot #strRes
  set %startingskill #strres
  set %minManaToCast 10
  set %successMessage You_channel_your_own_spiritual
  set %successMessageTrance you_enter_a_meditative
  set %successMessagePeace you_are_at_peace
  set %failMessage You_fail_your_attempt
  set %failWait you_must_wait
  set %failFocus cannot_Focus
return

sub checkskill
  if #skill = #skillcap
    halt
  set %currentskill #skill
  str len %currentskill
  str ins %currentskill #dot #strRes
  set %currentskill #strres
  setuotitle SS %startingskill | CS %currentskill
return

sub useSpiritSpeakSkill
  event macro 13 32
  gosub scan %successMessage %failMessage %failWait
  wait 6s
  gosub checkskill
return

sub meditate
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
return

sub checkMeditateStatus
  if %scanResult = %failWait
  {
    wait 1s
    event macro 13 46
    gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
    set %scanResult #result
  }
  if %scanResult = %failFocus
  {
    wait 10s
    event macro 13 46
    gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
    set %scanResult #result
  }
return

sub scan
  set %maxTimeOutScan 15
  set %timeout #scnt + %maxTimeOutScan
  set %jrnl #jindex
  scanjournal %jrnl

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }
    for %journalCounter 1 %0
    {
      if % . %journalCounter in #journal
        return % . %journalCounter
    }
  }
return
Title: Re: Spirit Speak 0.1 for Public Testing
Post by: VicVega on May 20, 2009, 07:24:07 AM
Added some minor changes, if in a few days nobody find problems I will add it to the "submit your script section".
Title: Re: Spirit Speak 0.1 for Public Testing
Post by: Cerveza on May 20, 2009, 07:31:38 AM
Well organized, seems very solid.

Nice work.
Title: Re: Spirit Speak 0.1 for Public Testing
Post by: Khameleon on May 20, 2009, 05:28:47 PM
Vic, your Avatar makes me laugh!
Title: Re: Spirit Speak 0.1 for Public Testing
Post by: VicVega on May 21, 2009, 12:17:42 AM
He is a funny monster indeed.  :P