ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Script development tools => Topic started by: TrailMyx on June 09, 2008, 12:15:13 PM

Title: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on June 09, 2008, 12:15:13 PM
Code: [Select]
;=================================================================
; Script Name: TrailMyx's Runebook/Spellcast Subs
; Author: TrailMyx
; Version: 2.5
; Shard OSI / FS: OSI / FS
; Revision Date: 09/27/2007
; Purpose:
;   Runebook subs to manage your runebook travel needs.  You need either to know
;   the runebook ID or runebook name.
;
; Subroutines:
;     TM_NewCastSpell - casts spells with appropriate waits, delays, retrys.
;     TM_TravelFromRunebook - Uses specified runbook #FINDID to travel from .  If a location is blocked
;                             the next location will be tried until success.
;     TM_TravelFromNamedRunebook - Same as TM_TravelFromRunebook, but allows you to specify a runebook name
;
;  Examples:
;     gosub TM_NewCastSpell 31 !rbook 10 20 20 ; recall
;     gosub TM_TravelFromRunebook RE 1 3 %runebookid ; travel (recall) to location from #FINDID runebook using slots 1-3
;     gosub TM_TravelFromNamedRunebook GA 1 2 LUMBERJACKING1 ; gate using LUMBERJACKING1 runebook starting at rune 1
;     gosub TM_RandomRunebookTravel SJ 1 6 %runebookid  ; Randomly choose a rune from 1-6 in runebook
;     gosub TM_TravelFromObject RE %runeid ; travels to rune specified by %runeid
;
;  Use of these subrountes is allowed, but please give me (TrailMyx) credit somewhere in your script.
;
;  Release History:
;     2.0 - Initial public release
;     2.1 - Bug in TM_FindValidTextNoAdvance, added return value to TM_TravelFromNamedRunebook
;     2.2 - Bug in TM_NewCastSpell when mana gets too low
;     2.3 - Better spellcasting for chivalry, necro
;           Added TM_TravelFromNamedRunebook
;           Added TM_RandomRunebookTravel
;     2.4 - Little fix for journal handler
;     2.5 - Hack to allow for transport through a red moongate.
;
;  Requirements:
;
;    This script requires that you have your character name
;    setup in a variable called %charname.  Place this bit of code
;    in your script initialization somewhere:
;
;   gosub TM_AddUnderscore #CHARNAME
;   set %charname #RESULT
;=================================================================
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on September 03, 2008, 10:57:45 AM
Hello sir!!

These subs are staples in all of my projects requiring this functionality, thanks SO much!

I was working on integrating these subs into a project today when I was really supposed to be working and I had a couple of thoughts/questions...

First, I see that your attached file is called 2.6 however your version Change Control states changes only up to 2.5. Is the attached really 2.6 and, if so, what is the difference from 2.5? Just want to make sure I stay consistent with your updates.

The other question is really a series of thoughts. Have you considered (or would you consider) changing the TravelFromRunebook subs to return more detail than #TRUE if error or #FALSE if success in order to allow for the development of more ellaborate error checking routines? Just thinking about how that could make for more decisioning options returning from the subs. For example, #TRUE gets returned if a) the travel method is not one of those listed (coder error), b) the rune number is not 1-16 (coder error) c) location is blocked (script logic change could allow for next rune in book), d) spirit_lacks (script logic change could simply try again), etc. If different issues allowed for different return status then appropriate logic could be adopted by the coder. This could be further augmented by putting limitations on the number of RE/GA/SJ attempts each time as well (rather than fizzling for eternity for example if, come to find out, you really can't cast Gate Travel with 22.6 Magery) with another return value ("return skill2low").

Does that make sense? I was thinking about just going and modifying the sub for my needs but I really don't want to "dirty your code" with my feebleness and, frankly,  I don't want to have to track my customizations for recoding every time you update your subs  ;D (so selfish, I know)!!

You could also simply pass this off as the ramblings of a rapidly aging wannabe with OCD and that would be ok too, hehe.

Let me know whatcha think.

XII
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on September 03, 2008, 12:21:15 PM
Hello sir!!

These subs are staples in all of my projects requiring this functionality, thanks SO much!

I was working on integrating these subs into a project today when I was really supposed to be working and I had a couple of thoughts/questions...

First, I see that your attached file is called 2.6 however your version Change Control states changes only up to 2.5. Is the attached really 2.6 and, if so, what is the difference from 2.5? Just want to make sure I stay consistent with your updates.

The other question is really a series of thoughts. Have you considered (or would you consider) changing the TravelFromRunebook subs to return more detail than #TRUE if error or #FALSE if success in order to allow for the development of more ellaborate error checking routines? Just thinking about how that could make for more decisioning options returning from the subs. For example, #TRUE gets returned if a) the travel method is not one of those listed (coder error), b) the rune number is not 1-16 (coder error) c) location is blocked (script logic change could allow for next rune in book), d) spirit_lacks (script logic change could simply try again), etc. If different issues allowed for different return status then appropriate logic could be adopted by the coder. This could be further augmented by putting limitations on the number of RE/GA/SJ attempts each time as well (rather than fizzling for eternity for example if, come to find out, you really can't cast Gate Travel with 22.6 Magery) with another return value ("return skill2low").

Does that make sense? I was thinking about just going and modifying the sub for my needs but I really don't want to "dirty your code" with my feebleness and, frankly,  I don't want to have to track my customizations for recoding every time you update your subs  ;D (so selfish, I know)!!

You could also simply pass this off as the ramblings of a rapidly aging wannabe with OCD and that would be ok too, hehe.

Let me know whatcha think.

XII

Well, I'm certainly not in the position to do much with these.  However, most of your suggestions can be formed into a sub that's called upon failure of a Runebook usage.  So things like skill, mana, blocked all can be looked at by a separate sub and you can form whatever additional conditions you might want. 

For me, I needed to be able to keep this very simple for the casual user without over complicating it.  Everything you ask is a great idea, but I think it would be better supported by some follow up functions after the call.

What you might do is have a wrapper function for mine so you check the items before, and then do a follow up call to an additional function that will determine why a recall didn't go well.  Really, if you were to setup a separate journal scanner, you can watch all that yourself.

So if you can figure out a way to wrap my subs, then you can keep your changes separate.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on September 03, 2008, 12:29:10 PM
Ah simplicity; I heard the door open and there she stood...

Sounds good, thanks for the reply and the suggestion. I'll play around with it.

How about the version question, is this actually 2.6?

XII
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on September 03, 2008, 12:33:27 PM
Ah simplicity; I heard the door open and there she stood...

Sounds good, thanks for the reply and the suggestion. I'll play around with it.

How about the version question, is this actually 2.6?

XII

Ah, I guess I need to release those.  2.6 uses the advanced journal scanner.  You might check, I may have released 2.5 with the AdvJS, but as 2.5.  Anyhow, I did bump the revision eventually.

Edit:  Ok, those are the correct ones posted, I just forgot to revision change the text.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Khameleon on September 03, 2008, 03:05:13 PM
ahh.. I love Subs.. its a shame Alexandria never did to well.. I was really into that, though it did suck that they Relied on ContKinds....
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: _C2_ on November 10, 2008, 11:09:33 AM
I looked for a bit but did not see your travel subs posted here so I was unable to see if they have been updated at this point.  Edit:  I found them LOL but they are the same as what I have.

I was wondering if you or anyone else was having an issue with it making the sacred journey successfully but not having the script recognize success and it trying to sacred until it changes to the back up rune.

If that hasn't been the case do you think that there maybe a difference needed in a waittime for chiv vs recall and if so where do you suggest looking. 

I am thinking that it scans for success or checks coords too fast do to slight lag of UO of late.  I will be looking into it more but haven't had the time to dive in and look for where to add some more wait.

