ScriptUO

Ultima Online Fan Board => General UO Chat => Topic started by: NObama on March 18, 2012, 01:33:23 PM

Title: How do you script a summoning spell?
Post by: NObama on March 18, 2012, 01:33:23 PM
Attempting to make myself a mobile RC casting bot.  Intent is to dynamically target the square next to me every time I cast a Colossus.  I'm using TM's awesome spellcast subs, but unfortunately I can't figure out how to get a square of ground into #ltargetid.

Help?
Title: Re: How do you script a summoning spell?
Post by: TrailMyx on March 18, 2012, 03:26:01 PM
Here's a little script I wrote a long time ago that summons energy vortexes.  Might be similarly useful:

Code: [Select]
set %targetx #CHARPOSX
set %targety #CHARPOSY - 5
;set %creature_type SY ; blade spirits
set %creature_type YI ; energy vortex
repeat
  if #FOLLOWERS < 4
    gosub Summon
until #FALSE
;-----------------------------------------------
sub Summon
;  event macro 15 32 ; blade spirits
  event macro 15 57 ; energy vortex
  target 20s
  set #LTARGETKIND 2
  set #LTARGETX %targetx
  set #LTARGETY %targety
  event macro 22 0
  wait 40
return
;-----------------------------------------------
sub Meditate
  namespace push
  namespace local MED
  set !wait %1
  set !thresh %2
  gosub TM_SyncTextScan
  set !mana_target #INT - !thresh
  set !success #FALSE
  med_loop1:
    if #MANA > !mana_target
      goto Meditate_skip
    if !success = #FALSE
    {
      gosub TM_SyncTextScan
      event macro 13 46
      wait 20
    }
    gosub TM_FindValidTextNoAdvance you_enter_a_meditative_trance
    if #RESULT = #TRUE
    {
      gosub TM_SyncTextScan
      if !wait <> #TRUE
        goto Meditate_skip
      set !success #TRUE
    }
    gosub TM_FindValidTextNoAdvance you_stop_meditating
    if #RESULT = #TRUE
    {
      gosub TM_SyncTextScan
      set !success #FALSE
    }
    goto med_loop1
Meditate_skip:
  namespace pop
return
;-------------------------------------------------------------------------------
; Brings !_jindex up to the most recent #journal entry
sub TM_SyncTextScan
  namespace push
  namespace local text
  set !_jindex #jindex + 1
  namespace pop
return
;-------------------------------------------------------------------------------
; %2, %3, %4, etc strings to match
; returns #TRUE for match, #FALSE for no match
;  Will not advance !_jindex pointer to allow for scanning journal history for more than one search.
;  Also searches for : , #SPC in journal entry to be sure someone isn't spamming the text
sub TM_FindValidTextNoAdvance
  namespace push
  namespace local text
  set !temp_lpc #LPC
  set #LPC 1000
  set !num_args %0
  set !first_arg 1
  if !_jindex = N/A
    set !_jindex #jindex
  set !index !first_arg
  repeat
    set !temp_jindex !_jindex
    set !text % . !index
    while !temp_jindex <= #jindex
    {
      scanjournal !temp_jindex
      if !text in #journal && :_ , !text notin #journal
      {
        set !temp_jindex !temp_jindex + 1
        set #LPC !temp_lpc
        namespace pop
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until ( ( !index - !first_arg ) > ( !num_args - 1 ) )
  set #LPC !temp_lpc
  namespace pop


If you want to use the spellcast subs, you'll need to change the #LTARGETKIND to 2 so the ground will be targeted.

Might be easier to just use the little snippet above.
Title: Re: How do you script a summoning spell?
Post by: manwinc on March 18, 2012, 03:29:59 PM
If you are in SA, you may as well Give up! As far as I know anyways. I never could figure out how to even target snakes nests in SA, much less cast a rising.

Your best bet, would be to base what tile is immediately behind you or in front of you based on your #Chardir, and set a universal Click X Click Y For those two spots and once the target cursor comes up, you click the location.

Title: Re: How do you script a summoning spell?
Post by: Crome969 on March 19, 2012, 05:01:01 AM
Attempting to make myself a mobile RC casting bot.  Intent is to dynamically target the square next to me every time I cast a Colossus.  I'm using TM's awesome spellcast subs, but unfortunately I can't figure out how to get a square of ground into #ltargetid.

Help?
Scan all times around you and define "Good" and "Bad Tiles" then use the xyz for target on a good tile, did this many years ago with a hord of Mages doing afk Champs by casting nonstop energy vortex