Направление движения изменить помогите
Posted: 2007-06-26 11:44:49
Он по скрипту по шахте идёт с лева на право = помогите сделать наоборот, т.е. чтобы он шел с права на лево !!! И чтобы после-того как он дойдёт до конечной точки вернулся в ту с которой начинал и так по кругу!
Code: Select all
sub main()
sub Mining()
DIM dis[8]
dis[0] = 33 # N
dis[1] = 34 # E
dis[7] = 40 # S
dis[3] = 36 # W
dis[4] = 37 # Left
dis[5] = 38 # Up
dis[6] = 39 # Top
dis[2] = 35 # Down
DIM wal[2]
wal[0] = "You see: cave floor"
wal[1] = "You see: stalagmites"
var path = 34
var pix = '0x0e85' #кирка
#var pix = '0x143c' #молот
#DesCor() # 2 шага на West и корректировка направления
Uo.SetGlobal("fase_pos",'34')
while true
wait(500)
if (Move(path,1) == 1 ) then
wait(1000)
if (path == 34) then
path = 36
else
path = 34
endif
Move(path,1)
Move(33,1)
end if
Geting()
Min(pix)
Wait(1000)
MacroEating()
wend
end sub
#--------------------
# Копание
#--------------------
#Select a place to mine.
#there is no more ore here ti mine
sub Min(kirka)
var time
start:
uo.Print("Кирок:")
uo.Findtype(kirka,-1,'my')
if (uo.FindCount() < 0 ) Then
uo.Print("Кирка не найдена!!!")
return 1 #ошибка.. остановка всего на свете
endif
if (uo.ObjAtLayer('Rhand') == "" ) then
uo.equip('Rhand','finditem')
endif
wait(1000)
uo.Useobject(uo.objAtLayer('Rhand'))
uo.waittargetSelf()
uo.DeleteJournal()
time = uo.Timer()
time= time+620
uo.Print("Start копания")
uo.DeleteJournal()
while (true)
if (uo.InJournal("there is no more ore here to mine.") or uo.InJournal("You cannot see that")) then
goto end
end if
if (uo.Injournal("your tool broke.")) then
goto start
endif
if ( time <= uo.Timer()) then
UO.print("time end")
return 2
endif
wait(1000)
wend
end:
uo.Print("No errors")
return 0
end sub
#--------------------
# ДВижение чара (направление, количество шагов)
#--------------------
sub Move(path, step)
var fase = uo.GetGlobal("fase_pos")
var x = uo.GetX()
var y = uo.GetY()
if ( not val(fase)== path ) then
uo.Print("Поворот")
uo.Press(path,1,500)
endif
var ct=0
while (ct < step)
uo.Press(path,1,500)
wait(1000)
if ( (uo.GetX() == x) and (uo.GetY() ==y) )then
Uo.SetGlobal("fase_pos",str(path))
return (1)
endif
ct=ct+1
x = uo.GetX()
y = uo.GetY()
wend
Uo.SetGlobal("fase_pos",str(path))
uo.Print(uo.GetGlobal("fase_pos"))
return (0)
end sub
#---------------------------------------
# Корректировака направления движения
#---------------------------------------
sub DesCor()
uo.Press(36,2,300)
uo.SetGlobal("fase_pos",'33')
end sub
sub testing()
Navigate(1)
end sub
#---------------------------------------
# осмотр окружающей среды
#---------------------------------------
sub Navigate(path)
DIM wal[2]
wal[0] = "You see: cave floor"
wal[1] = "You see: stalagmites"
var pos_X = uo.GetX()
var pos_Y = uo.GetY()
uo.Lclick(pos_X,pos_Y)
uo.Lclick(pos_X,pos_Y)
end sub
sub MacroEating()
DIM hungry[11]
hungry[0] = "You are absolutely stuffed!" #Вы обожрались
hungry[1] = "You are stuffed" #Вы прилично переели
hungry[2] = "You aren't hungry at all" #Вы не хотите есть вообще
hungry[3] = "You are a little hungry" #Вы немного хотите есть
hungry[4] = "You are somewhat hungry" #Вы хотите прекусить
hungry[5] = "You are REALLY hungry" #Вы РЕАЛЬНО хотите есть
hungry[6] = "Your stomash hurts" # Животик урчит
hungry[7] = "Your stomash hurts and you feel dizzy" #Вы чувствуете головокружение от голода
hungry[8] = "You are starving" #Вы голодаете
hungry[9] = "You are almost dying of hunger" #Вы почти умираете от голода
hungry[10] = "You are DYING of hunger..." #Вы УМЕРАЕТЕ от голода
var food = UO.COUNT('0x097b') # количество еды (рыба жаренная, с корочкой )
if (food == 0) then
uo.Print("В сумке нет еды")
return
end if
uo.Print("Aau : "+ str(food))
var stat_hungry = -1
var stat_limit = 2
var q = 0
start:
UO.DeleteJournal()
if (UO.GetHP()>0) then
uo.ServerPrint(".hungry")
uo.Print("Go")
Wait(1000)
for q=0 to 10
if ( uo.InJournal(hungry[q]) ) Then
stat_hungry = q
goto eat
end if
next
end if
eat:
if (stat_hungry > stat_limit) then
UO.USETYPE('0x097b')
wait(1000)
goto start
endif
uo.Print("end")
end sub
#---------------------------------------
# тоскание за собой
#----------------------------------------
#Gem Ore 0 # 0x05D7
#Copper 0 # 0x07DF
#Iron 60 # 0x0000
#Steel 70 # 0x0482
#Anra 80 # 0x045E
#Valurit 90 # 0x07D6
#Lavarock 95 # 0x006F
#Icerock 100 # 0x09F9
#Shadow 105 # 0x0940
#Azurite 110 # 0x094A
#Doom 115 # 0x0943
#BlueSteel 120 # 0x094E
#DarkRuby 129 # 0x0214
#Crystallit 135 # 0x0487
#Onix 140 # 0x0
#Mifril 145 # 0x0
sub Geting()
DIM rud_color[13]
rud_color[0]='0x05d7'
rud_color[1]='0x07DF'
rud_color[2]='0x0000'
rud_color[3]='0x0482'
rud_color[4]='0x045E'
rud_color[5]='0x07D6'
rud_color[6]='0x006F'
rud_color[7]='0x09F9'
rud_color[8]='0x0940'
rud_color[9]='0x094A'
rud_color[10]='0x0943'
rud_color[11]='0x094E'
rud_color[12]='0x0214'
rud_color[13]= '0x0487'
uo.Set('finddistance','2')
for var q=0 to 13
uo.findtype('0x19b9',rud_color[q],'ground')
if (uo.GetQuantity('finditem')>0) then
uo.waittargetobject('finditem')
uo.grab('finditem')
wait(1000)
endif
wait(500)
next
end sub
endsub