You may be able to point the spot or spots out in a few seconds.  I am also curious if it scans journal before the message comes up then it pops up after scan and gets synched out.  Anyway I need to look a bit but I was checking in on this issue first.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 10, 2008, 11:46:50 AM
The problem with using recall or SJ, there is some lag that you can't really predict.  The only thing you can do is to increase the wait time and hope you don't have a super long lag time.  Actually, I have noticed longer lag these days for some reason.  There's a 10 second timer that should catch this.

For debugging purposes, you might see if it's failing in the Spellcast sub (i.e. tries to cast SJ again).  If that's the case, you might want to try changing the second timeout (in TM_TravelFromRunebook):

Code: [Select]
  if !method = SJ
    gosub TM_NewCastSpell 210 !rbook -1 10 10 ; was 50

Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: luv2luvlong on November 10, 2008, 12:21:59 PM
if you have a chance look at man whore's lumberjacker on easyuo's page. he has a position change sub that waits for you to port before continuing.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 10, 2008, 12:26:45 PM
That's also built into my subs as well.  Sounds like it's waiting too long to sense that the chivalry spell has been successful.  Chiv and necro spells are a bit different in that there isn't the same response back that you have successfully done a spell.  i.e. There's no "your spell fizzles."  So you're left with sensing your mana drop, or your target is gone.  If you wait too long to sense the mana, and you have high enough meditation/focus/mana regeneration items, you can possibly come back and have full mana in 2.5 seconds.   
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 10, 2008, 12:56:17 PM
Another thing to try C2 is to replace the TM_NewCastSpell with this one.  I wrote this sub before I knew about the A in #CHARSTATUS, so there could be a point when you are still frozen because of lag, but the sub continues.  This one has a wait also to be sure you are still not frozen instead of just relying on your initial spell delay.

Edit: This probably won't help though since you're waiting for a target cursor anyhow...


Code: [Select]
;-------------------------------------------------------------------------------
; %1 = spell number
; %2 = #TARGETID or SELF or NONE
; %3 = retry count (-1 = cast until successful)
; %4 = cast delay
; %5 = recovery delay
sub TM_NewCastSpell
  namespace push
  namespace local NCS
  set !lpc #LPC
  set #LPC 100
  set !whichspell %1
  set !whichtarget %2
  set !castretrymax %3
  set !waitdelay %4
  set !recovery_delay %5

  set !castretry 0
  set !temp_ltargetid #LTARGETID
  set !temp_ltargetkind #LTARGETKIND

  NewCastSpell_loop1:
    if !castretrymax < 0
      goto NewCastSpell_cont1
    if !castretry > !castretrymax
      goto NewCastSpell_end1
    NewCastSpell_cont1:
      gosub TM_SyncTextScan
      set #LTARGETKIND 1
      set #LTARGETID !whichtarget
      set !tempmana #MANA
      event macro 15 !whichspell ; cast the spell
      wait !waitdelay
      repeat
      until A notin #CHARSTATUS
      set !targettimeout #SCNT + 7
      NewCastSpell_wait1:
        gosub TM_FindValidTextNoAdvance spell_fizzles you_have_not_yet mana your_spirit more_reagents
        if #RESULT = #TRUE || #SCNT > !targettimeout
        {
          set !casttimeout #SCNT2 + !recovery_delay
          repeat
          until #SCNT2 > !casttimeout     ; finish up cast delay
          set !castretry !castretry + 1
          goto NewCastSpell_loop1
        }
        if !whichtarget = NONE
          goto NewCastSpell_skip1
        if #TARGCURS = 1
          goto NewCastSpell_targ1
        goto NewCastSpell_wait1 ; wait for target cursor

  NewCastSpell_targ1:
    if !whichtarget = SELF
      event macro 23
    else
      event macro 22

  NewCastSpell_skip1:
    wait 5
    set !casttimeout #SCNT2 + !recovery_delay
    NewCastSpell_skip2:
      if !whichspell >= 0 && !whichspell <= 63 ; Magery
      {
        gosub TM_FindValidTextNoAdvance spell_fizzles there_is_already mana your_spirit more_reagents
      }
      else
      {
        set !cont #FALSE  ; Chivalry, Necromancy, etc
        finditem !whichtarget *
        if !whichtarget in SELF_NONE || #FINDKIND <> -1
          set !cont #TRUE

        if #MANA >= !tempmana && !cont = #TRUE ; check if target is still there
          set #RESULT #TRUE
        else
          set #RESULT #FALSE
      }
      repeat
      until #SCNT2 > !casttimeout     ; finish up cast delay
      if #RESULT = #TRUE
      {
        if !castretrymax > -1
        {
          set !castretry !castretry + 1 ; %castretrymax of -1 will cast until successful
          if !castretry > !castretrymax
            goto NewCastSpell_end1
        }
        goto NewCastSpell_loop1
      }
      if #SCNT2 <= !casttimeout     ; finish up cast delay
        goto NewCastSpell_skip2
  NewCastSpell_end1:
    set #LTARGETID !temp_ltargetid
    set #LTARGETKIND !temp_ltargetkind
    set #LPC !lpc
    namespace pop
return
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Endless Night on November 10, 2008, 07:20:39 PM
Ignore ME

Edit .. properly read thread and my comments we already inthier no porint repeating.

SPAM POST LOL
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 10, 2008, 10:29:26 PM
Ignore ME

Edit .. properly read thread and my comments we already inthier no porint repeating.

SPAM POST LOL


Haha,  oops.  Ohh, SPAM.  That stuff is good grilled!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Nicar on November 11, 2008, 08:15:54 AM
Ignore ME

Edit .. properly read thread and my comments we already inthier no porint repeating.

SPAM POST LOL


Haha,  oops.  Ohh, SPAM.  That stuff is good grilled!

SPAM potato and eggs in a tortilla? 
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: _C2_ on November 11, 2008, 06:50:45 PM
Well the quick solution was to just put protection on.  LOL  but I have been watching the steps  and see the differences between chiv and mage.  I will add your sub though!  Thx TM
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 11, 2008, 06:59:00 PM
Well the quick solution was to just put protection on.  LOL  but I have been watching the steps  and see the differences between chiv and mage.  I will add your sub though!  Thx TM

Protection!?!  Why would that help unless you were being harassed by a mongbat?  lol.  I'd be interested in finding out what tweak I need to add to the subs, so lemme know what you find so I can include the fix.  At the moment, I don't  have a character that does much SJ.  I may have to track down my test subs and do some iteration testing.  Problem is that most of my test runes were to cities you can no longer recall to.  Boy I wish they'd leave the cities alone during events.  They are all ghosttowns anyhow.  I wish I still have screenshots of the heydays of UO around the Vesper bank.  30-40 people running around with the same going on even at the Minoc bank.  I'm sad now.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 12, 2008, 12:14:04 AM
I had a chance tonight to play a bit with this.  I'm actually finding some strange things.  I ran some old test code where I just recall/gate/SJ from 4 runes in a book over and over again.  There are instances when I do an event macro 17 to open the runebook, and it just won't open.  To test this, I wrote a container open sub that will retry opening the runebook and count failures.  And behold, the counter does increase every once in a while showing the book just won't open sometimes.  So if the book doesn't open, you don't change the index you're gonna goto, so you recall/gate/SJ to the same spot.

I'll do some more testing.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: _C2_ on November 12, 2008, 09:44:09 AM
Well I am farming- so i do get interrupted with an occasional spell of hit that throws the sub into fits of retrys.   Protection allows that quick fix.  But that doesn't help recalling into an area of monsters and not recognizing that it was successful.  By the time it retries a 2-3 times I could be dead.  Waiting longer to check the x,y coords in combination to the protection is the answer.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 12, 2008, 10:01:21 AM
I'm actually working on a new set of subs that will run as a "server" like the rail engine can.  So you can perform the transport request, but then have access to run defense-related stuff while you monitor a flag to determine if the transport was successful.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Endless Night on November 12, 2008, 12:56:05 PM
not only does event macro not always open teh book these days.. when you click to flip pages thats not always successful either (espeacilly if do it do fast after opening book).

