Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Easy UO Script: Mining at Mt. Kendall
#25

I get the following message when I run this script: 213: ')' expected near 'UO'
Also, I don't notice any communication between easyuo and the game. When I click on my container there is no change in ContID. Any help is appreciated Smile
#26

I'd say it isn't detecting your UO installation but I'm no expert...
try shuting down uo, re-install easyuo then start uo and easy uo and I don't remember either if you need to run some executable after extracting the files from the zip and before running it, I'll try tomorrow.
#27

i had that problem before. i ran euo as admin and it worked so try that
#28

Yup that did it. Thanks Thorn!
However, I still get the message when i try to use the macro: 213: ')' expected near 'UO'

I found what to me looks like unclosed parenthesis in the following if statement and thought that might be the issue but when i remove or close it nothing changes or I get another similar message to the above saying: 213: 'then' expected near 'UO'

Quote: for i=1,95 do
--calc min distance
currD=math.sqrt(math.pow(x-forgeXs[i],2)+math.pow(y-forgeYs[i],2))
if (currD UO.MaxWeight-10 then
bankOre()
#29

dunno what the problem is I'll post the latest code i'm using (some times I make some small tweaks)

Quote:-- Change this to the ID of container in your bank where you would like
-- your ingots to be placed.
ingotContainer=1082676472 --1099312276 --
bankType=1074118237

ingotType=7151
toolTypes=3718
status="idle"
idle="idle"

print("Starting OzMining 1.0 moded by Morwen/Reonarudo/Crafty")
status ="idle"
os=""
ref=0

function MineThisSpot(status)
if ( status ~= "idle" ) then
return status
end
local cnt=0
for i=1,UO.ScanItems(true) do
nID,type= UO.GetItem(i)
if type==3718 then
cnt=cnt+1
break
end
end
if cnt > 0 then
UO.LObjectID=nID
UO.Macro(17,0)
local oldX=UO.CharPosX
local oldY=UO.CharPosY
local oldZ=UO.CharPosZ
UO.TileInit (true)
local nType,nZ,sName,nFlags=UO.TileGet(oldX,oldY,2)
UO.LTargetTile=nType
UO.LTargetX=oldX
UO.LTargetY=oldY
UO.LTargetZ=oldZ
UO.LTargetKind=3
--target 10s


wait(600)
UO.Macro(22,0)
status="mining"
end

return status
end

function scanJournalFor(refArg,str)
nRef, nCnt = UO.ScanJournal(refArg)
for ji=nCnt-1,0,-1 do
text,colour=UO.GetJournal(ji)
if string.find(text,str) then
print(ji)
ref=nRef
return true
end
end
return false
end

function ProcessResults(status,jrnl)
while status == "mining" do

if scanJournalFor(ref,"dig some") then
print("You dug something")
status="idle"
end
if scanJournalFor(ref,"loosen some rocks") then
print("FAIL LOL")
status="idle"
end

if scanJournalFor(ref,"too far") then
print("Stupid biatx")
status="idle"
end
if scanJournalFor(ref,"Someone has gotten") then
print("huh?")
status="idle"
end

if scanJournalFor(ref,"cannot be seen") then
print("stupid blind ****er")
status="no_more_ore"
--MoveToNextSpot()
end
if scanJournalFor(ref,"no metal") then
print("Resource depleeted")
status="no_more_ore"

end
if scanJournalFor(ref,"can't mine") then
print("You can only mine rocks... you know like... rocks")
status="no_more_ore"
--MoveToNextSpot()
end
if scanJournalFor(ref,"save complete.") then
print("God save us from Eru")
status="no_more_ore"

end
-- if scanJournalFor(ref,"that is too far away") then
-- print("You are not so big now!")
-- status="no_more_ore"

-- end
if scanJournalFor(ref,"for validating your presence") then
UO.Msg("Dont forget to VOTE\n")
status="no_more_ore"

end
if scanJournalFor(ref,"stand closer") then
print("Its ingot melting time!!!")
status="idle"
GoSmelt()

end
if status~=os then
os=status
print("new status "..status)
end

end
return status
end

function MoveToNextSpot()
print("Finding next mining spot\n")

--FindNextSpot:
local oldX=UO.CharPosX
local oldY=UO.CharPosY
local randomInc=math.random(-5,5)
local newX=oldX + randomInc
randomInc = math.random(-5,5)
local newY=oldY + randomInc

print("Checking tile data")
UO.TileInit (true)
nType,nZ,sName,nFlags=UO.TileGet(newX,newY,2)

while sName~="cave floor" do
print("tile wasn't in a cave.")
print("Checking another tile to go.")
math.random()
randomInc = math.random(-5,5)
newX=oldX + randomInc
randomInc = math.random(-5,5)
newY=oldY + randomInc
print("X:"..newX.." Y:"..newY)
nType,nZ,sName,nFlags=UO.TileGet(newX,newY,2)
end
print("Going to "..newX.."-"..newY)
UO.Pathfind(newX,newY)
local countTry=0
while UO.CharPosX~=newX and UO.CharPosY~=newY do
wait(2000)
UO.Pathfind(newX,newY)
if countTry==15 then
break
else
countTry=countTry+1
end
end



status="idle"
end

function GoToForge()
local x=UO.CharPosX
local y=UO.CharPosY
local CountOres=0
for i=1,UO.ScanItems(true) do
local id,type = UO.GetItem(i)
if type==6585 then
CountOres=CountOres+1
end
end
if(CountOres>0) then

local minD=99999999
local currD=-1
local idx=-1
local forgeXs={2568,2569,2575,2576,2568,2569,2570,2571,2572,2573,
2574,2575,2576,2577,2568,2569,2570,2571,2572,2573,
2574,2575,2576,2577,2568,2569,2570,2571,2572,2573,
2574,2575,2576,2577,2572,2573,2574,2575,2576,2577,
2578,2572,2573,2577,2578,2572,2573,2578,2572,2573,
2577,2578,2572,2573,2574,2575,2576,2577,2578,2572,
2573,2574,2575,2576,2577,2578,2572,2573,2574,2575,
2576,2577,2578,2581,2581,2581,2581,2581,2581,2581,
2582,2582,2582,2582,2582,2582,2582,2582,2583,2583,
2583,2583,2583,2583,2583}
local forgeYs={474,474,474,474,475,475,475,475,475,475,475,475,475,
475,476,476,476,476,476,476,476,476,476,476,477,
477,477,477,477,477,477,477,477,477,486,486,486,
486,486,486,486,487,487,487,487,488,488,488,489,
489,489,489,490,490,490,490,490,490,490,491,491,
491,491,491,491,491,492,492,492,492,492,492,492,
490,491,492,493,494,496,497,490,491,492,493,494,
495,496,497,490,491,492,493,494,495,496}
for i=1,95 do
--calc min distance
currD=math.sqrt(math.pow(x-forgeXs[i],2)+math.pow(y-forgeYs[i],2))
if( currD minD=currD
idx=i
end
end

UO.Pathfind(forgeXs[idx],forgeYs[idx])
local newX=forgeXs[idx]
local newY=forgeYs[idx]
while UO.CharPosX~=newX and UO.CharPosY~=newY do
wait(5000)
UO.Pathfind(newX,newY)
end
while UO.CharPosX ~= newX and UO.CharPosY ~= newY do
wait(1000)
end
print("Reached forge")
wait(1000)
--Melt ores
for i=1,UO.ScanItems(true) do
local id,type = UO.GetItem(i)
if type==6585 then
UO.LObjectID=id
UO.Macro(17,0)
print("Smelts ore")
wait(200)
end
end
else
print("No Ores to Smelt")
end
end

function GoSmelt()
--TODO Find nearest forge from a list of forges
-- saves current position and go to forge
-- Once there smelt all the ores and
-- go back
local oldX=UO.CharPosX
local oldY=UO.CharPosY
--SmeltOre:
-- set %oldX #charposX
-- set %oldY #charposY
GoToForge()
if UO.Weight > UO.MaxWeight+20 then
bankOre()
end
UO.Pathfind(oldX,oldY);
while UO.CharPosX~=oldX and UO.CharPosY~=oldY do
wait(2000)
UO.Pathfind(oldX,oldY)
end
while UO.CharPosX ~= oldX and UO.CharPosY ~= oldY do
wait(1000)
end
end


function bankOre()
local oldX=UO.CharPosX
local oldY=UO.CharPosY
local countIng =0
for i=1,UO.ScanItems(true) do
local nID,nType,nKind, nContID, nX, nY, nZ, nStack, nRep, nCol = UO.GetItem(i)
if nType==7151 then--ingotType then
countIng=countIng+1
end
end
if(countIng>0) then
print("Going to bank ingots...")
UO.Pathfind(2569,488);
while UO.CharPosX~=2569 and UO.CharPosY~=488 do
wait(4000)
UO.Pathfind(2569,488);
end

UO.Pathfind(2563,503);
while UO.CharPosX~=2563 and UO.CharPosY~=503 do
wait(4000)
UO.Pathfind(2563,503);
end

UO.Pathfind(2561,510);
while UO.CharPosX~=2561 and UO.CharPosY~=510 do
wait(4000)
UO.Pathfind(2561,510);
end

print("Reached banking spot")
wait(500)
UO.LObjectID=bankType
UO.Macro(17,0)
wait(2000)
print("Opened bankbox")
for i=1,UO.ScanItems(true) do
local nID,nType,nKind, nContID, nX, nY, nZ, nStack, nRep, nCol = UO.GetItem(i)
if nType==ingotType then
wait(200)
UO.Drag(nID,nStack)
wait(400)
UO.DropC(ingotContainer)
wait(800)
end
end

print("Going back...")
UO.Pathfind(2569,488);
while UO.CharPosX~=2569 and UO.CharPosY~=489 do
wait(5000)
UO.Pathfind(2569,488);
end
while UO.CharPosX~=2569 and UO.CharPosY~=489 do
wait(1000)
end
UO.Pathfind(oldX,oldY);
while UO.CharPosX~=oldX and UO.CharPosY~=oldY do
wait(5000)
UO.Pathfind(oldX,oldY)
end
while UO.CharPosX ~= oldX and UO.CharPosY ~= oldY do
wait(1000)
end
end
end











function Main()
local status="idle"

while UO.Hits > 0 do
if ( UO.Weight > UO.MaxWeight+20 ) then
print("gosmelt")
GoSmelt()
end
if status == "no_more_ore" then
print("move next")
status= "idle"
MoveToNextSpot()
end
if ( UO.Weight > UO.MaxWeight+20 ) then
print("gosmelt")
GoSmelt()
end
local nNewRef = UO.ScanJournal(0)
status=MineThisSpot(status)
status=ProcessResults(status,nNewRef)
status=MineThisSpot(status)
end
end

Main() --Run biatx
#30

there is a ) in the if but it disappears once i post i tried to edit but it still disappears
#31

With your update I get 190: '}' expected near '572'
which is weird because so far I only see two open curly brackets and they both have closing brackets.
#32

try downloading from here http://dl.dropbox.com/u/12530159/mining.lua
#33

Great! Says Starting OzMining 1.0... but my char isn't doing anything.
Do I have to be standing anywhere in particular within mt kendall?
#34

just inside the mine
#35

Ugh! This is making me crazy... any ideas on how to troubleshoot this? I open the script in oeuo and push play. The resulting message says "Starting OzMining 1.0 moded by Morwen/Reonarudo/Crafty"... But nothing happens in game.
#36

I'll make a visit to you at mt kendall


Forum Jump:


Users browsing this thread: 5 Guest(s)