Инскрипт & Магия

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Mr. Gluk
Posts: 42
Joined: 2006-02-04 04:39:51
Contact:

Инскрипт & Магия

Post by Mr. Gluk »

Написал я тут скрипт (вернее слепил из разных кусков), вроде работает, но:
1.Игра начинает тормозить
2.Иногда глючит , то есть не переходит к следующей функции (после того как отмедитировал - не хочет продолжать крафтить или после того как скрафтил - не хочеть кастовать его)
Прошу скриптеров, как людей которые намного лучше разбираются в скриптах чем я, проверить мой скрипт на ошибки : может кое-что надо переставить или заменить .
ЗЫ: Буду очень признателен если добавите поедание пищи

Code: Select all

sub Train()
	uo.Exec('exec Pok')
	uo.Exec('exec Reconnect') 
	uo.Exec('exec Inscript')
    uo.Exec('exec Guards')
	uo.Exec('exec GetBomb')
	UO.DeleteJournal()
end sub

sub Inscript() 
  	UO.FindType('0x1F40',-1,'backpack') ; ищет скролы Poison
  	if UO.GetQuantity('finditem')>0 then
  		Poison()
  	end if

	VAR Blank = '0x0E34'          ; Тип бланк скролла 
   	VAR Arrow = '0x1F40'         ; Тип скроллов Poison 
  
	If UO.Weight<500 then
		UO.DeleteJournal() 
    	UO.FindType('0x0E34',-1,'backpack') ; ищет бланк скролы
  	If UO.GetQuantity('finditem')>0 then
   		UO.AutoMenu( 'Spell Circles', 'Third Circle' ) 
   		UO.AutoMenu( 'Spell Circle 3', 'Poison' ) 
   		UO.UseType( Blank )
        CheckLag()
        wait(500)
       	repeat ; ждет пока скрафтится скрол
  		until UO.InJournal('You fail to inscribe the scroll') or UO.InJournal('You put the')
  	if UO.InJournal('You fail to inscribe the scroll') then
 		Inscript()
  	end if
		Poison();если не найдены бланк скролы
	end if
		Poison();если скрафтился Poison
	end if
		Home();если вес превышает 500
end sub 
#####################################################################
sub Poison() 
  		var k
  		UO.FindType('0x1F40',-1,'backpack') ;ищет Poison скрол
  	If UO.GetQuantity('finditem')>0 then
        UO.WaitTargetObject('self') 
        UO.UseObject('finditem')
  	else
        UO.Cast('Poison','self')
  	end if 
		CheckLag()
	while not UO.Mana<UO.INT
		wait(100)
	wend
	while UO.Mana<UO.INT
		UO.UseSkill('Meditation') 
      	CheckLag()
      	k=0 
    Repeat 
        k=k+1 
        Wait(100) 
  	Until UO.InJournal("You are") or UO.InJournal("You lose") or k>200 
      	UO.DeleteJournal() 
      	Wait(1000) 
    Wend 
	If not UO.Weight>500 then
		Inscript();запускаем все по новой
	else
		Home()
	end if
end sub
##########################################################
sub Home()
	if uo.Weight>500 then 
	if uo.Waiting() then 
		uo.CancelTarget() 
	end if 
		uo.Print('Go to Home') 
		uo.Exec('recall Runebook 21') 
		CheckLag()
		wait(10000) 
		DropOres() 
		wait(3000) 
		NS()
		uo.DeleteJournal() 
	if uo.Waiting() then 
		uo.CancelTarget() 
	end if 
		uo.Print('GO to Brit')
		uo.Exec('recall Runebook 33')
		CheckLag()
		wait(10000) 
		Pok()
		Inscript()
	end if