ITs kinda anoying.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 12, 2008, 01:01:23 PM
not only does event macro not always open teh book these days.. when you click to flip pages thats not always successful either (espeacilly if do it do fast after opening book).

ITs kinda anoying.


Indeed!  I remember when my test routines would run from point to point 100s of times until I'd get bored and switch it off.  It's not the case anymore.  Bummer.  But yes, I think something has definitely changed in the past few months.  I'm not sure if it's attributed to EasyUO or UO client issues.  Who knows?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on January 01, 2009, 05:23:10 AM
Good morning and Happy New Year!

Quick request  :-\

When you put out your next version of these subs could you add "encumbered_to_move" to the journal scan loops when testing for failure? Just figured I'd throw 'er out there in case you were contemplating an update at some point so that way I don't have to remember to add it hehe.

As you suggested I'm working out my own error handling routines based on your return of #TRUE on failure. This includes a rescan of the journal, etc but seems to be working just fine so far. I imagine it will be ok as long as there isn't someone spamming a bunch of garbage while I'm performing the error checking routine after failure.

XII
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on January 01, 2009, 05:23:26 PM
I already added that one to my internal version, but haven't posted it yet because of the gump strangeness that was occurring.  I need to get around to posting it....  It's seems for now you've got it covered.... ;)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: OMGBurgers on January 13, 2009, 04:13:36 PM
What happens if you tell the script to recall off a location in the runebook that is empty?  Will it return some type of error?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Khameleon on January 13, 2009, 04:42:03 PM
I asume it would return false since you will be in the same location. like if you failed or if somthing blocks you.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on January 13, 2009, 04:57:42 PM
ya, you should get an error and you can redo the action.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Khameleon on January 13, 2009, 05:47:18 PM
actually. since there is no rune in that location, you won't be able to set a default location, and will you try to recall to the last Defaulted Rune.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on January 14, 2009, 04:59:36 AM
Is there a message that displays specific to when you try to select a location in a runebook that doesn't have a rune? I'm at work right now so I can't check.

Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Khameleon on January 14, 2009, 10:30:44 AM
shouldn't the gem isn't available on the gump, the location is blank. so it would be like clicking nothing on the screen.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on January 14, 2009, 11:28:06 AM
Is there a message that displays specific to when you try to select a location in a runebook that doesn't have a rune? I'm at work right now so I can't check.

Actually you do need to know where the runes are at before time.  These subs DO NOT use OCR, which is the only way you'd be able to sense if there's a rune in the page slot or not.  I wanted to make these subs capable of running while minimized.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on January 14, 2009, 12:47:31 PM
Sure! I meant a System generated message that one could scan for if the sub was told to use a rune position that wasn't populated. So if I have 5 runes in the book and I say "gosub TM_TravelFromRuneBook %Method 6 6 %Runebook" would there be a System message that could be scanned for when the sub returned #TRUE. Sounds like there wouldn't be.

This is how I've been addressing the follow-up error checking when the sub returns #TRUE, scanning the journal to figure out why it's #TRUE and coding appropriate responses.

XII
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: OMGBurgers on January 14, 2009, 06:20:38 PM
Well it gives the message when a new default location is set.  If that message isn't able to be found you know that there was either an error, or the location is empty.  I'm going to be using these subs for the script I'm writing that goes around shopping, but didn't want to have to specify how many runes are in each book.  I may just give it a minor tweak though and scan for that message that the new default location was checked.  If it wasen't found I'll just consider the current book empty and move onto the next.

Been so busy lately I'm so confused on my script projects lol!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Cerveza on January 17, 2009, 08:33:21 PM
Quote
If a location is blocked the next location will be tried until success.

Same for RandomRundbookTravel? Is random only book ID or can you use the book name?

Code: [Select]
gosub TM_RandomRunebookTravel RE 1 16 BANKS ; or has to be XXXXXX
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Cerveza on January 18, 2009, 06:53:33 AM
Check, one, two, three.... aaaaaassssshhhhh, aaaaaassssshhhhh

Is this thing on?

Does random travel keep randomizing if the first location is blocked? And, do you have to use the runebooks ID with random travel or can you use a runebook name?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on January 18, 2009, 11:05:09 AM
yup, no smarts to it.  since location can become unblocked, then you probably don't want to seal it out.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Superslayer on May 03, 2009, 06:16:18 PM
Hiya TM, thanks for this great Script, it's definitely helped in completing my World Traveler script.  Are there any plans to include traveling from runebook charges?  My WT script has checks for if runebook charge usage is selected, and scroll charging and scroll restocking.  If there are a few simple additions that I could add, I'd appreciate a little push in the right direction there.

One other thing, I noticed a small mistake in the TM_TravelFromRunebook sub. The line directly under "WaitforTravel_loop1:" is:

"gosub TM_AdvJournalScan SPELLCAST VALID location_is_blocked something_is_blocking you_spirit_lacks"

The bold red should probably be 'your'.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on May 03, 2009, 06:34:31 PM
Hiya TM, thanks for this great Script, it's definitely helped in completing my World Traveler script.  Are there any plans to include traveling from runebook charges?  My WT script has checks for if runebook charge usage is selected, and scroll charging and scroll restocking.  If there are a few simple additions that I could add, I'd appreciate a little push in the right direction there.

No plans at the moment.  That comes from my gameplay really.  I always kept a char with ample skill to perform travel with skill and I never used scrolls.

One other thing, I noticed a small mistake in the TM_TravelFromRunebook sub. The line directly under "WaitforTravel_loop1:" is:

"gosub TM_AdvJournalScan SPELLCAST VALID location_is_blocked something_is_blocking you_spirit_lacks"

The bold red should probably be 'your'.

Indeed, I've had that fixed forever in my internal version, but somehow I managed to never publish that particular "feature".  Thanks for reminding me!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on May 04, 2009, 04:49:32 AM
Good catch on that one SS. I never noticed it because I have never used the Gate functionality but I have had a person running my miner on Siege that has had some issues and I wonder if that's why (been too busy to look into it, I have brought shame unto the names of my fathers').

XII
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Coragin on May 28, 2009, 10:00:33 AM
I read the instructions, I didnt see anything on if this supports gate travel.  Does it?

If so, what is the syntax for it instead of recall?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on May 28, 2009, 10:03:00 AM
The argument "GA" will perform gate travel.  There is also "RE" and "SJ".  Sorry, no scrolls.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Coragin on May 28, 2009, 10:08:40 AM
Code: [Select]
;     gosub TM_TravelFromNamedRunebook GA 1 2 LUMBERJACKING1 ; gate using LUMBERJACKING1 runebook starting at rune 1
Reading FTW!!!  I dont know how I missed that.  Sorry.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Cerveza on May 28, 2009, 10:15:02 AM
Scroll use would be cool to have with this, then it would truly be the complete travel script.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on May 28, 2009, 10:24:30 AM
Superslayer has already modified his copy to use them.  I've had enough requests that I'm thinking about adding them officially.  It's on the task list.  ;)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Superslayer on May 28, 2009, 03:28:09 PM
Superslayer has already modified his copy to use them.  I've had enough requests that I'm thinking about adding them officially.  It's on the task list.  ;)

Did I ever send you my mod on that?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on May 28, 2009, 04:10:37 PM

Did I ever send you my mod on that?

Yes you did.  Thanks for that!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Superslayer on May 28, 2009, 04:19:19 PM
Thought so, but wasn't positive.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: YaLooo on July 03, 2009, 07:52:43 AM
hi all
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Toptwo on July 03, 2009, 07:55:59 AM
Hello Yaloo,

  You might want to consider going to this board and posting a intro, will help you get off of restricted status.

http://www.scriptuo.com/index.php?board=20.0
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Scrripty on July 21, 2009, 03:58:31 AM
Code: [Select]
;   gosub TM_AddUnderscore #CHARNAME
;   set %charname #RESULT
;=================================================================

Where's the AddUnderscore sub? :)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on July 21, 2009, 04:21:59 AM
I have to remember to add that back into the subs.  But someone else pointed this out and doing a quick search from the main page revealed this:

