Yoko

All sides of Injection
It is currently 2024-04-18 10:07:05

All times are UTC+02:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Пропуск
PostPosted: 2012-11-23 00:46:37 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Как сделать так, чтоб чар при открытии двери не пытался её открыть если она открыта и закрыть если она закрыта
Code:
sub open door()
go(0001,0001, 0)
go(0002,0002, 0)
go(0003,0003, 0)
opendoor()
wait(100)
go(0004,0004, 0)
closedoor()
wait(100)
go(0005,0005, 0)
go(0004,0004, 0)
opendoor()
wait(100)
go(0003,0003, 0)
closedoor()
wait(100)
go(0002,0002, 0)
go(0001,0001, 0)
end sub


sub opendoor()
   var n
   Dim Door[30]
   Door[1]='0x085A'
   Door[2]='0x06A5'
   Door[3]='0x0854'
   for n=1 to 3
      if uo.countground(Door[n]) then
         uo.usefromground(Door[n])
      endif
   next
endsub
sub closedoor()
   var n
   Dim Door[30]
   Door[1]='0x085B'
   Door[2]='0x06A6'
   Door[3]='0x0855'
   
   for n=1 to 3
      if uo.countground(Door[n]) then
         uo.usefromground(Door[n])
      endif
   next
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Top
   
 Post subject: Re: Пропуск
PostPosted: 2012-11-23 07:49:22 
Offline
User avatar

Joined: 2009-05-28 09:58:28
Posts: 2802
Location: Иваново
Использовать не по ID а по типу предмет.
У открытых дверей тип отличается от закрытых, а ID сохраняется.

_________________
Image
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"
Стрелялка для олдов.


Top
   
 Post subject: Re: Пропуск
PostPosted: 2012-11-23 10:39:18 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Mirage wrote:
Использовать не по ID а по типу предмет.
У открытых дверей тип отличается от закрытых, а ID сохраняется.

стоп, дело в дверях, если она открыта он пытается ее открыть, как сделать так чтоб если она открыта он продолжал бежать дальше

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Top
   
 Post subject: Re: Пропуск
PostPosted: 2012-11-23 10:55:27 
Offline
User avatar

Joined: 2009-05-28 09:58:28
Posts: 2802
Location: Иваново
Ну у тебя в принципе правильно, но во первых нет пауз после действия - чар не успевает среагировать. Во вторых я делал примерно вот так.

Code:
Sub OpenGate()
   var n
   Dim Door[3]
   Door[1]='0x085A'
   Door[2]='0x06A5'
   Door[3]='0x0854'
   uo.Set('finddistance', 1)
   for n=1 to 3
      UO.FindType(Door[n],'-1','ground')
      if UO.FindCount('finditem') > 0 then
         UO.UseObject('finditem')
         wait(100)
      endif
   next
end sub


Потому что такая связка будет использовать именно найденную дверь.
А связка
if uo.countground(Door[n]) then
uo.usefromground(Door[n])
не взаимосвязана. Если рядом будет 2 двери одного типа то он может найти одну а пытаться открыть другую => зациклится.

_________________
Image
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"
Стрелялка для олдов.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited