Руда, дрова, рыба. Модуль добычи всего до чего чар сможет дотянуться.
Берем инструменты, идем туда где чтото есть (пещера, лес, водоем) и запускаем соответствующую процедуру.
Не зависим от поворота инструмента. Отмечает тайлы пола и воды чтобы визуально было заметно где скрипт уже прошел. Автоматом определяет инструмент для добычи который находится в рюкзаке. Останавливается если ресурсоносных тайлов нет в пределах досягаемости, либо чар перегружен. Если чар атакован то берет оружие и пытается дать сдачи. Большой список сообщений в журнале - солянка с 4 разных типов серверов.
Требуется протестировать и определить глюки скрипта.
Так же пишите критику и предложения.
Code:
VAR Shovel1 = '0x0F39'
VAR Shovel2 = '0x0F3A'
VAR Pickaxe1 = '0x0E85'
VAR Pickaxe2 = '0x0E86'
VAR axe1 = '0x0F43'
VAR axe2 = '0x0F44'
VAR FPole1 = '0x0DBF'
VAR FPole2 = '0x0DC0'
VAR log = '0x1BDD'
VAR knife = '0x0F51'
VAR Steak = '0x097A'
var weapon = '0x1404'
var Enemy = '0x00000000'
VAR MaxVes = 550, printcolour = '1069'
VAR delay1 = 100 , delay2 = 300, delay3 = 700
VAR MaxRangeMining = 2, MaxRangeLumber = 3, MaxRangeFishing = 6
VAR X, Y, Z, i, Tiles, Lasttimer, MaxRange, action, timemove
VAR allmsg = 'в черте города|table|attacking you|%|destroyed|broke|useable|put the|is nothing here to mine|Wthere do you|have no line|mining elsewhere|too far away|so close to yourself|Logs|nothing|ou hack at the tree|no logs|no ore|ou can|reach this|hat is too far away|do much|t appears immune to your blow|cannot|fishing elsewhere|too far away|pull out|anything|no fish|0xAD00|0xA867|0xA2DE|0xAD03|0x5DE0|0x5DE1|0x5DE2|0x5DE3|0x5DE4|0x5DE5|0x5DE6|0x5DE7|выкопали|Вы положили|Вам не удалось|У вас нет|ничего|Тут ничего|Попробуйте|атакует|положили|древесина кончилась|дрова|ударили по дереву|ут нечего рубить|ы не можете до этого достать|ерево слишком далеко|то кажется свободным для вашего удара|поймали|не получилось|нету рыбы|месте|далеко|вытащили удочку'
VAR endmsg = 'в черте города|%|destroyed|is nothing here to mine|have no line|Try mining elsewhere|too far away|so close to yourself|nothing|no logs|no ore|ou can|cannot|fishing elsewhere|no fish|0xAD00|0xA867|0xA2DE|Тут ничего|нет руды|У вас нет|Попробуйте|древесина кончилась|ут нечего рубить|ы не можете до этого достать|ерево слишком далеко|свободным для вашего удара|нету рыбы|в другом месте|далеко|вытащили удочку'
VAR mX = UO.GetX('self'), mY = UO.GetY('self'), mZ = UO.GetZ('self')
sub Mining()
UO.SetGlobal('action','1')
UO.SetGlobal('MaxRange','2')
uo.mfgi( 'resend' )
extraction()
end sub
sub Lumber()
UO.SetGlobal('action','2')
UO.SetGlobal('MaxRange','3')
uo.mfgi( 'resend' )
extraction()
end sub
sub Fishing()
UO.SetGlobal('action','3')
UO.SetGlobal('MaxRange','6')
uo.mfgi( 'resend' )
extraction()
end sub
Sub extraction()
for Y = -val(uo.GetGlobal('MaxRange')) to val(uo.GetGlobal('MaxRange'))
for X = -val(uo.GetGlobal('MaxRange')) to val(uo.GetGlobal('MaxRange'))
if val(uo.GetGlobal('action')) == 1 then
Tiles = MiningTiles(mX+X, mY+Y)
else
if val(uo.GetGlobal('action')) == 2 then
Tiles = Tree(mX+X, mY+Y)
else
Tiles = FishTiles(mX+X, mY+Y)
mZ = 251
end if
end if
if Tiles then
repeat
CheckAll()
UO.DeleteJournal()
UO.WaitTargetTile(Tiles, mX+X, mY+Y, mZ)
Tools()
LastTimer=UO.Timer()
repeat
wait( delay1 )
until UO.InJournal( allmsg ) || UO.Timer()>LastTimer+delay2 || UO.Weight > MaxVes || UO.Dead()
CheckAll()
until UO.InJournal( endmsg ) || UO.Timer()>LastTimer+delay3 || UO.Weight > MaxVes || UO.Dead()
uo.mfgi( 'add', '6017', mX+X, mY+Y, mZ )
end if
next
next
UO.Set('quiet','0')
uo.charprint('self',printcolour, 'ВСЕ!')
UO.Sound(100)
end sub
Sub CheckAll()
UO.Set('quiet','1')
if UO.InJournal('is attacking you') then
Enemy = UO.JournalSerial(UO.InJournal("is attacking you")-1)
DeleteJournal('is attacking you')
Gong(1)
uo.Usetype( weapon )
UO.Attack( Enemy )
LastTimer=UO.Timer()
repeat
wait( delay2 )
until uo.dead() or uo.GetX(Enemy)==0 || UO.Timer()>LastTimer+delay2
uo.Warmode(0)
wait(delay2)
end if
If UO.Life < Uo.Str/10 then
UO.Set('quiet','0')
uo.charprint('self',printcolour, 'Умираю!')
MyTerminate()
endif
If UO.Weight > MaxVes Then
UO.Set('quiet','0')
uo.charprint('self',printcolour, 'Перегруз!')
MyTerminate()
endif
if uo.Warmode()==1 then
uo.Warmode(0)
wait(delay2)
end if
DIM Fish[5]
Fish[1] = '0x09CC' ; тип рыбы 1
Fish[2] = '0x09CD' ; тип рыбы 2
Fish[3] = '0x09CE' ; тип рыбы 3
Fish[4] = '0x09CF' ; тип рыбы 4
For i=1 To 4
UO.FindType( Fish[i], -1, 'ground' )
If UO.FindCount() > 0 Then
timemove=UO.Timer()
while UO.ContainerOf( UO.GetSerial('finditem') )=='0xFFFFFFFF' && timemove+20>UO.Timer()
uo.MoveItem('finditem',0,'backpack')
wait(delay1)
wend
if uo.count( knife ) then
UO.WaitTargetObject( 'finditem' )
UO.UseType( knife )
while UO.Count( Fish[i] )
wait( delay1 )
wend
UO.FindType( Steak )
while UO.FindCount()>1
UO.MoveItem( 'finditem', '0' , 'backpack' )
wait( delay1 )
UO.FindType( Steak )
wend
endif
endif
Next
if UO.InJournal('в черте города') then
DeleteJournal('в черте города')
uo.charprint('self',printcolour, 'Ресурсы тут добывать нельзя!')
MyTerminate()
end if
end sub
Sub Tools()
if val(uo.GetGlobal('action')) == 1 then
if UO.Count(Shovel1) then
UO.UseType(Shovel1)
return
else
if UO.Count(Shovel2) then
UO.UseType(Shovel2)
return
else
if UO.Count(Pickaxe1) then
UO.UseType(Pickaxe1)
return
else
if UO.Count(Pickaxe2) then
UO.UseType(Pickaxe2)
return
else
UO.Set('quiet','0')
uo.charprint('self',printcolour, 'Нечем копать!')
MyTerminate()
endif
endif
endif
endif
else
if val(uo.GetGlobal('action')) == 2 then
if UO.Count(axe1) || UO.Count(axe2) then
if UO.Count(axe1) then
UO.UseType(axe1)
return
else
UO.UseType(axe2)
return
endif
else
UO.Set('quiet','0')
uo.charprint('self',printcolour, 'Нечем рубить!')
MyTerminate()
endif
else
if UO.Count( FPole1 ) || UO.Count( FPole2 ) then
if UO.Count( FPole1 ) then
UO.UseType( FPole1 )
return
else
UO.UseType( FPole2 )
return
endif
else
uo.charprint('self',printcolour, 'Нечем ловить рыбу!')
MyTerminate()
endif
end if
end if
end sub
Sub MiningTiles(X,Y)
if UO.PrivateGetTile(X, Y, -1, 616, 618) then
for i=616 to 618
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 1339, 1363) then
for i=1339 to 1363
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 2272, 2282) then
for i=2272 to 2282
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 4963, 4973) then
for i=4963 to 4973
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 6001, 6012) then
for i=6001 to 6012
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 13121, 13369) then
for i=13121 to 13369
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 13446, 13455) then
for i=13446 to 13455
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 13484, 13492) then
for i=13484 to 13492
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
if UO.PrivateGetTile(X, Y, -1, 13625, 13628) then
for i=13625 to 13628
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
return 0
end sub
Sub Tree(X,Y)
DIM R[34]
R[1] = 3274;
R[2] = 3275;
R[3] = 3276;
R[4] = 3277;
R[5] = 3280;
R[6] = 3283;
R[7] = 3286;
R[8] = 3288;
R[9] = 3290;
R[10] = 3293;
R[11] = 3296;
R[12] = 3299;
R[13] = 3302;
R[14] = 3320;
R[15] = 3323;
R[16] = 3326;
R[17] = 3329;
R[18] = 3393;
R[19] = 3394;
R[20] = 3395;
R[21] = 3396;
R[22] = 3415;
R[23] = 3416;
R[24] = 3417;
R[25] = 3418;
R[26] = 3419;
R[27] = 3438;
R[28] = 3439;
R[29] = 3440;
R[30] = 3441;
R[31] = 3442;
R[32] = 3460;
R[33] = 3461;
R[34] = 3462;
for i = 1 to 34
if uo.privategettile( x, y, -1, R[i], R[i]) then
return R[i]
endif
next
return false
end sub
Sub FishTiles(X,Y)
if UO.PrivateGetTile(X, Y, -1, 6038, 6066) then
for i=6038 to 6066
if UO.PrivateGetTile(X, Y, -1, i, i) then
return i
end if
next
end if
return 0
end sub
Sub Gong(times)
VAR i
for i=1 to times
UO.Exec("playwav d:\Games\Ultima\GMYokoInjection\ALARM")
wait(200)
next
end sub
Sub DeleteJournal(msg)
While UO.InJournal(msg)
UO.SetJournalLine(UO.InJournal(msg) - 1,'')
wend
endsub
Sub MyTerminate()
UO.Set('quiet','1')
UO.CancelMenu()
UO.IgnoreReset()
UO.Set('quiet','0')
UO.Exec('terminate all')
end sub
Sub checklag()
DeleteJournal("ackpack")
UO.Click("backpack")
repeat
wait(100)
until UO.InJournal("ackpack")
end sub
sub clean()
var m = 50
for Y = -m to m
for X = -m to m
uo.mfgi( 'clear', mX+X, mY+Y, mZ )
next
next
end sub
PS Создавал специально для шарда Антарес на котором и тестировался. Для Бестовцев - убрал то что у вас запрещено, сори.
PPS Если скрипт вообще не начинает копать или рубить или ловить - проблема в типах тайлов (ОЧЕНЬ маловероятная ситуация).
Если скрипт добывает ресурс 1 раз и встает надо посмотреть последнее сообщение прошедшее при добыче ресурса и добавить его в
VAR allmsg = . Не целиком - можно кусок сообщения (см. пример в самом скрипте)
Если скрипт завершает добычу в одной точке и встает - надо последнее сообщение вписать в
VAR endmsg = .