####################################################################
sub DropOres() 
		uo.DeleteJournal() 
	if uo.Waiting() then 
		uo.CancelTarget() 
	end if 
		var a, Exit 
		Var Cont='0x402E8C91'
		var UnloadChest='0x402E8C91' ## - ID сундука для сброса руды. 
		DIM Ore[5] 
		Ore[0]=0x0F88 ## - NS 
		Ore[1]=0x0E34 ## - Blank 
		uo.SetReceivingContainer(UnloadChest) 
		wait(500) 
		for a=0 to 1 
		exit=0 
	repeat 
		uo.FindType(Ore[a]) 
	if uo.GetQuantity('finditem')>0 then 
		uo.Grab('0','finditem') 
		CheckLag()
		wait(1500) 
	else 
		exit=1 
	end if 
	until Exit==1 
	next 
		uo.UnSetReceivingContainer() 
end sub 
#####################################################################
sub NS() 
		VAR sunduk='0x402E8C91' ;ID Сундука где реги
		uo.findtype('0x0F88','0x0000',sunduk) 
 	if uo.GetQuantity('finditem') then 
    	uo.moveitem('finditem',50,'backpack') 
  	end if 
		wait(500)
		CheckLag()
end sub

#####################################################################

#####################################################################

#####################################################################
sub CheckLag() 
		UO.DeleteJournal() 
  		UO.Click('backpack') 
  Repeat 
    	Wait(500) 
  Until UO.InJournal('backpack') 
end sub 
##################################################################### 
sub Guards()
	while not UO.Dead()
    while UO.life < UO.str
    	UO.Msg("GuaRds")
    	wait(500)
	wend
	wend
end sub
######################################################################
sub GetBomb() 
		var Bomba = '0x0F0D' 
		uo.set('finddistance','3') 
	while not uo.Dead() 
    	uo.findtype( Bomba,-1,'ground') 
	if uo.getquantity( uo.getserial('finditem') )>0  then    
        uo.grab('0','finditem') 
    else 
        wait(100) 
	end if 
		wait(500) 
	wend 
end sub
#######################################################################
sub Reconnect() 
  var ReconnectTime, rFlag 

  ReconnectTime='0' 
  rFlag=1 

  repeat 
    while (uo.ObjAtLayer('Bpack')=='') 
      if rFlag then 
        ReconnectTime=Time() 
        rFlag=0 
      endif 
      wait(20000) 
      uo.Say('') 
      wait(3000) 
      uo.Say('') 
      wait(3000) 
      uo.Say('') 
      wait(3000) 
      uo.LDblClick(357,164) 
      uo.LClick(616,459) 
      wait(3000) 
    wend 
    wait(3000) 
    if (rFlag==0) and (ReconnectTime<>'0') then 
      uo.TextOpen() 
      uo.TextPrint(ReconnectTime+' | Потеря связи с сервером, повторное подсоединение') 
      rFlag=1 
      ReconnectTime='0' 
    endif 
  until false 
endsub # Reconnect 

########## 

sub Time() 
  var hh,mm,ss,hms,t=str(uo.Time()) 

  if len(t)<=2 then 
    hh="0" 
    mm="0" 
    ss=t 
  endif 

  if len(t)==3 then 
    hh="0" 
    mm=left(t,len(t)-2) 
    ss=right(t,len(t)-1) 
  end if 

  if len(t)==4 then 
    hh="0" 
    mm=left(t,len(t)-2) 
    ss=right(t,len(t)-2) 
  end if 

  if len(t)==5 then 
    hh=left(t,len(t)-4) 
    hms=left(t,len(t)-2) 
    mm=right(hms,len(hms)-1) 
    ss=right(t,len(t)-3) 
  end if 

  if len(t)==6 then 
    hh=left(t,len(t)-4) 
    hms=left(t,len(t)-2) 
    mm=right(hms,len(hms)-2) 
    ss=right(t,len(t)-4) 
  end if 

  return hh+":"+mm+":"+ss 
endsub # Time
######################################################################
sub Pok()
	while not uo.weight>=500
		UO.Buy("NSBlank")
	CheckLag()
		wait(1500)
	wend
end sub
################################################################
Scripts Writer
Posts: 2259
Joined: 2005-04-19 18:00:29
Location: Московская область
Contact:

Post by Scripts Writer »

а не слишком ли много вопросов за такое короткое время? -или у вас скилы качаются за час-другой, и уже нужен новый скрипт :-\
Scripts Writer
Posts: 2259
Joined: 2005-04-19 18:00:29
Location: Московская область
Contact:

Post by Scripts Writer »

Code: Select all

sub Inscript() 
     UO.FindType('0x1F40',-1,'backpack') ; ищет скролы Poison 
     if UO.GetQuantity('finditem')>0 then 
        Poison() 
     end if 

   VAR Blank = '0x0E34'          ; Тип бланк скролла 
      VAR Arrow = '0x1F40'         ; Тип скроллов Poison 
  
   If UO.Weight<500 then 
      UO.DeleteJournal() 
       UO.FindType('0x0E34',-1,'backpack') ; ищет бланк скролы 
     If UO.GetQuantity('finditem')>0 then 
         UO.AutoMenu( 'Spell Circles', 'Third Circle' ) 
         UO.AutoMenu( 'Spell Circle 3', 'Poison' ) 
         UO.UseType( Blank ) 
        CheckLag() 
        wait(500) 
          repeat ; ждет пока скрафтится скрол 
        until UO.InJournal('You fail to inscribe the scroll') or UO.InJournal('You put the') 
     if UO.InJournal('You fail to inscribe the scroll') then 
       Inscript() 
     end if 
      Poison();если не найдены бланк скролы 
   end if 
      Poison();если скрафтился Poison 
   end if 
      Home();если вес превышает 500 
end sub 

Скажи мне, зачем в скрипте с названием Inscript, стоит строка следующего содержания:

Code: Select all

Inscript()

:-\ у тебя как я понял инжа пытается выполнить 2 а то и все 3 функции одновременно.

Ты запускаешь Inscript(), а затем сразу же и Poison().

Если тебе нужно зациклить так зделай проще.

Code: Select all

while uo.life < 500
...
wend
или

Code: Select all

repeat
...
until not uo.Dead()
Mr. Gluk
Posts: 42
Joined: 2006-02-04 04:39:51
Contact:

Post by Mr. Gluk »

а не слишком ли много вопросов за такое короткое время? -или у вас скилы качаются за час-другой, и уже нужен новый скрипт :-\
А я максималист - хочу все и сразу 8)
Скажи мне, зачем в скрипте с названием Inscript, стоит строка следующего содержания:
В этом месте мне надо чтобы скрипт заново запускался(если сфизлилось) - все равно скрипт запускается один раз , пытался сделать через goto - вылетает ошибка
Ты запускаешь Inscript(), а затем сразу же и Poison().
ТУт согласен , чето намутил не то , а можешь и дальше проверить ?
Edred
Expert!
Posts: 2544
Joined: 2004-04-03 17:36:29
Location: Saint-Petersburg

Post by Edred »

В Home у тебя отсутствует endsub, соответственно при его вызове вылезают глюки.
Grin
Expert!
Posts: 2580
Joined: 2005-05-04 14:05:19
Location: Москва

Post by Grin »

Вывод: Писать скрипт и лепить - не одинакого полезно...
Sanata
Posts: 43
Joined: 2005-10-02 18:24:06
Contact:

Post by Sanata »

Grin wrote:Вывод: Писать скрипт и лепить - не одинакого полезно...
Я так не думаю :D

Постояно этим занемаюсь !
[b]:twisted: "Пока живут на свете дураки, обманывать нам, стало быть, с руки". :twisted:
[/b]
Не суди девушку по виду :)
Главное душа...

[url=http://imageshack.us][img]http://img150.imageshack.us/img150/5056/11yj1.jpg[/img][/url]
Mr. Gluk
Posts: 42
Joined: 2006-02-04 04:39:51
Contact:

Post by Mr. Gluk »

Немного переписал , но теперь выкидывает ошибку
Label defined outside proc - POIS
на 47 строке

Code: Select all

sub Train()
	uo.Exec('exec Pok')
	uo.Exec('exec Reconnect') 
	uo.Exec('exec Inscript')
    uo.Exec('exec Guards')
	uo.Exec('exec GetBomb')
	UO.DeleteJournal()
end sub

sub Inscript() 
 		inscript:
	UO.DeleteJournal()
      VAR Blank = '0x0E34'          ; Тип бланк скролла 
   	 
  	UO.FindType('0x1F40',-1,'backpack') ; ищет скролы Poison
  	if UO.GetQuantity('finditem')>0 then
  		goto pois
      end if

	
  
	If UO.Weight<500 then
		UO.DeleteJournal() 
    	UO.FindType('Blank',-1,'backpack') ; ищет бланк скролы
  	If UO.GetQuantity('finditem')>0 then
   		UO.AutoMenu( 'Spell Circles', 'Third Circle' ) 
   		UO.AutoMenu( 'Spell Circle 3', 'Poison' ) 
   		UO.UseType( Blank )
        CheckLag()
        wait(500)
       	repeat ; ждет пока скрафтится скрол
  		until UO.InJournal('You fail to inscribe the scroll') or UO.InJournal('You put the')
  	if UO.InJournal('You fail to inscribe the scroll') then
 		goto inscript
  	end if
	end if
	goto pois ;если скрафтился Poison
	end if
		goto home ;если вес превышает 500
end sub 
#####################################################################
 
		pois:
  		var k
  		UO.FindType('0x1F40',-1,'backpack') ;ищет Poison скрол
  	If UO.GetQuantity('finditem')>0 then
        UO.WaitTargetObject('self');  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!         47 СТРОКА !!!
        UO.UseObject('finditem')
  	else
        UO.Cast('Poison','self')
  	end if 
		CheckLag()
	while not UO.Mana<UO.INT
		wait(100)
	wend
	while UO.Mana<UO.INT
		UO.UseSkill('Meditation') 
      	CheckLag()
      	k=0 
    Repeat 
        k=k+1 
        Wait(100) 
  	Until UO.InJournal("You are") or UO.InJournal("You lose") or k>200 
      	UO.DeleteJournal() 
      	Wait(1000) 
    Wend 
	If not UO.Weight>500 then
		goto inscript ;запускаем все по новой
	else
		goto home
	end if

##########################################################
   home:
	if uo.Weight>500 then 
	if uo.Waiting() then 
		uo.CancelTarget() 
	end if 
		uo.Print('Go to Home') 
		uo.Exec('recall Runebook 21') 
		CheckLag()
		wait(10000) 
		DropOres() 
		wait(3000) 
		NS()
		uo.DeleteJournal() 
	if uo.Waiting() then 
		uo.CancelTarget() 
	end if 
		uo.Print('GO to Brit')
		uo.Exec('recall Runebook 33')
		CheckLag()
		wait(10000) 
		Pok()
		goto inscript
	end if
####################################################################
sub DropOres() 
		uo.DeleteJournal() 
	if uo.Waiting() then 
		uo.CancelTarget() 
	end if 
		var a, Exit 
		Var Cont='0x402E8C91'
		var UnloadChest='0x402E8C91' ## - ID сундука для сброса руды. 
		DIM Ore[1] 
		Ore[0]=0x0F88 ## - NS 
		Ore[1]=0x0E34 ## - Blank 
		uo.SetReceivingContainer(UnloadChest) 
		wait(500) 
		for a=0 to 1 
		exit=0 
	repeat 
		uo.FindType(Ore[a]) 
	if uo.GetQuantity('finditem')>0 then 
		uo.Grab('0','finditem') 
		CheckLag()
		wait(1500) 
	else 
		exit=1 
	end if 
	until Exit==1 
	next 
		uo.UnSetReceivingContainer() 
end sub 
#####################################################################
sub NS() 
		VAR sunduk='0x402E8C91' ;ID Сундука где реги
		uo.findtype('0x0F88','0x0000',sunduk) 
 	if uo.GetQuantity('finditem') then 
    	uo.moveitem('finditem',50,'backpack') 
  	end if 
		wait(500)
		CheckLag()
end sub

#####################################################################

#####################################################################

#####################################################################
sub CheckLag() 
		UO.DeleteJournal() 
  		UO.Click('backpack') 
  Repeat 
    	Wait(500) 
  Until UO.InJournal('backpack') 
end sub 
##################################################################### 
sub Guards()
	while not UO.Dead()
    while UO.life < UO.str
    	UO.Msg("GuaRds")
    	wait(500)
	wend
	wend
end sub
######################################################################
sub GetBomb() 
		var Bomba = '0x0F0D' 
		uo.set('finddistance','3') 
	while not uo.Dead() 
    	uo.findtype( Bomba,-1,'ground') 
	if uo.getquantity( uo.getserial('finditem') )>0  then    
        uo.grab('0','finditem') 
    else 
        wait(100) 
	end if 
		wait(500) 
	wend 
end sub
#######################################################################
sub Reconnect() 
  var ReconnectTime, rFlag 

  ReconnectTime='0' 
  rFlag=1 

  repeat 
    while (uo.ObjAtLayer('Bpack')=='') 
      if rFlag then 
        ReconnectTime=Time() 
        rFlag=0 
      endif 
      wait(20000) 
      uo.Say('') 
      wait(3000) 
      uo.Say('') 
      wait(3000) 
      uo.Say('') 
      wait(3000) 
      uo.LDblClick(357,164) 
      uo.LClick(616,459) 
      wait(3000) 
    wend 
    wait(3000) 
    if (rFlag==0) and (ReconnectTime<>'0') then 
      uo.TextOpen() 
      uo.TextPrint(ReconnectTime+' | Потеря связи с сервером, повторное подсоединение') 
      rFlag=1 
      ReconnectTime='0' 
    endif 
  until false 
endsub # Reconnect 

########## 

sub Time() 
  var hh,mm,ss,hms,t=str(uo.Time()) 

  if len(t)<=2 then 
    hh="0" 
    mm="0" 
    ss=t 
  end if 

  if len(t)==3 then 
    hh="0" 
    mm=left(t,len(t)-2) 
    ss=right(t,len(t)-1) 
  end if 

  if len(t)==4 then 
    hh="0" 
    mm=left(t,len(t)-2) 
    ss=right(t,len(t)-2) 
  end if 

  if len(t)==5 then 
    hh=left(t,len(t)-4) 
    hms=left(t,len(t)-2) 
    mm=right(hms,len(hms)-1) 
    ss=right(t,len(t)-3) 
  end if 

  if len(t)==6 then 
    hh=left(t,len(t)-4) 
    hms=left(t,len(t)-2) 
    mm=right(hms,len(hms)-2) 
    ss=right(t,len(t)-4) 
  end if 

  return hh+":"+mm+":"+ss 
end sub # Time
######################################################################
sub Pok()
	while not uo.weight>=500
		UO.Buy("NSBlank")
		wait(1500)
	wend
end sub
################################################################
Grin
Expert!
Posts: 2580
Joined: 2005-05-04 14:05:19
Location: Москва

Post by Grin »

Дядьк заканчивай скрипты клеить;) никчему хорошему не приведет...
Мало того что ты всем трафик скушал так и ошибку не видишь

Code: Select all

end sub 
##################################################################### 
  
      pois: 
        var k 
        UO.FindType('0x1F40',-1,'backpack') ;èùåò Poison ñêðîë 
     If UO.GetQuantity('finditem')>0 then 
        UO.WaitTargetObject('self');  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!         47 ÑÒÐÎÊÀ !!!
Тест ошибки что метка pois вне процедуры... я тоже процедуры тут не вижу... так что на парсер не нать а идти спать...
Kerja
Posts: 11
Joined: 2006-03-06 18:40:48

Post by Kerja »

ну и где конечный сцп? я уже хотел на ночь фигануть это дело
[img]http://img442.imageshack.us/img442/5559/dumayu24ju.gif[/img]
Kerja
Posts: 11
Joined: 2006-03-06 18:40:48

Post by Kerja »

Line 56: Function not found - CHECKLAG :x
[img]http://img442.imageshack.us/img442/5559/dumayu24ju.gif[/img]
Kerja
Posts: 11
Joined: 2006-03-06 18:40:48

Post by Kerja »

вот модернизировал этот скрипт, найдите ошибку: он не ждёт пока скастауется скролл, и не повторяется. так же не хочет делать скролл самостоятельно :(

Code: Select all

sub Train() 
   uo.Exec('exec Inscript')    
   UO.DeleteJournal() 
end sub 

sub Inscript() 
       inscript: 
   UO.DeleteJournal() 
      VAR Blank = '0x0E34'          ; Òèï áëàíê ñêðîëëà 
       
     UO.FindType('0x1F40',-1,'backpack') ; èùåò ñêðîëû Poison 
     if UO.GetQuantity('finditem')>0 then 
        goto pois 
      end if 

    
  
   If UO.Weight<500 then 
      UO.DeleteJournal() 
       UO.FindType('Blank',-1,'backpack') ; èùåò áëàíê ñêðîëû 
     If UO.GetQuantity('finditem')>0 then 
         UO.UseType( Blank )
         Uo.lclick(491,454)
        CheckLag() 
        wait(500) 
          repeat ;
        until UO.InJournal('You fail to inscribe the scroll') or UO.InJournal('You put the') 
     if UO.InJournal('You fail to inscribe the scroll') then 
       goto inscript 
     end if 
   end if 
   goto pois ;åñëè ñêðàôòèëñÿ Poison 
   end if 
   end sub 
##################################################################### 
  
      ;pois: 
        var k 
        UO.FindType('0x1F40',-1,'backpack') ;èùåò Poison ñêðîë 
     If UO.GetQuantity('finditem')>0 then 
        UO.WaitTargetObject('self');
        UO.UseObject('finditem') 
     end if 
      
   while not UO.Mana<UO.INT 
      wait(100) 
   wend 
   while UO.Mana<UO.INT 
      UO.UseSkill('Meditation') 
         k=0 
    Repeat 
        k=k+1 
        Wait(100) 
     Until UO.InJournal("You are") or UO.InJournal("You lose") or k>200 
         UO.DeleteJournal() 
         Wait(1000) 
    Wend 
   If not UO.Weight>500 then 
      goto inscript 
   else 
      goto home 
   end if 

##################################################################### 
sub CheckLag() 
      UO.DeleteJournal() 
        UO.Click('backpack') 
  Repeat 
       Wait(500) 
  Until UO.InJournal('backpack') 
end sub 

[img]http://img442.imageshack.us/img442/5559/dumayu24ju.gif[/img]
Grin
Expert!
Posts: 2580
Joined: 2005-05-04 14:05:19
Location: Москва

Post by Grin »

на форуме полно работо способных скриптов такого плана...
в этом скрите ошибка на ошибке
Edred
Expert!
Posts: 2544
Joined: 2004-04-03 17:36:29
Location: Saint-Petersburg

Post by Edred »

Склеиванием скрипта из кусков разных других скриптов можно заниматься, когда умеешь хорошо писать скрипты и точно понимаешь, что склеиваешь. Я сам часто перекидываю куски своих скриптов из одного в другой для экономии времени.

А если плохо понимаешь что делаешь - пиши скрипт сам. Сначала напиши себе алгоритм, что в каком порядке и как должен делать скрипт. Прочитай уроки. Потом начинай писать скрипт последовательно, по своему алгоритму. Какие вопросы - кидай, тебе ответят всегда. Тем кто хочет писать скрипты сам, а не просто ищет халявки - помогают всегда.
Post Reply