http://www.scriptuo.com/index.php?topic=235.0;highlight=addunderscore

SMF search function is VERY good, BTW.  It's based on where you are in the board, so if you want to search the entire board, make sure you start the search from the main page.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Paulonius on March 01, 2010, 09:41:07 AM
TM,

I am working on using the travel subs in a bod fetching script.  It logs onto multiple accounts/characters and runs to get bods with them.  

I have it resetting the underscore sub with each toon, have all of the journal subs in and unless I get a fizzle, it runs fine.  If it fizzles on a recall the script doesn't pick it up and it hangs.  It does recognize a blocked location and will select the alternate rune. I think I have isolated the issue at the journal scan after the target in the spellcast sub by putting in a couple of event msg notes as follows.

Code: [Select]
 NewCastSpell_skip2:
      if !whichspell >= 0 && !whichspell <= 63 ; Magery
      {
        gosub TM_AdvJournalScan SPELLCAST VALID spell_fizzles there_is_already mana your_spirit more_reagents
      }
      else
      {
        set !cont #FALSE  ; Chivalry, Necromancy, etc
        finditem !whichtarget *
        if !whichtarget in SELF_NONE || #FINDKIND <> -1
          set !cont #TRUE

        if #MANA >= !tempmana && !cont = #TRUE ; check if target is still there
          set #RESULT #TRUE
        else
          set #RESULT #FALSE
      }
      repeat
      until #SCNT2 > !casttimeout     ; finish up cast delay
      if #RESULT = #TRUE
      {
      event exmsg #charid 3 4 Journal scan picked up a fizzle and should head to recast
        if !castretrymax > -1
        {
          set !castretry !castretry + 1 ; %castretrymax of -1 will cast until successful
          if !castretry > !castretrymax
            goto NewCastSpell_end1
        }
        goto NewCastSpell_loop1
      }
      event exmsg #charid 3 4 Journal scan was negative for fizzle, script will continue
      if #SCNT2 <= !casttimeout     ; finish up cast delay
        goto NewCastSpell_skip2

I am thinking that my data feed to the travel subs must be good as its picking up the blocked location, but if that is the case, then I am not sure why it isn't catching the fizzle unless it is just going too fast. I am going to add a wait 5 in front of the journal check and see if that makes a difference. I suspect I am missing something though...  

A wait didn't make a difference, so I am pretty sure I have something wrong with the journal scanner setup.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Paulonius on March 09, 2010, 08:31:39 AM
I did some more playing with this and I think I have confirmed that the rune-book subs are inconsistent when you fizzle on a recall.  SJ works fine because of the position check.  I noticed the problem consistenly with my BOD script and on occassion with the SUO Crafter.  

When using well developed toons this is unlikely to be in evidence because you will generally have enough magery to recall consistently.  However, because I used the sub in a script that recalls repeatedly with less developed toons I was able to observe the issue pretty extensively.  (Yes, I like to watch scripts run...)

I was runnning the script on home shard on which I ping in the 70s -- not noticeably laggy when you are running around and I don't see noticeable lag running scripts.  I played with the wait immediately prior to the journal check and it didn't seem to fix the problem, so I am not 100% sure where the issue lies.  I simply "fixed the glitch" in my BOD script by adding the SJ position check to the recall sub.  Another work around is to put enough jewelry on an under developed toon to reliably recall -- around 65 magery.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: rana70 on March 26, 2010, 12:34:49 PM
I have to remember to add that back into the subs.  But someone else pointed this out and doing a quick search from the main page revealed this:

http://www.scriptuo.com/index.php?topic=235.0;highlight=addunderscore

SMF search function is VERY good, BTW.  It's based on where you are in the board, so if you want to search the entire board, make sure you start the search from the main page.

Hi TM,

I know this post is an older one ... but you are confusing me a little.
I asked you a few moons ago the same question about the non existng underscore SUB
and you told me that in was outdated ... and not used anymore by the Travel SUB.

If I remember correct I figured out this must be the truth because of the fact that you
even never use the %charname var within the whole travel SUB.

btw thank you for this great travel SUB :-)

@Paulonius
I use TM's Travel SUB mostly with Recall and I havn't had issues so far even my ping is about 120
I havn't read your script but do you check the #RESULT after using the SUB correctly to make sure
the requested recall worked ?

cu
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on March 26, 2010, 12:40:34 PM
Ah yes.  That was back before the advanced journal handler automatically modified your character name to remove spaces.  It's got it built-in now because people weren't copying all the required subs and EUO doesn't error out when a sub isn't found.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: luv2luvlong on March 29, 2010, 06:30:28 PM
Been playing with ths for a while now and kept having probs with it not waiting long enough on the SJ part. Mostly when traveling to different servers. You might want to consider raising it to 30 80 or , which seems to work much better. Just my 2 cents.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: NObama on November 21, 2010, 08:27:32 AM
It appears that, with a new patch, something changed in the way error messages are reported.  This results in a blocked location also reporting a fizzle, and 'fizzle' being the most recent event in the journal.  Therefore, the runebook travel sub was getting stuck in TM_NewCastSpell loop1 and/or skip2.  I commented out the 'spell_fizzles' portion of the advJournalScan syntax and it *appears* to be working now.

This is for XII's miner, btw.

More reporting as events warrant.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 21, 2010, 09:40:38 AM
why on earth would they make that change?  lol
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: seeriusly on November 21, 2010, 09:47:15 AM
It appears that, with a new patch, something changed in the way error messages are reported.  This results in a blocked location also reporting a fizzle, and 'fizzle' being the most recent event in the journal.  Therefore, the runebook travel sub was getting stuck in TM_NewCastSpell loop1 and/or skip2.  I commented out the 'spell_fizzles' portion of the advJournalScan syntax and it *appears* to be working now.

This is for XII's miner, btw.

More reporting as events warrant.

ahh man... what a great catch.  I've been racking my brain this morning with that.  Thankyou!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: NObama on November 21, 2010, 12:17:12 PM
Just to be clear:  I don't recommend changing TM's work wholesale.  This was just the tweak I needed to run my particular cheaty script.

If you really fizzle a spell, my changes will dork with TM's error check routines.  This is just a spit-and-baling-wire approach to one specific problem.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 21, 2010, 12:41:40 PM
Probably should do something about it anyhow.  Since this is actually getting stuck in the casting routine and that retries until success, it can get into a loop that won't return failure like you'd expect.  You can just change the casting, to retry 2-3 times instead of -1.  I.e.:

Code: [Select]
gosub TM_NewCastSpell 31 !rbook -1 10 10 ; recall until successful

changes to

Code: [Select]
gosub TM_NewCastSpell 31 !rbook 2 10 10 ; retry 2 times

This way, the subs will return failure.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: NObama on November 21, 2010, 01:56:26 PM
So, if my line currently reads like this:

Code: [Select]
   gosub TM_TravelFromRuneBook %XIIxMiningMethod %currentposition %currentposition %XIIxMiningRunebook
[code]

Where do i stick the '2'?  Before the first %currentposition?

[/code]
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on November 21, 2010, 02:19:54 PM
You have to go down into the TM_TravelFromRuneBook sub and locate the TM_NewCastSpell routine that matches with your travel method.  Totally untested....  I haven't touched EUO in months now.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: gimlet on May 29, 2011, 08:43:00 PM
So I dusted off an old script that has version 2.6 of the subs and it does not increment and move to the next rune position. Did something change? I notice by reading this whole thread that others encountered the same thing but did not really post any solutions.

Any ideas?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on May 29, 2011, 08:47:32 PM
You'll probably need to dive into the step-by-step of the subs.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: gimlet on May 30, 2011, 04:42:54 AM
Found the problem - it was not your subs!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on May 30, 2011, 07:35:21 AM
Found the problem - it was not your subs!

Doh!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on July 29, 2011, 11:09:35 AM
I was just disecting these subs today for grins and giggles (I want to take a stab at my own versions) and I just wanted to throw kudos out for this little gem:

