ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: VicVega on May 18, 2009, 08:00:29 AM

Title: Chivalry 0.1 for Public Testing
Post by: VicVega on May 18, 2009, 08:00:29 AM
Code: [Select]
;=================================================================
; Script Name: Chivalry
; Author: VicVega
; Version: 0.2
; Shard OSI / FS: UO Legends
; Revision Date: 20/5/2009
; Purpose: Trains Chivalry to GM
; Globals: None
;=================================================================
; Instructions: You need to setup your fcr in %userFcr variable
;               It's 0 by default
;
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub checkskill
  gosub chooseChivSpell
  while #mana >= %minManaToCast
    gosub castChivalrySpell
  gosub meditate
  while #mana < #maxMana
    gosub checkMeditateStatus
until #charGhost = yes
return
;************************* Subs **********************************
sub setup
  set %userFcr 0
  chooseskill chiv real
  set %startingskill #skill
  str len %startingskill
  str ins %startingskill #dot #strRes
  set %startingskill #strres
  set %successMessageTrance you_enter_a_meditative
  set %successMessagePeace you_are_at_peace
  set %failFocus cannot_Focus
  set %failWait you_must_wait
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
  set %currentskill #skill
return

sub castChivalrySpell
  event Macro 15 %spell
  target
  event Macro 23 0
  wait %fcrDelay
return

sub meditate
  wait 1s
  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

Sub chooseChivSpell
  chooseskill chiv
  set %skill #skill real
  set %minManaToCast 10
  if %skill < 1000 && %skill > 849
  {
    set %spell 208  ; Noble Sacrafice
    set %minManaToCast 20
  }

  if %skill < 850 && %skill > 749
    set %spell 207  ; Holy Light

  if %skill < 750 && %skill > 649
  {
    set %spell 206  ; Enemy of One
    set %minManaToCast 20
  }

  if %skill < 650 && %skill > 549
    set %spell 204  ; Dispel Evil

  if %skill < 550 && %skill > 449
  {
    set %spell 205  ; Divine Fury
    set %minManaToCast 15
  }

  if %skill < 450 && %skill > 349
    set %spell 203  ; Consecrate Weapon

  if %skill < 350
  {
    set %spell 209  ; Remove Curse
    set %minManaToCast 20
  }
return

sub setFcrDelay
  if %userFcr = 6
    set %fcrDelay 1
  if %userFcr = 5
    set %fcrDelay 2
  if %userFcr = 4
    set %fcrDelay 3
  if %userFcr = 3
    set %fcrDelay 5
  if %userFcr = 2
    set %fcrDelay 10
  if %userFcr = 1
    set %fcrDelay 15
  if %userFcr = 0
    set %fcrDelay 20
return
Title: Re: Chivalry 0.1 for Public Testing
Post by: TrailMyx on May 19, 2009, 12:53:17 PM
VicVega has been busy!  :)

TY!
Title: Re: Chivalry 0.1 for Public Testing
Post by: Cerveza on May 20, 2009, 05:31:58 AM
Good stuff, thanks!
Title: Re: Chivalry 0.1 for Public Testing
Post by: VicVega on May 20, 2009, 07:01:13 AM
Added support for FCR delay and other minor changes, I'll left pass a few more days in case someone notice something wrong and then I will post it on the "Submit your script" section.
Title: Re: Chivalry 0.1 for Public Testing
Post by: DeadIssue2 on May 22, 2009, 07:22:10 AM
Tell ya what I just played with this one a bit. Now my shard hits ROT at 70 but from 0 to 70 was really a nice ride. Well thought out and well written.
Title: Re: Chivalry 0.1 for Public Testing
Post by: Toptwo on May 22, 2009, 02:20:10 PM
Another GREAT script. I actually d/l this one and started it first before I saw your Bushido script. Started with a skill of 50 and had it to 55 in less then 30 min (I could have been faster but what warrior has med??) Great scrip...I guess I will be busy the next couple days developing yet another whammy on one of my other accts!

Thanks!

Toptwo