Description: A revision from Monero's inscribe dungeon script, but using meditation instead of hiding to speed up crafting.
--[[
Script: TrainInscriptionWithMeditation.lua
Version: 1.0.0
Date: June 12, 2025
Description: UOSagas inscription training script using Meditation for mana recovery.
Revision of Monero's Inscribe script by FloodgateUO/oFrizz.
--]]
-- Configuration settings
local scribePenType = 0x0FBF -- Graphic ID for the scribe pen used to craft scrolls
local gumpId = 2653346093 -- Gump ID for the scribe pen's crafting menu
local gumpTimeout = 3000 -- Timeout (in milliseconds) to wait for the crafting gump to load
local manaThreshold = 12 -- Minimum mana to trigger meditation
local manaTarget = 80 -- Target mana to reach before crafting again
local meditationDelay = 1000 -- Delay (in milliseconds) after using Meditation
-- Function: findScribePen
function findScribePen()
local items = Items.FindByFilter({ RootContainer = Player.Serial, graphics = scribePenType })
for _, item in ipairs(items) do
if item and item.Graphic == scribePenType then
return item
end
end
return nil
end
-- Function: meditateUntilMana
function meditateUntilMana(targetMana)
while Player.Mana < targetMana do
Journal.Clear()
Skills.Use("Meditation")
local medStarted = false
-- Wait up to 50 x 100ms = 5 seconds for the meditation message
for i = 1, 50 do
if Journal.Contains('You enter a meditative trance') then
medStarted = true
break
elseif Journal.Contains('You are already meditating') then
medStarted = true
break
elseif Journal.Contains('You cannot focus your concentration') then
-- Meditation failed, break and try again after a pause
break
end
Pause(100)
end
if medStarted then
Messages.Overhead("Meditating...", 69, Player.Serial)
-- Wait until mana is full or at target
while Player.Mana < targetMana do
Pause(250)
end
Messages.Overhead("Mana sufficient, resuming crafting.", 69, Player.Serial)
break
else
-- If meditation didn't start, wait a bit before retrying
Pause(1000)
end
end
end
-- Main loop
function main()
while true do
-- If mana is low, meditate until manaTarget is reached
if Player.Mana < manaThreshold then
meditateUntilMana(manaTarget)
else
-- Attempt to find a scribe pen in the backpack
local scribePen = findScribePen()
if not scribePen then
Messages.Overhead("No scribe pen found in backpack!", 69, Player.Serial)
Pause(500)
else
Player.UseObject(scribePen.Serial)
if Gumps.WaitForGump(gumpId, gumpTimeout) then
Gumps.PressButton(gumpId, 21)
if Gumps.WaitForGump(gumpId, gumpTimeout) then
Gumps.PressButton(gumpId, 0)
Messages.Overhead("Crafting...", 10, Player.Serial)
else
Messages.Overhead("Failed to craft scroll!", 69, Player.Serial)
Pause(500)
end
else
Messages.Overhead("Failed to open crafting gump!", 69, Player.Serial)
Pause(500)
end
end
end
end
end
main()
Version History
Version 1 - 6/12/2025, 9:35:01 PM - 1 day ago
Inscribe Last with med.
Original Version Saved - 6/12/2025, 9:34:33 PM - 1 day ago