Code: [Select]
set !runeclickx ( #CONTPOSX + !runeclickx + ( 35 * ( ( !locindex - 1 ) / 2 ) ) )
Is this your algorithm or is it borrowed? I suck at stuff like this, I'd really like to get better. I was thinking of something similar for my standard crafter sub but wasn't quite sure how to execute it.

X
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on July 29, 2011, 11:33:57 AM
Oh yeh, that's totally mine.  I remember writing those functions and computing those things.  Anyhow, thanks for the kudos.  I love coming up with sexy equations.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on August 01, 2011, 08:41:44 AM
Oh yeh, that's totally mine.  I remember writing those functions and computing those things.  Anyhow, thanks for the kudos.  I love coming up with sexy equations.
You also finally got me to finally understand the MOD operator. Now that I "get it" that seem's like the only way to efficiently decide what page my location is on (odd or even).

It's doubtful that I'll come up with anything original to call my own; I've decided that I can't use your algorithm unless I can come up with it on my own without influence from your code but your code is all I can think about now lol.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on August 01, 2011, 09:07:49 AM
Since EUO is an integer-based language, the MOD operator is essential.  Anyhow, you are welcome to use whatever snippets of my code that you want.  I'm not all that anal about it.  I certainly didn't patent that method, and probably unintentionally came up with the same idea as 20 other scripters.  *shrugs*
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on August 04, 2011, 10:22:32 AM
Since EUO is an integer-based language, the MOD operator is essential.  Anyhow, you are welcome to use whatever snippets of my code that you want.  I'm not all that anal about it.  I certainly didn't patent that method, and probably unintentionally came up with the same idea as 20 other scripters.  *shrugs*
I don't want to totally OT this thread but I wanted to check in to say "Success!", I managed to come up with something and really expand my inderstanding of what you mean by MOD being essential, etc. I have been super-inspired and am pretty excited with my equation.

One of the reasons I keep coming back here is because I'm constantly challenged. For years now I haven't even attempted going after something like a standardized Travel sub out of sheer intimidation. I don't know if my yet unfinished sub/s will work as well but it's been a great learning experience already and I am finding that I can certainly figure it out after all.

Thanks, real good stuff man!

X
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on August 04, 2011, 11:37:22 AM
Hey cool, 12x.  Really that's why I keep running this place is for people to come and learn and possibly be inspired at some level or another.

It's fun when you get to start using your core routines to stitch together some pretty amazing scripts.  Hope your inspiration continues and I look forward to more and more complex scripts!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Neo on August 16, 2011, 03:54:55 PM
Thank you for this... Helped me out a lot in some recall subs...

Cheers
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on October 24, 2011, 09:15:21 AM
I suddenly realized today why this wasn't incrementing on failures in my Miner and, incidentally, why you have a !locindex AND a !locindexend LOL. Sometimes it's the simplest things that elude me. This newfound knowledge addresses a long-term issue I've had with the Miner, just about in time for me to give my own Travel sub a whirl anyhow *sigh* although I'm not QUITE there with that yet so...

One question, I notice that you only include KEF_OTF_JEF in your Gate types list - have you found this to be a complete list on OSI? I only ask as there are dozens if you look up "Moongate" on the Easyuo.com Itemlist DB but we all know how accurate this can be sometimes. Has anyone using Gate with this sub ever run into issues?

Anyhow, thanks as always.

X
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: gimlet on October 24, 2011, 11:34:27 AM
Set %GateType OTF_JEF_KEF  ; Regular Gates _ SP Gates

gosub TM_TravelFromRuneBook %TravelMethod 1 1 %RunebookID
       if %TravelMethod = GA
       GoSUB GetRidOfMyGate







SUB GetRidOfMyGate
    if %TravelMethod = GA
   {
          IgnoreItem reset
          Set #TARGCURS 0
     FindItem %GateType
     Repeat
      {
       if #FindCnt > 0
        {
         For !tmp 1 #FindCnt
          {
           Set #FindIndex !tmp
            if #FindDist > 10
             {
              IgnoreItem #FindID
             }
             ELSE
             {
              ;Wait for Mana to Cast Lvl 5 Spell
              While #Mana < 14
               {
               }
              While %NEXTDispelTime > #SCNT
               {
               }
               ;Cast Dispel Field
               Set %NEXTDispelTime #SCNT + 4
               Event Macro 15 33 ; Dispel Field
               Wait %DelayEvent
               Target
               Set #lTargetID #FindID
               Event Macro 22 0
               Wait 2s
             }
          }
         }
      ;Check for other Gates around
       FindItem %GateType
      }
     Until #FindCnt = 0
   }
RETURN
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on October 24, 2011, 11:44:24 AM
Set %GateType OTF_JEF_KEF  ; Regular Gates _ SP Gates
?

Are you saying that yes, these are definitely the only Itemtype values for Gate's? Here is the output from the EasyUO database:

Quote
KEF red moongate
JEF red moongate
EEF red moongate
DEF red moongate
GEF red moongate
OTF blue moongate
NTF blue moongate
QTF blue moongate
PTF blue moongate
AUF blue moongate
LCK summon moongate
OCK summon moongate
NCK summon moongate
YCK summon moongate
XCK summon moongate
ADK summon moongate
ZCK summon moongate
UCK summon moongate
TCK summon moongate
HDK summon moongate
CDK summon moongate
BDK summon moongate
EDK summon moongate
DDK summon moongate
ODK summon moongate
NDK summon moongate
QDK summon moongate
PDK summon moongate
ZYL summon moongate
UYL summon moongate
TYL summon moongate
WYL summon moongate
VYL summon moongate
GZL summon moongate
FZL summon moongate
IZL summon moongate
HZL summon moongate
CZL moongate
BZL moongate
EZL moongate
DZL moongate
OZL moongate
MZL summon moongate
LZL summon moongate
WZL summon moongate
VZL summon moongate
YZL summon moongate
XZL summon moongate
SZL summon moongate
RZL summon moongate
UZL summon moongate
TZL summon moongate
EAM summon moongate
DAM summon moongate
GAM summon moongate
FAM summon moongate
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: gimlet on October 24, 2011, 11:47:19 AM
Siege remember, but this is all i use and I have never missed one.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Hrafn on January 13, 2013, 11:26:37 AM
For  starters: Thank you for releasing this script. Even a non-programmer like myself manage to use this :)

So i have been tinkering with a script where i basically need to recall from a named runebook (TEST1) starting at rune 1 and working my way down to rune 16. The way i got it to work was like this:
gosub TM_TravelFromNamedRunebook RE 1 1 TEST1
gosub TM_TravelFromNamedRunebook RE 2 2 TEST1
gosub TM_TravelFromNamedRunebook RE 3 3 TEST1
gosub TM_TravelFromNamedRunebook RE 4 4 TEST1
gosub TM_TravelFromNamedRunebook RE 5 5 TEST1
and so on..
and its working :)

But i got a sneaking feeling that there might be a more efficient way of doing this? I have been looking into various recall miners and lumberjacks to see how they do it, but it quickly gets to complex for my limited noob understanding. Any helpful pointers would be greatly appreciated  :o
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Endless Night on January 13, 2013, 01:23:04 PM
But i got a sneaking feeling that there might be a more efficient way of doing this? I have been looking into various recall miners and lumberjacks to see how they do it, but it quickly gets to complex for my limited noob understanding. Any helpful pointers would be greatly appreciated  :o


And you were right... algerbra baby.. x =1 to 16.... on first pass x=1 on second pass x=2 etc until x=16

Code: [Select]
for %x 1 16
   {
  gosub TM_TravelFromNamedRunebook RE %x %x TEST1
   }
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Hrafn on January 13, 2013, 03:26:10 PM
WOW!

I would never have figured that out by myself. Works flawless! Thank you for the help!!

Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: The Ghost on September 08, 2013, 05:33:23 PM
So reading below, is there a way to do this a simple way.

