ScriptUO
Scripting Resources & Utilities => OpenEUO Scripts => OEUO => Scripting tools => Topic started by: TrailMyx on August 30, 2010, 10:31:25 AM
-
---------------------------------------------------------------
-- Script Name: TrailMyx's Runebook/Spellcast subs for OEUO
-- Author: TrailMyx
-- Version: v1.2
-- Shard OSI / FS: unk
-- Revision Date: 8/30/2010
-- Purpose: Collection of routines to automate the use of the runbook and spellcasting including:
--
-- TM_NewCastSpell(whichspell, whichtarget, castretrymax, waitdelay, recovery_delay) - casts spell with programmed wait times, targets, etc
-- TM_TravelFromRunebook(method, locindex, locindexend, rbook_in) - travel from runebook with known FINDID
-- TM_TravelFromNamedRunebook(method, locindex, locindexend, rbook_name) - travel from runebook with known NAME
-- TM_RandomRunebookTravel(method, locindex, locindexend, rbook_in) - generates a random destination from a given rune range
-- TM_TravelFromObject(method, object_in) - travels from objects like runes and boat keys
--
-- Examples:
-- while true do
-- for x=1,8 do
-- TM_TravelFromRunebook("re",x,x,"IWEPUVD") -- travels from rune locations 1 to 8 and then repeats
-- wait(200)
-- end
-- end
--
-- while true do
-- TM_TravelFromObject("re","YDTXCND") -- travel to boat key
-- TM_TravelFromObject("re","IWEPUVD") -- travel to rune book present location
-- end
--
-- TM_RandomRunebookTravel("re",1,3,"IWEPUVD") - recall to a random location within the range of 1-3 in runebook
-- TM_TravelFromNamedRunebook("ga",1,1,"Zippyy") - gate travel to rune location 1 in runebook named "Zippyy"
-- TM_TravelFromRunebook("ga",1,1,"IWEPUVD") - gate travel to rune location 1 and runebook id IWEPUVD
-- TM_NewCastSpell(28, "self", -1, 10, 20) - casts spell 28 (Greater Heal) on the spellcaster
--
-- Special Thanks:
--
-- Beta testers:
-- Bug testers:
--
---------------------------------------------------------------
I don't want to widely release these yet since they still probably have some fleas. But if you want to start playing with them, feel free.
Please Note:
These are required:
dofile("tm_oeuo_advjournalscan10.lua")
dofile("tm_subs_collection5.lua")
IMPORTANT!!!
You must save your Lua script before you run it, or else your "dofile" will not correctly include your file.
-
thanx TM I am working on a recall resource gather script in OEUO and this will give me some guidance on how to work around it.
-
My testing seems to have these pretty solid. But OEUO is so new to me that anything could go wrong.
-
Isn't TM_AdvJournalScan needed with this?
-
I am just going to pull it apart and figure out everything on my own and write a new sub. Its no fun if i use someone elses work and dont learn from it.
-
Isn't TM_AdvJournalScan needed with this?
Indeed, I added the note to the main post.
-
To my knowledge, I don't think there is another runebook subs suite out there for OEUO. Really no *REAL* journal scanner either. It's nice to be first. ;)
-
I'm totally lost.. I tried to run this script.. I removed one of the examples.. Randome Recall from 1 to 3, I changed the ID of the book to one of the ids of my book (I assume I use EUO to get the ID) hit play, I get some error
...ony\Desktop\OpenEUO\scripts\tm_runebook_travel12.lua:28: attempt to call global 'TM_RandomRunebookTravel' (a nil value)
-
You need to have all the subs I've published so far (runebook, subs, and journal scanner) in the scripts directory located in the OEUO directory.
When you get that particular error, chances are 100% that it can't find a file you were referencing.
BTW, I found a small problem with the gate travel part of the sub; I'll fix that soon.
-
BTW, I found a small problem with the gate travel part of the sub; I'll fix that soon.
-
Well, it's a small problem. When you get the confirmation gump that pops up on some gates, it doesn't click correctly. I just ported the numbers, but didn't test that part. I only tested on "normal" gates.
-
I installed both programs into the directory.. I just don't know what i'm doing in Lua.
-
A couple things. In Lua, you'll need to name and save your test file. In this example, I just named this test.lua.
Also, if you are starting a new script that uses these subs, then you'll need to include them with the "dofile" statement. Therefore:
dofile("tm_runebook_travel12.lua")
while true do
for x=1,8 do
TM_TravelFromRunebook("re",x,x,"IWEPUVD") -- travels from rune locations 1 to 8 and then repeats
wait(200)
end
end
If you save this as "test.lua" and run it, then you should immediately get
TM_TravelFromRunebook -- I cannot locate this runebook
This means you are calling the routine and the error handling is taking over.
-
And then you should change the ID in the test script there to the ID of your book. And it will work. :)
-
is there a way to find the information in OEUO?
-
I have a finditem ID information script for OEUO I haven't published yet. But it's easy enough to pull that from EUO since I made my Lua stuff compatible with either one.
Just for giggles, might as well use my subs to find out:
saved as: test_findrunebooks.lua
dofile("tm_subs_collection5.lua")
count, stack, items = TM_FindItem("ZBN","c", "*", UO.BackpackID)
for x,k in pairs(items) do
print(string.format("Runebook findid = %d", k.findid))
print(string.format(" property info: %s",k.property))
end
Produces this output:
Runebook findid = 1185662592
property info: Blessed
Weight: 1 Stone
Zippy
-
BTW, figured out what was up with the gating. Just needed to add a delay. Lua is so fast that it blew past one of the wait safeguards.
-
I'm going to move this to public pretty soon. I just need to put in the gating delay fix.
Also, has anyone tried the sacred journey capability? I frankly haven't tested the spellcasting sub for chiv yet, so I'm a bit reluctant to put this public without that section testing. I'll test myself this coming weekend, but if someone has tried already, I might be able to post sooner.
-
These seem to work pretty well now. Pretty much a direct port of my popular runebook/spellcast subs. I'm sure they aren't exact, plus my original ones needed some love. One of these days I'll redo these, but for now it'll get ya'll started.
NOTE to the Elites that downloaded earlier:
This is a newer version where gate travel works correctly.
-
The recallfromnamedrunebook function keeps getting stuck. I have it as my first called function in the script. It gets stuck here after a successfull recall to the correct rune and continues in an endless loop.
while true do
if spellcast:TM_AdvJournalScan("valid", false, "that location is", "something is blocking", "your spirit lacks") == true then
spellcast:TM_AdvJournalSync()
if locindex == locindexend then
if UO.ContName == "generic gump" and UO.ContSizeX == 452 and UO.ContSizeY == 236 then
UO.Click(UO.ContPosX + 120, UO.ContPosY + 60, false, true, true, false) -- close the book
wait(200)
return true
end
end
locindex = locindex + 1
if locindex > locindexend then
return true
end
break
end
-
You'll have to post/pm your code to me. This works fine for me, so it might be something you're doing.
The test code doesn't get any more simple:
dofile("tm_runebook_travel3.lua")
if TM_Runebook_Travel ~= 3 then
print("Warning - TM_Runebook_Travel version 3 expected in tm_runebook_travel3.lua")
end
if TM_TravelFromNamedRunebook("re",1,1,"Zippy") == false then -- recalll to rune location 1 in runebook named "Zippy"
print("cannot find specified runebook")
end
So you're going to have to give me ALOT more information. Does it stop all the time? Only sometimes? Are you low on mana? Are you at 100 magery? Etc. etc. etc. etc.
"Script broke" doesn't help.
-
I just wrote my own tool to do it. Thanks tho. I'm not proficient enough to debug someone elses code yet.
-
I just wrote my own tool to do it. Thanks tho. I'm not proficient enough to debug someone elses code yet.
Ok then.