Official ScriptUO EasyUO Scripts > Script development tools

Trailmyx's Runebook/Spellcast Subs

(1/24) > >>

TrailMyx:

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

--- End code ---

12TimesOver:
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

TrailMyx:

--- Quote from: 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

--- End quote ---

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.

12TimesOver:
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

TrailMyx:

--- Quote from: 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

--- End quote ---

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.

Navigation

[0] Message Index

[#] Next page

Go to full version