I'm trying to recall to a location perform a task, recall to a new location and redo the same task.
Quote
repeat
 gosub TM_TravelFromNamedRunebook RE 1 1 AXE
 gosub TestLoop
 gosub TM_TravelFromNamedRunebook RE 2 2 AXE
 gosub TestLoop
 gosub TM_TravelFromNamedRunebook RE 3 3 AXE
 gosub TestLoop
until #CHARGHOST = yes



Is there a way to do something like this , but that increase rune by 1 each time.
Quote
repeat
for %x 1 16
   {
  gosub TM_TravelFromNamedRunebook RE %x %x AXE
  gosub TestLoop
   }
until #CHARGHOST = yes
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on September 08, 2013, 06:02:32 PM
Exactly, you got it! 
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: The Ghost on October 05, 2013, 09:28:17 AM
TM 
what does this do  and what happen if we don't insert it.   thx 

 Requirements:
;
;    This script requires that you have your character name
;    setup in a variable called %charname.  Place this bit of code
;    in your script initialization somewhere:
;
;   gosub TM_AddUnderscore #CHARNAME
;   set %charname #RESULT
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Grandewd on December 25, 2013, 06:16:50 PM
Hey TM.... I use your TM_TravelFromRunebook in so many of my scripts, but since this last patch it's really flakey... Can you test it?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on December 25, 2013, 08:39:50 PM
I'd just wait for Cheffe to look at EasyUO.  There's something wrong with the container stuff.  

Also, please explain flakey....
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: NObama on December 25, 2013, 08:45:34 PM
I'd just wait for Cheffe to look at EasyUO.  There's something wrong with the container stuff.  

Also, please explain flakey....

I've experienced the same, and it's not just this last patch:

Occasionally, my character will keep trying to SJ even after he successfully made it.  After three or four tries (usually) the script continues.  I don't think it is lag related, and it's really wigging me out.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on December 25, 2013, 09:36:40 PM
Sacred Journey is a hard one because if you have very high mana regeneration, then you might beat the mana check the script makes.  There is no journal spam for chivalry stuff, so the only way to know if you have done a successful SJ is to check a mana drop.  You can try and minimized the delays in the TM_NewCastSpell gosub.

You should be using recall for bullet-proof spell casting (because you can use journal scanning then)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on December 26, 2013, 04:33:19 AM
You can bust out of TM's sub with a location checking sub. Grab X/Y before the cast then after the cast. Not too troublesome.

Either way, nothing to do until the #CONT stuff is fixed. So glad I don't patch until I have to! :)

X
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: NObama on December 26, 2013, 07:25:07 AM
You can bust out of TM's sub with a location checking sub. Grab X/Y before the cast then after the cast. Not too troublesome.

Either way, nothing to do until the #CONT stuff is fixed. So glad I don't patch until I have to! :)

X

There's a patch?  =P
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on December 26, 2013, 07:36:40 AM
Nice :)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on December 26, 2013, 10:42:25 AM
heh.

The runebook sub already has a location check and works well for normal spam.  The problem comes with the spell cast sub.  For magery, if you fail to cast you get the "fizzled" message and you can easily recast using that check.  For chivalry and necromancy, there is no journal spam so the only way you can know that you've successfully cast sacred journey is to watch for your mana drop.  So it's really more than just casting SJ, but it's more about casting anything with chivalry.

There are things you can so so it won't get stuck in the spell casting loop:

1) Change the delay in the follow up cast delay:
In "TM_TM_TravelFromRunebook"

Code: [Select]
    if !method = SJ
      gosub TM_NewCastSpell 210 !rbook -1 10 0 ; sacred journey until successful ( 0 used to be 30)
    wait 30

If that doesn't work, you can just remove the mana check from the TM_NewCastSpell:

Code: [Select]
;        if #MANA >= !tempmana && !cont = #TRUE ; check if target is still there
;          set #RESULT #TRUE
;        else
          set #RESULT #FALSE
(this is around line 123)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on December 26, 2013, 10:43:49 AM
I should have known ;)

Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on December 26, 2013, 10:47:09 AM
I should have known ;)

Lol, well you're still right though.  I just don't check for x,y translocation in the spellcast sub.  It already has so many corner cases; that's the problem with trying to have one casting sub that tries to handle all possibilities.  It also has lots of vulnerabilities.

That's why all my people use magery for butt-translocation.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on December 26, 2013, 10:59:24 AM
Heh yeah I started putting together my own travel subs and got caught up in the never-ending potential for error-checking and response then said "forget it" and continued to use yours.

Too bad I never finished it too, I came up with a very sexy routine/equation for the rune selection portion! I was patting myself on the back for days - probably the real reason I never finished it now that I think about it ;)
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on December 26, 2013, 11:14:19 AM
you gotta be careful with that self-patting.  You'll go blind!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on December 26, 2013, 11:18:29 AM
you gotta be careful with that self-patting.  You'll go blind!
Hairy palms...
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on December 26, 2013, 11:39:55 AM
That's the name of one of my UO characters.  lol
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: 12TimesOver on December 26, 2013, 11:50:39 AM
That's the name of one of my UO characters.  lol
ROFL!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Grandewd on December 27, 2013, 09:31:03 AM
I'd just wait for Cheffe to look at EasyUO.  There's something wrong with the container stuff.  

Also, please explain flakey....

Flakey, in that they tried to work and once even successfully - but forget all that, I posted before we know Cheffe had to fix containers in his update....
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: declo on May 31, 2014, 12:28:01 PM
I am using EUO 263 on Atlantic.  Very little lag.  Trying to use

gosub TM_TravelFromRunebook RE 1 3 %runebookid ;

The script opens the book and selects rune #1. But then attempts to recall but never targets the book.  The target icon shows, but then it tries to recall again without ever targeting the book.

Is there something silly that I am missing?

I tried adjusting the lag time from 10 to 60 to see if that would allow the script to target the runebook but it never does even at 60.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on June 01, 2014, 11:06:38 AM
Are you sure you have the correct runebook ID for your runebook?  I just tested this sample code on Lexia without issue (change XXYYZZ1 to your value):
(Unsure what version those travel subs are, they're from an old test file.)

Code: [Select]
set %travel_method RE
set %rune1 1
set %rune2 1
set %runebook XXYYZZ1
gosub TM_TravelFromRunebook %travel_method %rune1 %rune2 %runebook
stop

;-------------------------------------------------------------------------------
;    Runebook subs -------------------------------------------------------------
;-------------------------------------------------------------------------------
; %1 = spell number
; %2 = #TARGETID or SELF or NONE
; %3 = retry count (-1 = cast until successful)
; %4 = cast delay
; %5 = recovery delay
sub TM_NewCastSpell
  namespace push
  namespace local NCS
  set !lpc #LPC
  set #LPC 100
  set !whichspell %1
  set !whichtarget %2
  set !castretrymax %3
  set !waitdelay %4
  set !recovery_delay %5
  set !castretry 0
  set !temp_ltargetid #LTARGETID
  set !temp_ltargetkind #LTARGETKIND

  repeat
  until #LLIFTEDKIND = 0 && #TARGCURS = 0 && A notin #CHARSTATUS

NewCastSpell_loop1:
  if !castretrymax < 0
    goto NewCastSpell_cont1
  if !castretry > !castretrymax
    goto NewCastSpell_end1
NewCastSpell_cont1:
  gosub TM_AdvJournalSync SPELLCAST
  set #LTARGETKIND 1
  set #LTARGETID !whichtarget
  set !tempmana #MANA
  event macro 15 !whichspell ; cast the spell
  wait !waitdelay
  repeat
  until A notin #CHARSTATUS
  set !targettimeout #SCNT + 7
NewCastSpell_wait1:
  gosub TM_AdvJournalScan SPELLCAST VALID spell_fizzles you_have_not_yet mana your_spirit
  if #RESULT = #TRUE || #SCNT > !targettimeout
  {
    set !casttimeout #SCNT2 + !recovery_delay
    repeat
    until #SCNT2 > !casttimeout     ; finish up cast delay
    set !castretry !castretry + 1
    goto NewCastSpell_loop1
  }
  gosub TM_AdvJournalScan SPELLCAST VALID more_reagents
  if #RESULT = #TRUE
    goto NewCastSpell_end1 ; fail

  if !whichtarget = NONE
    goto NewCastSpell_skip1
  if #TARGCURS = 1
    goto NewCastSpell_targ1
  goto NewCastSpell_wait1 ; wait for target cursor

NewCastSpell_targ1:
  if !whichtarget = SELF
    event macro 23
  else
    event macro 22

NewCastSpell_skip1:
  wait 5
  set !casttimeout #SCNT2 + !recovery_delay
NewCastSpell_skip2:
  if !whichspell >= 0 && !whichspell <= 63 ; Magery
  {
    gosub TM_AdvJournalScan SPELLCAST VALID spell_fizzles there_is_already mana your_spirit more_reagents
  }
  else
  {
    set !cont #FALSE  ; Chivalry, Necromancy, etc
    finditem !whichtarget *
    if !whichtarget in SELF_NONE || #FINDKIND <> -1
      set !cont #TRUE

    if #MANA >= !tempmana && !cont = #TRUE ; check if target is still there
      set #RESULT #TRUE
    else
      set #RESULT #FALSE
  }
  repeat
  until #SCNT2 > !casttimeout     ; finish up cast delay
  if #RESULT = #TRUE
  {
    if !castretrymax > -1
    {
      set !castretry !castretry + 1 ; %castretrymax of -1 will cast until successful
      if !castretry > !castretrymax
        goto NewCastSpell_end1
    }
    goto NewCastSpell_loop1
  }
  if #SCNT2 <= !casttimeout     ; finish up cast delay
    goto NewCastSpell_skip2
NewCastSpell_end1:
  set #LTARGETID !temp_ltargetid
  set #LTARGETKIND !temp_ltargetkind
  set #LPC !lpc
  namespace pop
return
;-------------------------------------------------------------------------------
; %1 = Method (RE, GA, SJ)
; %2 = index location within runebook (1-16)
; %3 = index location within runebook (1-16), try up to this point
; %4 = runebook item id
; returns #TRUE if error, #FALSE for no error
sub TM_TravelFromRunebook
  namespace push
  namespace local RFR
  set #LTARGETKIND 1
  set !method %1
  set !locindex %2
  set !locindexend %3
  set !rbook %4

  finditem !rbook C_ , #BACKPACKID
  if !method notin RE_GA_SJ || #FINDKIND = -1
  {
    namespace pop
    return #TRUE
  }
  if !locindex notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
  {
    namespace pop
    return #TRUE
  }
  if !locindexend notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
  {
    namespace pop
    return #TRUE
  }

TravelFromRunebook_loop1:
  set #LOBJECTID !rbook
  set #LTARGETKIND 1
  event macro 17 0
  gosub GumpWait generic_gump generic_gump
  set !tempcontx #CONTPOSX
  set !tempconty #CONTPOSY

  set !runeclickx 140 ; page 1, rune 1
  set !runeclickx ( #CONTPOSX + !runeclickx + ( 35 * ( ( !locindex - 1 ) / 2 ) ) )
  if !locindex > 8
  {
    set !runeclickx 310 ; page 2, rune 1
    set !runeclickx ( #CONTPOSX + !runeclickx + ( 35 * ( ( !locindex - 9 ) / 2 ) ) )
  }
  set !runeclicky #CONTPOSY + 196
  click !runeclickx !runeclicky
  wait 5

  set !runeclicky #CONTPOSY + 24
  set !runeclickx #CONTPOSX + 164 ; page 1 set to default
  if !locindex % 2 = 0
  {
    set !runeclickx #CONTPOSX + 305 ; page 2 set to default
  }
  click !runeclickx !runeclicky
  wait 5
  set !oldx #CHARPOSX
  set !oldy #CHARPOSY
  if !method = RE
    gosub TM_NewCastSpell 31 !rbook -1 10 10 ; recall until successful
  if !method = GA
  {
    gosub TM_NewCastSpell 51 !rbook -1 10 20 ; gate until successful
    set !temp_cnt #SCNT + 10
    repeat
      finditem KEF_OTF_JEF G_0
    until #FINDKIND <> -1 || #SCNT > !temp_cnt
    if #FINDKIND <> -1
    {
      set #LOBJECTID #FINDID
      wait 10
      event macro 17 0
      wait 20
      if #CONTNAME = generic_gump && #CONTSIZE = 420_280
      {
        gosub TM_AdvJournalSync SPELLCAST
        set !clickx #CONTPOSX + 26
        set !clicky #CONTPOSY + 261
        click !clickx !clicky ; click ok
      }
    }
  }

  if !method = SJ
    gosub TM_NewCastSpell 210 !rbook -1 10 30 ; sacred journey until successful
  wait 30

  set !tempscnt #SCNT + 10
WaitforTravel_loop1:
  gosub TM_AdvJournalScan SPELLCAST VALID location_is_blocked something_is_blocking you_spirit_lacks
  if #RESULT = #TRUE
  {
    gosub TM_AdvJournalSync SPELLCAST
    set !locindex !locindex + 1
    if !locindex > !locindexend
    {
      namespace pop
      return #TRUE
    }
    goto TravelFromRunebook_loop1
  }
  if ( ( #CHARPOSX = !oldx && #CHARPOSY = !oldy ) && #SCNT < !tempscnt )
    goto WaitforTravel_loop1

;  if #CONTNAME = generic_gump && #CONTSIZE = 452_236 ; RunUO close runebook
;  {
;    set !clickx #CONTPOSX + 120
;    set !clicky #CONTPOSY + 60
;    click !clickx !clicky mc r
;    wait 5
;  }
  namespace pop
return #FALSE
;-------------------------------------------------------------------------------
; %1 = Gumpname 1
; %2 = Gumpname 2
; #TRUE gump occured before timeout
sub GumpWait
  namespace push
  namespace local GW
  wait 10
  set !timedelay #SCNT
  while #SCNT <= !timedelay + 7
  {
    if #CONTNAME = %1 || #CONTNAME = %2
    {
      namespace pop
      return #TRUE
    }
  }
  namespace pop
return #FALSE
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - #LPC setting (optional)
; Brings !_jindex up to the most recent #journal entry
sub TM_AdvJournalSync
  namespace push
  namespace local TM_AdvJS_ , %1
  set !_jindex #jindex + 1
  if %0 > 1
    set !lpc_set %2
  namespace pop
  set !TM_FunctionCalled #TRUE
return
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - NONE, ADVANCE , ( _VALID ) - advances jindex pointer, anything else
; %3, %4, %5, 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
;  About %2 arguments:
;    NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
;    ADVANCE: no spam checking, advances #jindex copy
;    VALID: invokes SPAM filtering, no advance of #jindex copy
;    VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - NONE, ADVANCE , ( _VALID ) - advances jindex pointer, anything else
; %3, %4, %5, 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
;  About %2 arguments:
;    NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
;    ADVANCE: no spam checking, advances #jindex copy
;    VALID: invokes SPAM filtering, no advance of #jindex copy
;    VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy
sub TM_AdvJournalScan
  namespace push
  namespace local TM_AdvJS_ , %1
  set !args %2
  set !temp_lpc #LPC
  if !lpc_set = N/A
    set #LPC 1000
  else
    set #LPC !lpc_set
  set !num_args %0
  set !first_arg 3
  set !sampled_jindex #JINDEX
  if !_jindex = N/A
    set !_jindex !sampled_jindex
  if !charname = N/A
  {
    set !charname #CHARNAME
    AdvJournalScan_loop1:
      str pos !charname #SPC
      if #STRRES <> 0
      {
        set !val #STRRES - 1
        str left !charname !val
        set !left #STRRES
        set !val !val + 1
        str del !charname 1 !val
        set !charname !left , _ , #STRRES
        goto AdvJournalScan_loop1
      }
  }
  set !index !first_arg
  repeat
    set !temp_jindex !_jindex
    set !text % . !index
    while !temp_jindex <= !sampled_jindex
    {
      scanjournal !temp_jindex
      str pos #JOURNAL !charname 1
      set !namepos #STRRES
      str count #JOURNAL !charname
      set !namecnt #STRRES
      str pos #JOURNAL :_ 1
      set !smcpos #STRRES
      str pos #JOURNAL !text 1
      set !textpos #STRRES
      if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
        set !pass #TRUE
      else
        set !pass #FALSE
      if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
      {
        set !temp_jindex !temp_jindex + 1
        if ADVANCE in !args
          set !_jindex !temp_jindex
        set #LPC !temp_lpc
        namespace pop
        set !TM_FunctionCalled #TRUE
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until !index - !first_arg > !num_args - !first_arg
  set %10 !sampled_jindex - !_jindex
  set %10 %1 , _ , %10 ; for debugging purposes
  set #LPC !temp_lpc
  namespace pop
  set !TM_FunctionCalled #TRUE
return #FALSE

Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: declo on June 01, 2014, 06:04:58 PM
ahh ty!! worked like a charm!!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Grandewd on August 17, 2014, 02:33:58 PM
TM:
Calling your subs with:

  
Code: [Select]
gosub TM_AdvJournalSync SPELLCAST
gosub TM_AddUnderscore #CHARNAME
set %charname #RESULT
gosub TM_TravelFromRunebook GA 9 8 RFXUMND

It works fine as long as I don't fizzle or the location is blocked.  At that point it doesn't retry at all.  It gets to:

Code: [Select]
   gosub TM_AdvJournalScan SPELLCAST VALID something_is_blocking you_spirit_lacks   <<<<<<<<<<<<<<  It gets here
    if #RESULT = #TRUE  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< see's #RESULT as #FALSE
    {
      gosub TM_AdvJournalSync SPELLCAST
      set !locindex !locindex + 1
      if !locindex > !locindexend
      {
        namespace pop
        return #TRUE
      }
      goto TravelFromRunebook_loop1
    }
    if ( ( #CHARPOSX = !oldx && #CHARPOSY = !oldy ) && #SCNT < !tempscnt )  <<<<<<<<<<<<<<<<<< jumps to here, and continues looping........

Both TM_AdvJournalSync and TM_AdvJournalSync are loaded in same script (nothing in them has been modified)...

I know I'm missing something simple.
 :-[
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on August 17, 2014, 06:27:01 PM
I think the 8 and 9 are reversed.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Grandewd on August 17, 2014, 06:58:55 PM
I think the 8 and 9 are reversed.

Swapped and no change....  :'(
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on August 17, 2014, 09:29:24 PM
Have you checked to see if the journal stuff is working in EUO? Perhaps a small bit of test code to verify.  You may jave to single step through the code to see what the variables are.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Crisis on March 09, 2015, 03:08:28 AM
I am just testing this out and I have a couple of questions. I really like it so far but for what I am doing, I do not necessarily want it to go to the next rune if one is blocked. I would like for it to wait for a minute and then try it again a couple of times, if that does not work, then I would like it to go to a specific rune. Is that something possible with this? I just put it in late last night and I am rushing to work so I am afraid I did not give the forum and script it's due diligence yet.  :'(
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on March 09, 2015, 09:18:34 AM
You'll have to handle the recasting yourself if you change this bit of code in the TM_TravelFromObject sub:

Code: [Select]
    if ( ( #CHARPOSX = !oldx && #CHARPOSY = !oldy ) && #SCNT < !tempscnt )
      goto WaitforTravel2_loop1
to this

Code: [Select]
    if ( ( ( #CHARPOSX = !oldx && #CHARPOSY = !oldy ) && ( #SCNT < !tempscnt ) ) || ( !locindex > !locindexend ) )
      goto WaitforTravel2_loop1

This should make TM_TravelFromObject return a #FALSE (no error) so it assumed the attempt was successful.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on March 09, 2015, 09:54:21 AM
I read your post a little more closely..  Probably need something different.  Which runebook sub are you calling?  TM_TravelFromRunebook?
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on March 09, 2015, 10:05:00 AM
Ok, so looking at your request more closely, you can pretty much do what you need to without having to modify the subs at all.  However, you'll need to manage the next rune yourself.  Here's an example (untested):

Code: [Select]
set %first 1
set %last 16
set %runebook XXYYZ1

set %index %first
set %fail #TRUE
set %give_up #FALSE
repeat
  gosub TM_TravelFromRunebook RE %index %index %runebook
  set %fail #RESULT
  if %fail = #TRUE
  {
    set %index %index + 1
    if %index > %last
      set %give_up #TRUE
    ; -- go do something else here in the mean time time, wait, whatever.
  }
until ! %fail || %give_up
;Either worked (%fail = #false) or gave up
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Crisis on March 09, 2015, 07:28:38 PM
Thank you, I will check that out tomorrow when I have some time!
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: ErwinEUO on August 24, 2016, 06:13:49 AM
Hi There,

I'm testing out some simple functionality on OSI shard, would appreciate some help.

Per the script comments, I'm expecting the script to recall to the 2nd rune if 1st rune is blocked.  Replication: simply run the script while standing on first rune location.

Code: [Select]
set %runebookid XXXXXXX
gosub TM_TravelFromRunebook RE 1 2 %runebookid
halt

Code keeps retrying on this loop in sub TM_TravelFromRunebook
Code: [Select]
TravelFromRunebook_loop1:
...(deleted)...
    if !method = RE
      gosub TM_NewCastSpell 31 !rbook -1 10 10 ; recall until successful


My limited skills unfortunately prevent me from debugging the journal scanner, so I'm asking for help.  Any ideas?

Really appreciate the time and effort put into these subs!!

Thanks

Erwin
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: TrailMyx on August 24, 2016, 09:13:35 AM
Hi There,

I'm testing out some simple functionality on OSI shard, would appreciate some help.

Per the script comments, I'm expecting the script to recall to the 2nd rune if 1st rune is blocked.  Replication: simply run the script while standing on first rune location.

Code: [Select]
set %runebookid XXXXXXX
gosub TM_TravelFromRunebook RE 1 2 %runebookid
halt

Code keeps retrying on this loop in sub TM_TravelFromRunebook
Code: [Select]
TravelFromRunebook_loop1:
...(deleted)...
    if !method = RE
      gosub TM_NewCastSpell 31 !rbook -1 10 10 ; recall until successful


My limited skills unfortunately prevent me from debugging the journal scanner, so I'm asking for help.  Any ideas?

Really appreciate the time and effort put into these subs!!

Thanks

Erwin

At this line:
Code: [Select]
      gosub TM_NewCastSpell 31 !rbook -1 10 10 ; recall until successful

if you change the -1 to some number greater that 0, it will retry that many times before it gets back to the location test.  So if you have good enough magery so that you don't fail and you aren't using reagents, then you should be successfully 100% and can at least get back to the location change code. 
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: ErwinEUO on August 24, 2016, 12:42:11 PM
Thanks a lot for the help, this is working beautifully now!

Erwin
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Gemviper on February 22, 2018, 02:17:17 AM
Old thread, I know, but anyone reading it now will ask this so...

- Is there a reliable travel sub like this one that works with a runic atlas?

Just asking before I go create yet another.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: The Ghost on February 22, 2018, 12:21:16 PM
I beleive EasyUO have one, Mr S made it.   Not sure how it work.
Title: Re: Trailmyx's Runebook/Spellcast Subs
Post by: Fabolous1 on January 18, 2020, 08:32:06 AM
Is there anyway to read the rune name of a specified rune in a runic atlas / rune book?

Or has anybody added Runic Atlas subs? Surely somebody has already :)

EDIT: Thanks to Gaderian, kalocr was updated with runic atlas subs today 1/18/2020 :) Check it out at http://www.easyuo.com/forum/viewtopic.php?f=3&t=53735&hilit=kalocr