Yoko

All sides of Injection
It is currently 2024-04-16 23:40:34

All times are UTC+02:00




Post new topic  Reply to topic  [ 38 posts ]  Go to page 1 2 Next
Author Message
PostPosted: 2005-08-09 15:02:35 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Привет всем! :)

Решился тут выложить кое-что из своего творчества. Может, кому и пригодится, полностью или частично - буду рад в таком случае. Настраивал скрипты под себя, поэтому не судите строго, если что не понравится.

Кое-какие скрипты являются переделками из публиковавшихся здесь или в других местах. В таких случаях я старался указывать авторство оригинала. И естественно, авторам этих оригиналов огромное спасибо!

Ессно, серьезные вещи типа автоскупки или копания по краям гор публиковать тут не буду :)

Все писалось и использовалось на шарде DRW.
Скрипты могут периодически исправляться, изменяться и дополняться (в зависимости от наличия у меня идей, желания писать, сил и времени) - в таком случае постараюсь выкладывать обновления.

  1. Training (18 разных скиллов)
  2. Fishing
  3. Blacksmithing
  4. Inscription full
  5. Alchemy full
  6. Make Full & Heater (auto)


Last edited by Corwin on 2005-09-17 19:09:47, edited 7 times in total.

Top
   
 Post subject:
PostPosted: 2005-08-09 15:08:00 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Прокачка 18-ти разных скиллов.

Собственно, первый блин (на форуме, а не в плане написания скриптов). :)
Писалось в течение пары месяцев, по мере собственной прокачки.
Настройка скрипта производится изменением глобальных переменных. В комментариях к переменным описаны все нюансы.

Несколько кусков скрипта взяты готовыми у других людей из открытых источников (например, Reconnector отсюда), за что их авторам огромное спасибо! Надеюсь, не нарушил ничьих прав. :)

Code:
############################################################################################
###                                                                                      ###
###                                Training / Тренировка                                 ###
###                                     Версия 5.93                                      ###
###                                  Шард Dragon World                                   ###
###                                                                                      ###
###                                    Автор  Corwin                                     ###
###                                                                                      ###
###                             Тестирование  Euronimus                                  ###
###                                           Lizard King                                ###
###                                                                                      ###
############################################################################################

############################################################################################
### Глобальные переменные ###
#############################

  Var UseMagery = 0                 ## 1 - Включить тренировку скилла Magery
                                    ## Необходимо наличие в рюкзаке реагента (Nightshade)

                                    ## Важно: все остальные скиллы, прокачка которых включена в
                                    ## переменных, будут качаться только после того, как в рюкзаке
                                    ## закончится реагент для прокачки магии

  Var UseAnatomy = 0                ## 1 - Включить тренировку скилла Anatomy

  Var UseEvaluatingIntelligence = 0 ## 1 - Включить тренировку скилла Evaluating Intelligence

  Var UseArmsLore = 0               ## 1 - Включить тренировку скилла Arms Lore
                                    ## Необходимо наличие в рюкзаке любого предмета

  Var UseItemID = 0                 ## 1 - Включить тренировку скилла Item Identification
                                    ## Необходимо наличие в рюкзаке любого предмета

  Var UseTasteID = 0                ## 1 - Включить тренировку скилла Taste Identification
                                    ## Необходимо наличие в рюкзаке еды

  Var UseSpiritSpeak = 0            ## 1 - Включить тренировку скилла Spirit Speak

  Var UseAnimalLore = 0             ## 1 - Включить тренировку скилла Animal Lore

  Var UseDetectHidden = 0           ## 1 - Включить тренировку скилла Detect Hidden

  Var UseBegging = 0                ## 1 - Включить тренировку скилла Begging

  Var UsePeacemaking = 0            ## 1 - Включить тренировку скиллов Peacemaking и Musicianship
                                    ## Необходимо наличие в рюкзаке музыкального инструмента

  Var UseEnticement = 0             ## 1 - Включить тренировку скилла Enticement
                                    ## Необходимо наличие в рюкзаке музыкального инструмента

  Var UseHealMeditation = 0         ## 1 - Включить тренировку скиллов Healing и Meditaion
                                    ## Необходимо наличие в рюкзаке бинтов, тарелки с водой и проклятой вещи

  Var UseVeterinary = 0             ## 1 - Включить тренировку скилла Veterinary
                                    ## Необходимо наличие в рюкзаке бинтов, тарелки с водой, проклятой вещи
                                    ## и реагентов для полиморфа (Blood Moss, Mandrake Root, Spider's Silk).
                                    ## Одновременная тренировка скилла Veterinary и скиллов Heal и Meditation
                                    ## невозможна!!!

  Var UseTracking = 0               ## 1 - Включить тренировку скилла Tracking

  Var UseSnooping = 0               ## 1 - Включить тренировку скилла Snooping. Рядом должен стоять чар, в рюкзак
                                    ## которого будем смотреть, и его окно должно быть открыто для выбора рюкзака.

  Var UseStealing = 1               ## 1 - Включить тренировку скилла Stealing. Рядом должен стоять чар, из рюкзака
                                    ## которого будем таскать монеты, окно чара должно быть открыто для выбора рюкзака.
                                    ## Имеет два режима, режим задается переменной StealingMode

  Var StealingMode = 1              ## Выбор режима используется только при включенной тренировке скилла Stealing.
                                    ## 1 - Использовать таскание предмета из рюкзака партнера, тем самым тренируя скилл
                                    ## Stealing. 0 - подбирать утащенные тренирующимся партнером предметы с земли.

  Var StealingItem = 0              ## Выбор предмета используется только при включенной тренировке скилла Stealing
                                    ## и в режиме StealingMode = 1.
                                    ## StealingItem = 0 - таскать монеты. StealingItem = 1 - таскать пустые колбочки.

  Var UseEating = 1                 ## 1 - Включить поедание пищи раз в полчаса

  Var GuardZone = 0                 ## 1 - Территория, где происходит тренировка, охраняется. В этом случае чар
                                    ## будет звать охрану, если в результате нападения на него уменьшится его
                                    ## здоровье.

#####

  Var UseReconnect = 0              ## 1 - Использовать переподсоединение к сфере в случае разрыва связи.

  Var tim1, tim2                    ## служебные переменные

############################################################################################
### Код скрипта ###
###################

sub Train()

  SetObjects()

  if UseReconnect == 1 then
    uo.Exec('exec Reconnect')
  endif

  if UseMagery == 1 then
    TrainMagery()
  endif

  tim1=UO.Timer()
  tim2=UO.Timer()

  Repeat

    if ((UO.Timer()-tim1) > 18000) and (UseEating == 1) then
      Eat()
      tim1=UO.Timer()
    endif

    if (UseHealMeditation == 0) and (UseVeterinary == 0) then
      if (UseAnatomy == 1) and (uo.SkillVal('Anatomy',1)<1000) then
        TrainAnatomy()
      endif

      if (UseEvaluatingIntelligence == 1) and (uo.SkillVal('Evaluate Intelligence',1)<1000) then
        TrainEvaluatingIntelligence()
      endif

      if (UO.Timer()-tim2>1200) and (UseSpiritSpeak == 1) and (uo.SkillVal('Spirit Speak',1)<1000) then
        TrainSpiritSpeak()
      endif

      if (UseBegging == 1) and (uo.SkillVal('Begging',1)<1000) then
        TrainBegging()
      endif

      if (UseTracking == 1) and (uo.SkillVal('Tracking',1)<1000) then
        TrainTracking()
      endif

      if (UsePeacemaking == 1) and ((uo.SkillVal('Peacemaking',1)<1000) or (uo.SkillVal('Musicianship',1)<1000)) then
        TrainPeacemaking()
      endif

      if (UseEnticement == 1) and (uo.SkillVal('Enticement',1)<1000) then
        TrainEnticement()
      endif

      if (UseArmsLore == 1) and (uo.SkillVal('Arms Lore',1)<1000) then
        TrainArmsLore()
      endif

      if (UseItemID == 1) and (uo.SkillVal('Item ID',1)<1000) then
        TrainItemID()
      endif

      if (UseTasteID == 1) and (uo.SkillVal('Taste Identification',1)<1000) then
        TrainTasteID()
      endif

      if (UseAnimalLore == 1) and (uo.SkillVal('Animal Lore',1)<1000) then
        TrainAnimalLore()
      endif

      if (UseDetectHidden == 1) and (uo.SkillVal('Detect Hidden',1)<1000) then
        TrainDetectHidden()
      endif

      if (UseSnooping == 1) and (uo.SkillVal('Snooping',1)<1000) then
        TrainSnooping()
      endif

      if (UseStealing == 1) and (uo.SkillVal('Stealing',1)<1000) then
        TrainStealing(StealingMode)
      endif
    endif

    if (UseHealMeditation == 1) and ((uo.SkillVal('Healing',1)<1000) or (uo.SkillVal('Meditation',1)<1000)) and (UseVeterinary == 0) then
      TrainHealMeditation()
    endif

    if (UseVeterinary == 1) and (uo.SkillVal('Veterinary',1)<1000) and (UseHealMeditation == 0) then
      TrainVeterinary()
    endif

    UO.DeleteJournal()
  Until UO.Dead()

endsub # Train

############################################################################################
### Процедуры поддержки ###
###########################

sub SetObjects()

  if (UseAnatomy == 1) or (UseEvaluatingIntelligence == 1) or (UseAnimalLore == 1) or (UseBegging == 1) then
    UO.Print('Выбери NPC: ')
    UO.Exec('addobject NPC')
    While UO.Targeting()
      Wait(100)
    Wend
  endif
  if (UseArmsLore == 1) or (UseItemID == 1) then
    UO.Print('Выбери предмет: ')
    UO.Exec('addobject Object')
    While UO.Targeting()
      Wait(100)
    Wend
  endif
  if (UseHealMeditation == 1) or (UseVeterinary == 1) then
    UO.Print('Выбери курсу: ')
    UO.Exec('addobject Curse')
    While UO.Targeting()
      Wait(100)
    Wend
  endif
  if (UseSnooping == 1) or ((UseStealing == 1) and (StealingMode == 1)) then
    UO.Print('Выбери чужой рюкзак: ')
    UO.Exec('addobject Backpack')
    While UO.Targeting()
      Wait(100)
    Wend
  endif
  if (UseTasteID == 1) or (UseEating ==1) then
    UO.Print('Выбери еду: ')
    UO.Exec('addobject Food')
    While UO.Targeting()
      Wait(100)
    Wend
  endif

endsub # SetObjects

##########

sub TrainMagery()
  var tim, k, flag

  tim=UO.Timer()
  flag=false

  While not flag
    UO.DeleteJournal()
    if ((UO.Timer()-tim) > 18000) and (UseEating == 1) then
      Eat()
      tim=UO.Timer()
    endif

    While not ((UO.Mana<70) or flag)
      CheckLag()
      UO.Cast('Poison','self')
      MyWait(500)
      if UO.InJournal('lack') then
        CheckLag()
        UO.Cast('Poison','self')
        MyWait(500)
        if UO.InJournal('lack') then
          flag=true
          uo.Print("1")
        endif
      endif
      MyWait(2000)
    Wend

    CheckLag()

    While UO.Mana<UO.INT
      UO.UseSkill('Meditation')
      k=0
      Repeat
        k=k+1
        MyWait(100)
      Until UO.InJournal("You are") or UO.InJournal("You lose") or k>200
      UO.DeleteJournal()
      MyWait(1000)
    Wend
  Wend

  CheckLag()
endsub # TrainMagery

##########

sub TrainHealMeditation()
  var Life, Mana, dLife, dMana, k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  Life=uo.Str
  Mana=uo.Int
  uo.UseObject('Curse')
  repeat
    if (UseAnatomy == 1) and (uo.SkillVal('Anatomy',1)<1000) then
      TrainAnatomy()
    endif
    if (UseEvaluatingIntelligence == 1) and (uo.SkillVal('Evaluate Intelligence',1)<1000) then
      TrainEvaluatingIntelligence()
    endif
    if (UO.Timer()-tim2>1200) and (UseSpiritSpeak==1) and (uo.SkillVal('Spirit Speak',1)<1000) then
      TrainSpiritSpeak()
    endif
    if (UseBegging == 1) and (uo.SkillVal('Begging',1)<1000) then
      TrainBegging()
    endif
    if (UseTracking == 1) and (uo.SkillVal('Tracking',1)<1000) then
      TrainTracking()
    endif
    if (UsePeacemaking == 1) and ((uo.SkillVal('Peacemaking',1)<1000) or (uo.SkillVal('Musicianship',1)<1000)) then
      TrainPeacemaking()
    endif
    if (UseEnticement == 1) and (uo.SkillVal('Enticement',1)<1000) then
      TrainEnticement()
    endif
    if (UseArmsLore == 1) and (uo.SkillVal('Arms Lore',1)<1000) then
      TrainArmsLore()
    endif
    if (UseItemID == 1) and (uo.SkillVal('Item ID',1)<1000) then
      TrainItemID()
    endif
    if (UseTasteID == 1) and (uo.SkillVal('Taste Identification',1)<1000) then
      TrainTasteID()
    endif
    if (UseAnimalLore == 1) and (uo.SkillVal('Animal Lore',1)<1000) then
      TrainAnimalLore()
    endif
    if (UseDetectHidden == 1) and (uo.SkillVal('Detect Hidden',1)<1000) then
      TrainDetectHidden()
    endif
    if (UseSnooping == 1) and (uo.SkillVal('Snooping',1)<1000) then
      TrainSnooping()
    endif
    if (UseStealing == 1) and (uo.SkillVal('Stealing',1)<1000) then
      TrainStealing(StealingMode)
    endif
    MyWait(100)
    if (uo.SkillVal('Meditation',1)>=1000) and (uo.SkillVal('Healing',1)<1000) then
      dLife=1
      dMana=0
    else
      if (uo.SkillVal('Meditation',1)<1000) and (uo.SkillVal('Healing',1)>=1000) then
        dLife=0
        dMana=1
      else
        dLife=2
        dMana=2
      endif
    endif
  until ((Life-uo.Life)>=dLife) and ((Mana-uo.Mana)>=dMana)
  CheckLag()
  uo.SetReceivingContainer(uo.GetSerial('backpack'))
  uo.Grab('0','Curse')
  uo.UnSetReceivingContainer(uo.GetSerial('backpack'))
  MyWait(500)

  while (UO.Mana<Mana) and (uo.SkillVal('Meditation',1)<1000)
    CheckLag()
    UO.UseSkill('Meditation')
    k=0
    repeat
      Wait(100)
      k=k+1
    until UO.InJournal("You are") or UO.InJournal("You lose") or k>200
    UO.DeleteJournal()
  wend

  while (UO.Life<Life) and (uo.SkillVal('Healing',1)<1000)
    CheckLag()
    uo.BandageSelf()
    k=0
    repeat
      Wait(100)
      k=k+1
    until UO.InJournal("You put") or UO.InJournal("barely help") or UO.InJournal("don't need") or k>300
  wend

  UO.FindType('0x0E21','0x0000','backpack')
  if UO.GetQuantity('finditem')<50 Then
    UO.FindType('0x0E20','0x0000','backpack')
    UO.WaitTargetType('0x1008')
    UO.UseObject('finditem')
    MyWait(1000)
  endif
endsub # TrainHealMeditation

##########

sub TrainVeterinary()
  var k, Life, dLife=1

  if uo.Str<=200 then
    repeat
      Eat()
      CheckLag()
      uo.WaitMenu('What do you want to polymorph', 'Daemon')
      uo.Cast('Polymorph')
      MyWait(10000)
      if UO.InJournal('lack') then
        While UO.Mana<UO.INT
          UO.UseSkill('Meditation')
          k=0
          Repeat
            k=k+1
            MyWait(100)
          Until UO.InJournal("You are") or UO.InJournal("You lose") or k>200
          UO.DeleteJournal()
          MyWait(1000)
        Wend
      endif
    until uo.Str>200
  endif

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  Life=uo.Str

  uo.UseObject('Curse')
  repeat
    if (UseAnatomy == 1) and (uo.SkillVal('Anatomy',1)<1000) then
      TrainAnatomy()
    endif
    if (UseEvaluatingIntelligence == 1) and (uo.SkillVal('Evaluate Intelligence',1)<1000) then
      TrainEvaluatingIntelligence()
    endif
    if (UO.Timer()-tim2>1200) and (UseSpiritSpeak==1) and (uo.SkillVal('Spirit Speak',1)<1000) then
      TrainSpiritSpeak()
    endif
    if (UseBegging==1) and (uo.SkillVal('Begging',1)<1000) then
      TrainBegging()
    endif
    if (UseTracking==1) and (uo.SkillVal('Tracking',1)<1000) then
      TrainTracking()
    endif
    if (UsePeacemaking == 1) and ((uo.SkillVal('Peacemaking',1)<1000) or (uo.SkillVal('Musicianship',1)<1000)) then
      TrainPeacemaking()
    endif
    if (UseEnticement == 1) and (uo.SkillVal('Enticement',1)<1000) then
      TrainEnticement()
    endif
    if (UseArmsLore == 1) and (uo.SkillVal('Arms Lore',1)<1000) then
      TrainArmsLore()
    endif
    if (UseItemID == 1) and (uo.SkillVal('Item ID',1)<1000) then
      TrainItemID()
    endif
    if (UseTasteID == 1) and (uo.SkillVal('Taste Identification',1)<1000) then
      TrainTasteID()
    endif
    if (UseAnimalLore == 1) and (uo.SkillVal('Animal Lore',1)<1000) then
      TrainAnimalLore()
    endif
    if (UseDetectHidden == 1) and (uo.SkillVal('Detect Hidden',1)<1000) then
      TrainDetectHidden()
    endif
    if (UseSnooping == 1) and (uo.SkillVal('Snooping',1)<1000) then
      TrainSnooping()
    endif
    if (UseStealing == 1) and (uo.SkillVal('Stealing',1)<1000) then
      TrainStealing(StealingMode)
    endif
    MyWait(100)
  until (Life-uo.Life)>=dLife
  CheckLag()
  uo.SetReceivingContainer(uo.GetSerial('backpack'))
  uo.Grab('0','Curse')
  uo.UnSetReceivingContainer(uo.GetSerial('backpack'))
  MyWait(500)

  while (UO.Life<uo.Str) and (uo.SkillVal('Veterinary',1)<1000)
    CheckLag()
    uo.BandageSelf()
    k=0
    repeat
      Wait(100)
      k=k+1
    until UO.InJournal("You put") or UO.InJournal("barely help") or UO.InJournal("don't need") or k>300
  wend

  UO.FindType('0x0E21','0x0000','backpack')
  if UO.GetQuantity('finditem')<50 Then
    UO.FindType('0x0E20','0x0000','backpack')
    UO.WaitTargetType('0x1008')
    UO.UseObject('finditem')
    MyWait(1000)
  endif
endsub # TrainVeterinary

##########

sub TrainBegging()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  CheckLag()
  UO.WaitTargetObject("NPC")
  UO.UseSkill('Begging')
  MyWait(3000)
endsub # TrainBegging

##########

sub TrainSnooping()
  var k

  Repeat
    if UO.Waiting() then
      UO.CancelTarget()
    endif
    UO.DeleteJournal()
    CheckLag()
    UO.UseObject('Backpack')
    MyWait(300)
    k=0
    Repeat
      MyWait(100)
      k=k+1
    Until UO.InJournal("You fail") or UO.InJournal("You have lost") or k>30
  Until not UO.InJournal("You fail")

endsub # TrainSnooping

##########

sub TrainStealing(mode)
  var k

  if mode == 1 then
    UO.DeleteJournal()
    CheckLag()
    if StealingItem == 0 then
      uo.FindType('0x0EED',0x0000,'Backpack')
    else
      uo.FindType('0x0F0E',0x0000,'Backpack')
    endif
    MyWait(200)
    if uo.GetQuantity('finditem')>0 then
      uo.UseSkill('Stealing','finditem')
      k=0
      Repeat
        MyWait(500)
        if StealingItem == 0 then
          uo.FindType('0x0EED',0x0000,uo.GetSerial('backpack'))
        else
          uo.FindType('0x0F0E',0x0000,uo.GetSerial('backpack'))
        endif
        k=k+1
      Until UO.InJournal("You fail") or UO.GetQuantity('finditem')>0 or k>7
      MyWait(500)
      if UO.GetQuantity('finditem')>0 then
        uo.DropHere('finditem')
        MyWait(500)
      endif
    else
      if StealingItem == 0 then
        uo.FindType('0x0EED',0x0000,uo.GetSerial('backpack'))
      else
        uo.FindType('0x0F0E',0x0000,uo.GetSerial('backpack'))
      endif
      if UO.GetQuantity('finditem')>0 then
        uo.DropHere('finditem')
        MyWait(500)
      endif
      if UseSnooping == 1 then
        TrainSnooping()
      endif
    endif
  else
    UO.DeleteJournal()
    CheckLag()
    UO.findtype('0x0EED','0x0000','ground')
    MyWait(200)
    if uo.GetQuantity('finditem')>0 then
      UO.Grab('All','finditem')
      MyWait(500)
    endif
    CheckLag()
    UO.findtype('0x0F0E','0x0000','ground')
    MyWait(200)
    if uo.GetQuantity('finditem')>0 then
      UO.Grab('All','finditem')
      MyWait(500)
    endif
  endif

endsub # TrainStealing

##########

sub TrainTracking()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  CheckLag()
  uo.WaitMenu('Tracking','Animals')
  UO.UseSkill('Tracking')
  MyWait(1000)
  uo.RClick(50,50)
endsub # TrainBegging

##########

sub TrainDetectHidden()
  var k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  UO.UseSkill('Detect Hidden')
  MyWait(300)
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You can see") or UO.InJournal("You see") or k>30
  MyWait(3000)
endsub # TrainDetectHidden

##########

sub TrainAnimalLore()
  var k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  UO.WaitTargetObject("NPC")
  MyWait(100)
  UO.UseSkill('Animal Lore')
  MyWait(300)
  If UO.InJournal("You can't see the target") Then
    if UO.Waiting() then
      UO.CancelTarget()
    endif
    UO.WaitTargetSelf()
    MyWait(100)
    UO.UseSkill('Animal Lore')
  Endif
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You can't think") or UO.InJournal("own master") or k>30
  MyWait(3000)
endsub # TrainAnimalLore

##########

sub TrainTasteID()
  var k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  UO.WaitTargetObject("Food")
  MyWait(100)
  UO.UseSkill('Taste Identification')
  MyWait(300)
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You cannot discern") or UO.InJournal("It tastes") or k>50
  MyWait(3000)
endsub # TrainTasteID

##########

sub TrainItemID()
  var k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  UO.WaitTargetObject("Object")
  MyWait(100)
  UO.UseSkill('Item Identification')
  MyWait(300)
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You can't think") or UO.InJournal("You estimate") or k>50
  MyWait(3000)
endsub # TrainItemID

##########

sub TrainAnatomy()
  var k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  UO.WaitTargetObject("NPC")
  MyWait(100)
  UO.UseSkill('Anatomy')
  MyWait(300)
  if UO.InJournal("You can't see the target") Then
    if UO.Waiting() then
      UO.CancelTarget()
    endif
    UO.WaitTargetSelf()
    MyWait(100)
    UO.UseSkill('Anatomy')
  endif
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You can't think") or UO.InJournal("looks") or k>30
  MyWait(3000)
endsub # TrainAnatomy

##########

sub TrainPeacemaking()
  UO.DeleteJournal()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  CheckLag()
  UO.UseSkill('Peacemaking')
  MyWait(6000)
endsub # TrainPeacemaking

##########

sub TrainEnticement()
  UO.DeleteJournal()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  CheckLag()
  UO.WaitTargetObject("NPC")
  MyWait(100)
  UO.UseSkill('Enticement')
  MyWait(5000)
endsub # TrainPeacemaking

##########

sub TrainArmsLore()
  var k

  CheckLag()
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  UO.WaitTargetObject("Object")
  MyWait(100)
  UO.UseSkill('Arms Lore')
  MyWait(300)
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("this item") or UO.InJournal("This item") or k>50
  MyWait(3000)
endsub # TrainArmsLore

##########

sub TrainEvaluatingIntelligence()
  var k

  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  CheckLag()
  UO.WaitTargetObject('NPC')
  UO.UseSkill('Evaluating Intelligence')
  MyWait(300)
  If UO.InJournal("You can't see the target") Then
    if UO.Waiting() then
      UO.CancelTarget()
    endif
    UO.WaitTargetSelf()
    CheckLag()
    UO.UseSkill('Evaluating Intelligence')
  Endif
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You cannot seem") or UO.InJournal("looks") or UO.InJournal("unsure") or UO.InJournal("perform") or k>60
  MyWait(4000)
endsub # TrainEvaluatingIntelligence

##########

sub TrainSpiritSpeak()
  var k

  if UO.Waiting() then
    UO.CancelTarget()
  endif
  UO.DeleteJournal()
  CheckLag()
  UO.UseSkill('Spirit Speak')
  MyWait(300)
  k=0
  Repeat
    MyWait(100)
    k=k+1
  Until UO.InJournal("You fail") or UO.InJournal("You establish") or k>30
  MyWait(3000)
  tim2=UO.Timer()
endsub # TrainSpiritSpeak

##########

sub CheckLag()

  UO.DeleteJournal()
  UO.Click('backpack')
  Repeat
    Wait(500)
  Until UO.InJournal('backpack')

endsub # CheckLag

##########

sub Eat()
  var ttt, flag

  CheckLag()
  ttt=UO.Timer()
  flag=false
  while not (UO.InJournal("You are stuffed!") or UO.InJournal("to eat any") or UO.InJournal("No item found.") or UO.InJournal("a way to use that") or flag)
    UO.Exec("useobject 'Food'")
    if (UO.Timer()-ttt>150) then
      flag=true
    endif
    Wait(500)
  wend

endsub # Eat

##########

sub MyWait(time)
  var i, i1, count

  if (GuardZone == 1) then
    count = time/100
    i1 = 1
    for i = 1 to count
      if (i-i1)>=10 then
        i1 = i
      endif
      if (UO.life < UO.str) and ((i-i1) == 0) then
        UO.Say("Guards !!!")
      endif
      Wait(100)
    next
  else
    wait(time)
  endif
endsub # MyWait

##########

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)
  endif

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

  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)
  endif

  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)
  endif

  return hh+":"+mm+":"+ss
endsub # Time


Top
   
 Post subject:
PostPosted: 2005-08-09 15:52:20 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Fishing

Работает по трем ранее замаркированным рунам.

ЗЫ: Есть вариант с использованием трех рунбуков - выложу его чуть позже.

Code:
############################################################################################
###                                                                                      ###
###                                Fishing / Рыболовство                                 ###
###                                     Версия 2.50                                      ###
###                                  Шард Dragon World                                   ###
###                                                                                      ###
###                                    Автор  Corwin                                     ###
###                                                                                      ###
###                     Оригинальный скрипт,  Fishing v1.9 (cOoler)                      ###
###                 взятый в качестве основы                                             ###
###                                                                                      ###
############################################################################################

############################################################################################
### Глобальные переменные ###
#############################

var TryToHide=1        ## 1 - Включить уход (перед ловлей) в хайд, 0 - выключить.

var TakeFish=1         ## 1 - Включить сбор обычной рыбы, 0 - выключить.

var TakeMaps=1         ## 1 - Включить сбор карт, 0 - выключить.

var TakeRareFish=1     ## 1 - Включить сбор редкой рыбы, 0 - выключить.

var TakePrizeFish=1    ## 1 - Включить сбор призовой рыбы, 0 - выключить.

var DoEating=1         ## 1 - Включить потребление еды при визите домой, 0 - отключить.

var DoApproaching=0    ## 1 - Включить подход к сундуку для сброса добычи, 0 - отключить.
                       ## !!!Настраивал для себя, своего дома и открывания своих дверей!!!

var Reconnect=0        ## 1 - Включить реконнект на сервер, если выкинет, 0 - отключить реконнект.

var RuneToHome=1       ## Номер руны домой в рунбуке №1 (от 1 до 9).

var MaxWeight=740      ## Максимальный вес в рюкзаке.

var FoodType='0x097B'  ## Тип еды, которую будем есть (fish steaks).

var Chest='0x4002A182' ## ID сундука для сброса добычи.

############################################################################################
### Код скрипта ###
###################

sub Fishing()
var mX, mY, mZ, i, j
var NextRune=2

  uo.Print('Выбери контейнер:')
  uo.Exec('addobject Bag')
  while uo.Targeting()
    wait(100)
  wend

  uo.Print('Выберите удочку:')
  uo.Exec('addobject FishPole')
  while uo.Targeting()
    wait(100)
  wend

  uo.Print('Выберите рунбук: ')
  uo.Exec('addobject Runebook')
  while uo.Targeting()
    wait(100)
  wend

  uo.Print('Выберите руну к воде №1:')
  uo.Exec('addobject RuneFish1')
  while uo.Targeting()
    wait(100)
  wend

  uo.Print('Выберите руну к воде №2:')
  uo.Exec('addobject RuneFish2')
  while uo.Targeting()
    wait(100)
  wend

  uo.Print('Выберите руну к воде №3:')
  uo.Exec('addobject RuneFish3')
  while uo.Targeting()
    wait(100)
  wend

  if Reconnect==1 then
    uo.Exec('exec Reconnect')
  endif

  wait(1000)
  RecallFishing(1)
  wait(1000)

  while not uo.Dead()
    uo.Set('finddistance','4')
    mX = uo.getX("self")
    mY = uo.getY("self")
    mZ = uo.getZ("self")
    uo.DeleteJournal()
    for i = mX-6 to mX+6
      for j = mY-6 to mY+6
        if uo.Dead() then
          return
        endif

        if TryToHide==1 then
          ToHide()
        endif

        uo.DeleteJournal()

        uo.Print("Сейчас ловим в координатах: "+str(mx-i)+" "+str(my-j))
        while not uo.InJournal("no fish here") and not uo.InJournal("location") and not uo.InJournal("far away") and not uo.InJournal("in water")
          uo.DeleteJournal()
          CheckLag()
          uo.WaitTargetTile("1341", str(i), str(j), str(mZ))
          uo.UseObject("FishPole")
          if uo.Dead() then
            return
          endif
          while not uo.InJournal("You pull") and not uo.InJournal("location") and not uo.InJournal("no fish") and not uo.InJournal("but fail") and not uo.InJournal("far away") and not uo.InJournal("in water")
            wait (100)
            if uo.InJournal("You pull") then
              TakeFishMaps()
            endif
          wend
          if uo.Weight>MaxWeight then
            wait(1000)
            RunebookRecall(RuneToHome)
            if DoApproaching == 1 then
              Approaching()
            endif
            uo.TextOpen()
            uo.TextPrint(Time()+" | Визит домой, сброс рыбы и карт")
            wait(1000)
            DropFish()
            wait(1000)
            if DoEating==1 then
              CheckLag()
              Eating()
            endif
            wait(1000)
            if NextRune==1 then
              RecallFishing(3)
            endif
            if NextRune==2 then
              RecallFishing(1)
            endif
            if NextRune==3 then
              RecallFishing(2)
            endif
            wait(1000)
          endif
        wend
      next
    next

    if NextRune==1 then
      RecallFishing(1)
      NextRune=2
    else
      if NextRune==2 then
        RecallFishing(2)
        NextRune=3
      else
        if NextRune==3 then
          RecallFishing(3)
          NextRune=1
        endif
      endif
    endif
  wend

endsub # Fishing

############################################################################################
### Процедуры поддержки ###
###########################

sub TakeFishMaps()

var f

dim Fish[6]
Fish[0]=0x09CC
Fish[1]=0x09CD
Fish[2]=0x09CE
Fish[3]=0x09CF
Fish[4]=0x0DD6
Fish[5]=0x0DD6
Fish[6]=0x14EB

  CheckLag()
  if TakeFish==1 then
    uo.Print('Собираем рыбу.')
    for f=0 to 3
      uo.FindType(Fish[f],"-1","ground")
      uo.MoveItem("finditem","1","Bag")
      wait(200)
    next
  endif

  CheckLag()
  if TakeRareFish==1 then
    uo.Print('Собираем редкую рыбу.')
    uo.FindType(Fish[4],"-1","ground")
    uo.MoveItem("finditem","-1","Bag")
    wait(200)
  endif

  CheckLag()
  if TakePrizeFish==1 then
    uo.Print('Собираем призовую рыбу.')
    uo.FindType(Fish[5],"-1","ground")
    uo.MoveItem("finditem","-1","Bag")
    wait(200)
  endif

  CheckLag()
  if TakeMaps==1 then
    uo.Print('Собираем карты.')
    uo.FindType(Fish[6],"-1","ground")
    uo.MoveItem("finditem","-1","Bag")
    wait(200)
  endif

endsub # TakeFishMaps

##########

sub ToHide()

var k

  while not uo.Hidden()
    uo.Print('Пытаемся уйти в хайд...')
    DeleteJournal('have hidden')
    DeleteJournal('seem to hide')
    DeleteJournal('must wait')
    CheckLag()
    uo.UseSkill('Hiding')
    k=0
    repeat
      wait(200)
      k=k+1
    until uo.InJournal('have hidden') or uo.InJournal('seem to hide') or uo.InJournal('must wait') or (k==25)
  wend
  wait(100)

endsub # ToHide

##########

sub DropFish()

var a, Exit

dim Fish[6]
Fish[0]=0x09CC
Fish[1]=0x09CD
Fish[2]=0x09CE
Fish[3]=0x09CF
Fish[4]=0x0DD6
Fish[5]=0x0DD6
Fish[6]=0x14EB

  ToHide()
  if uo.Waiting() then
    uo.CancelTarget()
  endif

  uo.Print('Выкладываем Рыбу.')
  uo.SetReceivingContainer(Chest)
  wait(500)
  for a=0 to 6
    exit=0
    repeat
      CheckLag()
      uo.FindType(Fish[a])
      if uo.GetQuantity('finditem')>0 then
        uo.Grab('0','finditem')
        wait(1500)
      else
        exit=1
      endif
    until Exit==1
  next
  uo.UnSetReceivingContainer(Chest)
  uo.Print('Рыба Выложена.')

endsub # DropFish

##########

sub RunebookRecall(n)

var oldX=uo.getX(), oldY=uo.getY()
var time
dim Rune[9]

Rune[0]='21'
Rune[1]='33'
Rune[2]='46'
Rune[3]='58'
Rune[4]='64'
Rune[5]='73'
Rune[6]='88'
Rune[7]='94'
Rune[8]='1025'

  repeat
    CheckLag()
    uo.DeleteJournal()
    uo.Exec('warmode 0')
    uo.Recall('Runebook',Rune[n-1])
    time=uo.Timer()
    repeat
      wait(500)
    until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') or uo.InJournal('fizzles') or time+200<uo.Timer()
  until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs')

endsub # RunebookRecall

##########

sub RecallFishing(n)

var mX, mY

  repeat
    uo.DeleteJournal()
    if uo.Waiting() then
      uo.CancelTarget()
    endif
    mX = uo.GetX("self")
    mY = uo.GetY("self")
    CheckLag()
    uo.DeleteJournal()
    if n==1 then
      uo.WaittargetObject('RuneFish1')
    else
      if n==2 then
        uo.WaittargetObject('RuneFish2')
      else
        uo.WaittargetObject('RuneFish3')
      endif
    endif
    wait(500)
    uo.Cast('Recall')
    wait(4500)
  until (uo.GetX("self") <> mX) or (uo.GetY("self") <> mY)

endsub # RecallFishing1

##########

sub Approaching()

var i
var X, Y

  uo.Exec('set distance 1')
  CheckLag()
  if uo.GetDir()<>9 then
    uo.Press(33)
  endif
  for i=1 to 5
    CheckLag()
    uo.Press(33)
    wait(200)
  next
  CheckLag()
  uo.OpenDoor()
  wait(2000)
  X=uo.GetX()
  Y=uo.GetY()
  CheckLag()
  uo.Press(33)
  wait(200)
  if (X==uo.GetX()) and (Y==uo.GetY()) then
    CheckLag()
    uo.OpenDoor()
    wait(2000)
    CheckLag()
    uo.Press(33)
    wait(200)
  endif
  CheckLag()
  uo.OpenDoor()
  wait(2000)
  for i=1 to 5
    CheckLag()
    uo.Press(33)
    wait(200)
  next
  uo.Exec('set finddistance 1')
  CheckLag()
  uo.findtype('0x082C','-1','ground')
  uo.UseObject('finditem')
  wait(2000)
  CheckLag()
  uo.Press(36)
  wait(200)
  CheckLag()
  uo.UseObject('finditem')
  wait(2000)
  CheckLag()
  uo.Press(36)
  wait(200)
  CheckLag()
  uo.Press(36)
  wait(200)

endsub # Approaching()

##########

sub CheckLag()

  while (uo.ObjAtLayer('Bpack')=='')
    wait(1000)
  wend
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  DeleteJournal('backpack')
  uo.Click('backpack')
  repeat
    wait(50)
  until uo.InJournal('backpack')

endsub # CheckLag

##########

sub DeleteJournal(DeleteString)

var nom=uo.InJournal(DeleteString)

  while nom>0
    UO.SetJournalLine(nom-1,' ')
    nom=uo.InJournal(DeleteString)
  endif

endsub # DeleteJournal

##########

sub Open(Container)

  CheckLag()
  uo.UseObject(Container)
  wait(3000)

endsub # Open

##########

sub Eating()

var flag=true

  ToHide()
  Open(Chest)
  MoveItems(FoodType,'-1','0',Chest,uo.GetSerial('backpack'))

  repeat
    uo.DeleteJournal()
    uo.FindType(FoodType,'-1',uo.GetSerial('backpack'))
    if uo.FindCount()>0 then
      CheckLag()
      uo.UseType(FoodType)
      repeat
        wait(100)
      until uo.InJournal('full') or uo.InJournal('stuffed') or uo.InJournal('hungry') or uo.InJournal('satiated') or uo.Dead()
      wait(1000)
    else
      flag=false
    endif
  until uo.InJournal('too full') or uo.Dead() or (flag==false)

  MoveItems(FoodType,'-1','0',uo.GetSerial('backpack'),Chest)

endsub # Eating

##########

sub MoveItems(ItemType,ItemColor,ItemQuantity,FromContainer,ToContainer)

var CurrentQuantity, flag=true

  CheckLag()
  uo.SetReceivingContainer(ToContainer)

  uo.FindType(ItemType,ItemColor,FromContainer)
  CurrentQuantity=uo.GetQuantity('finditem') ## кол-во предметов в найденной стопке

  while (uo.FindCount()>0) and (flag==true) ## если что-то нашли и еще не все нужное переместили
    if val(ItemQuantity)<=CurrentQuantity then ## если переместить нужно все или меньше, чем в стопке
      uo.Grab(ItemQuantity,'finditem') ## перемещаем всю стопку или заданное кол-во
      wait(1500)
      if ItemQuantity=='0' then ## если переместить надо все
        CheckLag()
        uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
        CurrentQuantity=uo.GetQuantity('finditem')
      else ## если уже переместили нужное кол-во - выход из процедуры
        flag=false
      endif
    else ## если переместить нужно не все, но больше, чем в найденной стопке
      uo.Grab('0','finditem') ## перемещаем всю стопку
      wait(1500)
      ItemQuantity=str((val(ItemQuantity)-CurrentQuantity),0) ## вычисляем, сколько еще нужно
      CheckLag()
      uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
      CurrentQuantity=uo.GetQuantity('finditem')
    endif
  wend

  uo.UnSetReceivingContainer(ToContainer)

endsub # MovingItems

##########

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)
  endif

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

  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)
  endif

  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)
  endif

  return hh+":"+mm+":"+ss

endsub # Time


Top
   
 Post subject:
PostPosted: 2005-08-09 17:50:35 
Offline

Joined: 2005-01-22 10:29:34
Posts: 138
и чего?


Top
   
 Post subject:
PostPosted: 2005-08-09 18:34:07 
Offline

Joined: 2004-08-25 15:48:35
Posts: 19
netol wrote:
и чего?
Хам! :D


Top
   
 Post subject:
PostPosted: 2005-08-09 18:42:26 
Offline

Joined: 2005-01-22 10:29:34
Posts: 138
лано там че нормальное кинул а так скрипт на анатомию переписывать


Top
   
 Post subject:
PostPosted: 2005-08-09 19:32:53 
Offline
Expert!
User avatar

Joined: 2005-01-15 19:15:05
Posts: 791
Location: Dragon World
Скрипт на фишинг понравился, добавить пару функций и скрипт ничего будет.

Code:
sub MoveItems(ItemType,ItemColor,ItemQuantity,FromContainer,ToContainer)
.....
endsub
Ради еды писать это? Можно всё сделать намного проще.


Top
   
 Post subject:
PostPosted: 2005-08-09 21:09:23 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Leo wrote:
Ради еды писать это? Можно всё сделать намного проще.

Писалось "это" не ради еды, а совсем для других целей. ;)
Просто я посчитал ненужным настукивать несколько строк на клаве, если можно сделать просто Ctrl+C - Ctrl+V.

netol wrote:
лано там че нормальное кинул а так скрипт на анатомию переписывать

Там не только анатомия. "Много в одном" даже в магазинах в одном флаконе продается. ;) И потом, кому нужно - тот воспользуется.


Top
   
 Post subject:
PostPosted: 2005-08-10 14:54:06 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Blacksmiting

Работает в трех вариантах:
1. Blacksmithing - Ковка. В зависимости от значения переменной DoSmelting плавит скованное сразу или раскладывает по мешкам. При наличии кочерги в сундуке и значении переменной UseDwarfsPickaxe=1 автоматически берет его в руки при плавке.
2. Smelting - Плавка. Берет мешки, заполненные в предыдущем режиме и плавит находящиеся в них вещи. Точно так же может использовать кочергу.
3. Просто плавит всю руду, находящуюся в сундуке-источнике и складывает инги в сундук-приемник. Кочергу в руки надо брать самостоятельно. Плавит сразу всей взятой кучей, а не по одной штуке!

Code:
############################################################################################
###                                                                                      ###
###                            Blacksmithing / Кузнечное дело                            ###
###                                  Шард Dragon World                                   ###
###                                        v2.45                                         ###
###                                                                                      ###
###                                    Автор  Corwin                                     ###
###                                                                                      ###
###                             Тестирование  Euronimus                                  ###
###                                                                                      ###
############################################################################################

############################################################################################
### Глобальные переменные ###
#############################

##### к скрипту Blacksmithing
var ItemType='0x13FE'         ## - тип вещи, которую крафтим (katana)
var ItemColor='0x0000'        ## - цвет вещи, которую будем крафтить, '-1' - вещь любого цвета
var IngotNumber=8             ## - количество ингов для одного крафта
var IngotColor='0x0000'       ## - цвет ингов, из которых будем ковать
var DoSmelting=1              ## - плавить сразу или не плавить то, что сковали
var IngotMinNumber=1000       ## - минимальное количество ингов оставить в сундуке
var DwarfPickaxe='0x4031CC6B' ## - кочерга

##### к скрипту Smelting
var SmeltItemType='0x13FE'    ## - тип вещи, которую будем плавить, '-1' - любая вещь
var SmeltItemColor='0x0000'   ## - цвет вещи, которую будем плавить, '-1' - вещь любого цвета

##### к скрипту SmeltingOre
var OreNumber=650             ## - максимальное (если есть) количество руды для одной плавки
var SmeltOreColor='-1'        ## - цвет руды, которую будем плавить, '-1' - руда любого цвета

##### общие
var UseDwarfsPickaxe=1        ## использовать или нет кочергу при плавке скованных вещей
var UseSpiritSpeak=1          ## включить тренировку скилла Spirit Speak каждые 6 минут параллельно ковке
var DoEating=1                ## 1 - Включить потребление еды, 0 - отключить.
var FoodType='0x097B'         ## Тип еды, которую будем есть (сейчас "fish steaks"). Еда должна
                              ## лежать в сундуке-источнике.
var BagType='0x0E76'          ## - тип мешка для складывания вещей
var IngotType='0x1BEF'        ## - тип ингота (4 и больше штук в стопке)
var Forge='0x4029F1A2'        ## - ID плавильни, на которой будут плавиться сделанные вещи.
var MaxWeight=500             ## - максимальный вес в рюкзаке

############################################################################################
### Код скрипта ###
###################

sub Blacksmithing()

var Exit, AllExit=0, BSExit=0, k, findnumber
var CurrentBag
var IngotInChest
var Hammer
var i, i1, count ## для таймера Spirit Speak

  uo.CancelMenu()
  uo.AutoMenu('Blacksmithing', 'Weapons')
  uo.AutoMenu('Weapons', 'Swords & Blades')
  uo.AutoMenu('Swords & Blades', 'katana')

##### для замены
#  uo.AutoMenu('Blacksmithing', 'Armor')
#  uo.AutoMenu('Armor', 'Plate Mail')
#  uo.AutoMenu('Armor', 'Helmets')
#  uo.AutoMenu('Armor', 'Chain Mail')
#  uo.AutoMenu('Weapons', 'Axes')
#  uo.AutoMenu('Weapons', 'Pole Arms')
#  uo.AutoMenu('Helmets', 'helmet')
#  uo.AutoMenu('Plate Mail', 'platemail')
#  uo.AutoMenu('Chain Mail', 'chainmail tunic')
#  uo.AutoMenu('Chain Mail', 'chainmail  coif')
#  uo.AutoMenu('Axes', 'two handed axe')
#  uo.AutoMenu('Pole Arms', 'bardiche')
#####
#  uo.AutoMenu('Blacksmithing', 'Colored Armor & Weapons')
#  uo.AutoMenu('Colored Armor & Weapons', 'Rusty Weapons')
#  uo.AutoMenu('Colored Armor & Weapons', 'Rusty Armor')
#  uo.AutoMenu('Rusty Weapons', 'Rusty Swords & Blades')
#  uo.AutoMenu('Rusty Armor', 'Rusty Plate Armor & Shields')
#  uo.AutoMenu('Rusty Swords & Blades', 'Rusty Katana')
#  uo.AutoMenu('Rusty Plate Armor & Shields', 'Rusty Platemail Gorget')
#####

  SetObjects()
  uo.Exec('set finddistance 10')
  uo.IgnoreReset()

  i=UO.Timer()

  while not uo.Dead() and not (AllExit==1) and not (BSExit==1)
    uo.DeleteJournal()
    Exit=0

    if not (DoSmelting==1) then
      uo.SetReceivingContainer('backpack')

      CheckLag()
      uo.print('Выбираем пустой мешок')
      uo.findtype(BagType,'-1','backpack')
      if uo.findcount()==0 then
        while Exit==0
          uo.findtype(BagType,'-1','ChestFrom')
          if uo.findcount()>0 then
            CurrentBag=uo.GetSerial('finditem')
            Open(CurrentBag)
            uo.findtype('-1','-1',CurrentBag)
            if uo.findcount()>0 then
              uo.Ignore(CurrentBag,'on')
            else
              uo.grab('0',CurrentBag)
              uo.IgnoreReset()
              Exit=1
            endif
          else
            uo.print('Пустые мешки закончились, скрипт остановлен')
            uo.IgnoreReset()
            Exit=1
            BSExit=1
          endif
        wend
      else
        CurrentBag=uo.getserial('finditem')
      endif

      wait(1000)
      uo.UnSetReceivingContainer('backpack')
      Exit=0
    endif

    while (Exit==0) and (BSExit==0)
      ToHide()

      if (UseSpiritSpeak==1) then
        UO.DeleteJournal()
        i1=UO.Timer()
        if (i1-i>1200) then
          CheckLag()
          i=i1
          UO.UseSkill('Spirit Speak')
          wait(300)
          count=0
          Repeat
            wait(100)
            count=count+1
          Until UO.InJournal("You fail") or UO.InJournal("You establish") or count>30
        endif
      endif

      ToHide()

      CheckLag()
      uo.findtype(IngotType,IngotColor,'ChestFrom')
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<0) then
        uo.findtype(IngotType,IngotColor,'ChestFrom')
        if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<0) then
          IngotInChest=0
        else
          IngotInChest=uo.GetQuantity('finditem')
        endif
      endif

      CheckLag()
      uo.findtype(IngotType,IngotColor,uo.GetSerial('backpack'))
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<IngotNumber) then
        MoveItems(IngotType,IngotColor,str(IngotNumber,0),'ChestFrom',uo.GetSerial('backpack'))
        uo.findtype(IngotType,IngotColor,uo.GetSerial('backpack'))
      endif

      CheckLag()
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<IngotNumber) then
        MoveItems(IngotType,IngotColor,str(IngotNumber,0),'ChestFrom',uo.GetSerial('backpack'))
        uo.findtype(IngotType,IngotColor,uo.GetSerial('backpack'))
      endif

      CheckLag()
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<IngotNumber) or (IngotInChest<IngotMinNumber) then
        uo.Print('Скрипт работу заканчивает')
        Exit=1
        AllExit=1
      else
        k=0
        uo.DeleteJournal()
        CheckLag()
        UO.UseType(IngotType) ;Используем инги
        while not UO.InJournal('You put') and not UO.InJournal('have failed') and (k<120)
          wait(100)
          k=k+1
        wend
        if uo.Weight>=MaxWeight then
          Exit=1
        endif
      endif
    wend

    if DoSmelting==1 then
      ToHide()
      Open('ChestFrom')

      if (UseDwarfsPickaxe==1) then
        Hammer=uo.ObjAtLayer('Rhand')
        uo.UnEquip('Rhand')
        repeat
          wait(100)
        until (uo.ObjAtLayer('Rhand')=='')
        wait(200)
        uo.SetReceivingContainer(uo.GetSerial('backpack'))
        uo.Grab('0',DwarfPickaxe)
        uo.UnSetReceivingContainer(uo.GetSerial('backpack'))
        wait(1000)
        uo.Equip('Rhand',DwarfPickaxe)
        repeat
          wait(100)
        until (uo.ObjAtLayer('Rhand')<>'')
        wait(200)
      endif

      Exit=0

      while (Exit==0)
        ToHide()
        CheckLag()
        uo.DeleteJournal()
        if uo.Targeting() then
          uo.CancelTarget()
        endif
        uo.findtype(ItemType,ItemColor,uo.GetSerial('backpack'))
        if uo.findcount()<=0 then
          uo.findtype(ItemType,ItemColor,uo.GetSerial('backpack'))
        endif
        if uo.findcount()>0 then
          k=0
          uo.waittargettype(ItemType,ItemColor)   # целью выбираем предмет этого типа
          wait(500)
          uo.useobject(Forge)  ;используем плавильню
          while not uo.InJournal('smelt') and (k<30)
            wait(100)
            k=k+1
          wend
        else
          MoveItems(IngotType,IngotColor,'0',uo.GetSerial('backpack'),'ChestTo')
          if (UseDwarfsPickaxe==1) then
            uo.SetReceivingContainer('ChestFrom')
            uo.Grab('0',DwarfPickaxe)
            uo.UnSetReceivingContainer('ChestFrom')
            wait(1000)
            uo.Equip('Rhand',Hammer)
            repeat
              wait(100)
            until (uo.ObjAtLayer('Rhand')<>'')
          endif
          wait(200)
          UO.DeleteJournal()
          Exit=1
        endif
      wend
    endif

    if (BSExit==0) and not (DoSmelting==1) then
      CheckLag()
      MoveItems(ItemType,ItemColor,'0',uo.GetSerial('backpack'),CurrentBag)

      CheckLag()
      uo.SetReceivingContainer('ChestTo')
      uo.Grab('0',CurrentBag)
      wait(1000)
      uo.UnSetReceivingContainer('ChestTo')
    endif

    if DoEating==1 then
      CheckLag()
      Eating()
    endif
    wait(3000)
  wend

  uo.Print('Скрипт Blacksmithing остановлен')

endsub # Blacksmithing

##########

sub Smelting()

var Exit, AllExit=0, k, findnumber
var CurrentBag

  SetObjects()

  while not uo.Dead() and not AllExit==1

    ToHide()

    UO.DeleteJournal()
    Exit=0

    uo.SetReceivingContainer('backpack')

    CheckLag()
    uo.print('Выбираем полный мешок')
    uo.findtype(BagType,'-1','backpack')
    if uo.findcount()==0 then
      while Exit==0
        uo.findtype(BagType,'-1','ChestFrom')
        if uo.findcount()>0 then
          CurrentBag=uo.GetSerial('finditem')
          Open(CurrentBag)
          uo.findtype(SmeltItemType,SmeltItemColor,CurrentBag)
          if uo.findcount()>0 then
            uo.grab('0',CurrentBag)
            uo.IgnoreReset()
            Exit=1
          else
            uo.Ignore(CurrentBag,'on')
          endif
        else
          uo.print('Полные мешки закончились, скрипт остановлен')
          uo.IgnoreReset()
          Exit=1
          AllExit=1
        endif
      wend
    else
      CurrentBag=uo.getserial('finditem')
    endif

    wait(1000)
    uo.UnSetReceivingContainer('backpack')
    Exit=0

    if AllExit==0 then
      CheckLag()
      Open(CurrentBag)
    endif

    if (UseDwarfsPickaxe==1) then
      uo.SetReceivingContainer(uo.GetSerial('backpack'))
      uo.Grab('0',DwarfPickaxe)
      uo.UnSetReceivingContainer(uo.GetSerial('backpack'))
      wait(1000)
      uo.Equip('Rhand',DwarfPickaxe)
      repeat
        wait(100)
      until (uo.ObjAtLayer('Rhand')<>'')
      wait(200)
    endif

    while (Exit==0) and (AllExit==0)
      ToHide()
      MoveItems(SmeltItemType,SmeltItemColor,'1',CurrentBag,uo.GetSerial('backpack'))
      CheckLag()
      uo.DeleteJournal()
      if uo.Targeting() then
        uo.CancelTarget()
      endif
      uo.findtype(SmeltItemType,SmeltItemColor,uo.GetSerial('backpack'))
      if uo.findcount()<=0 then
        uo.findtype(SmeltItemType,SmeltItemColor,uo.GetSerial('backpack'))
      endif
      if uo.findcount()>0 then
        k=0
        uo.waittargettype(SmeltItemType,SmeltItemColor)   ;целью выбираем найденный предмет
        wait(500)
        uo.useobject(Forge)  ;используем плавильню
        while not uo.InJournal('smelt') and (k<30)
          wait(100)
          k=k+1
        wend
      else
        MoveItems(IngotType,IngotColor,'0',uo.GetSerial('backpack'),'ChestTo')
        CheckLag()
        UO.DeleteJournal()
        uo.SetReceivingContainer('ChestTo')
        uo.grab('0',CurrentBag)
        uo.UnSetReceivingContainer('ChestTo')
        wait(1000)
        Exit=1
      endif
    wend

    if (UseDwarfsPickaxe==1) then
      uo.SetReceivingContainer('ChestFrom')
      uo.Grab('0',DwarfPickaxe)
      uo.UnSetReceivingContainer('ChestFrom')
      wait(1000)
    endif

    if DoEating==1 then
      CheckLag()
      Eating()
    endif
    wait(3000)

  wend

  uo.Print('Скрипт остановлен')

endsub # Smelting

##########

sub SmeltingOre()

var Exit, k, findnumber, a
dim Ore[4]
dim Ingot[4]

  Ore[0]='0x19B9' ## - 4 и больше руды
  Ore[1]='0x19B8' ## - 3 руды
  Ore[2]='0x19BA' ## - 2 руды
  Ore[3]='0x19B7' ## - 1 руда

  Ingot[0]='0x1BEF' ## - тип ингота (почти все виды)
  Ingot[1]='0x1BE9' ## - тип ингота (золото)
  Ingot[2]='0x1BF5' ## - тип ингота (серебро)
  Ingot[3]='0x1BE3' ## - тип ингота (медь)

  SetObjects()

  ToHide()

  UO.DeleteJournal()
  Open('ChestFrom')

  for a=0 to 3
    Exit=0
    While Exit==0
      CheckLag()
      uo.DeleteJournal()
      uo.findtype(Ore[a],SmeltOreColor,uo.GetSerial('backpack'))
      if uo.FindCount()>0 then
        uo.UseObject('finditem')
        k=0
        repeat
          wait(200)
          k=k+1
        until uo.InJournal('smelt') or (k==10)
        wait(500)
      else
        for k=0 to 3
          CheckLag()
          MoveItems(Ingot[k],SmeltOreColor,'0',uo.GetSerial('backpack'),'ChestTo')
        next
        CheckLag()
        MoveItems(Ore[a],SmeltOreColor,str(OreNumber,0),'ChestFrom',uo.GetSerial('backpack'))
        uo.findtype(Ore[a],SmeltOreColor,uo.GetSerial('backpack'))
        if uo.findcount()<=0 then
          Exit=1
        endif
      endif
    wend
    wait(3000)
  next

  if DoEating==1 then
    CheckLag()
    Eating()
  endif

  uo.Print('Руда закончилась, скрипт остановлен')

endsub # SmeltingOre

############################################################################################
### Процедуры поддержки ###
###########################

Sub ToHide()

  while not uo.Hidden()
    uo.Print('Пытаемся уйти в хайд...')
    uo.DeleteJournal()
    CheckLag()
    uo.UseSkill('Hiding')
    repeat
      wait(200)
    until uo.InJournal('have hidden') or uo.InJournal('seem to hide')
  wend
  wait(100)

endsub # ToHide

##########

Sub SetObjects()

  UO.Print('Выбери сундук-источник: ')
  UO.Exec('addobject ChestFrom')
  While UO.Targeting()
    Wait(100)
  Wend

  UO.Print('Выбери сундук-приемник: ')
  UO.Exec('addobject ChestTo')
  While UO.Targeting()
    Wait(100)
  Wend

endsub # SetObjects

##########

Sub CheckLag()

  while (uo.ObjAtLayer('Bpack')=='')
    wait(1000)
  wend
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  uo.DeleteJournal()
  uo.Click('backpack')
  repeat
    wait(50)
  until uo.InJournal('backpack')

endsub # CheckLag

##########

Sub MoveItems(ItemType,ItemColor,ItemQuantity,FromContainer,ToContainer)

var CurrentQuantity, flag=true

  CheckLag()
  uo.SetReceivingContainer(ToContainer)
  CheckLag()

  uo.FindType(ItemType,ItemColor,FromContainer)
  CurrentQuantity=uo.GetQuantity('finditem') ## кол-во предметов в найденной стопке

  while (uo.FindCount()>0) and (flag==true) ## если что-то нашли и еще не все нужное переместили
    if val(ItemQuantity)<=CurrentQuantity then ## если переместить нужно все или меньше, чем в стопке
      uo.Grab(ItemQuantity,'finditem') ## перемещаем всю стопку или заданное кол-во
      wait(1000)
      if ItemQuantity=='0' then ## если переместить надо все
        CheckLag()
        uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
        CurrentQuantity=uo.GetQuantity('finditem')
      else ## если уже переместили нужное кол-во - выход из процедуры
        flag=false
      endif
    else ## если переместить нужно не все, но больше, чем в найденной стопке
      uo.Grab('0','finditem') ## перемещаем всю стопку
      wait(1000)
      ItemQuantity=str((val(ItemQuantity)-CurrentQuantity),0) ## вычисляем, сколько еще нужно
      CheckLag()
      uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
      CurrentQuantity=uo.GetQuantity('finditem')
    endif
  wend

  uo.UnSetReceivingContainer(ToContainer)

endsub # MovingItems

##########

Sub Eating()

var flag=true

  ToHide()
  Open('ChestFrom')
  MoveItems(FoodType,'-1','10','ChestFrom',uo.GetSerial('backpack'))

  repeat
    uo.DeleteJournal()
    uo.FindType(FoodType,'-1',uo.GetSerial('backpack'))
    if uo.FindCount()>0 then
      CheckLag()
      uo.UseType(FoodType)
      repeat
        wait(100)
      until uo.InJournal('full') or uo.InJournal('stuffed') or uo.InJournal('hungry') or uo.InJournal('satiated') or uo.Dead()
      wait(1000)
    else
      flag=false
    endif
  until uo.InJournal('too full') or uo.Dead() or (flag==false)

  MoveItems(FoodType,'-1','0',uo.GetSerial('backpack'),'ChestFrom')

endsub # Eating

##########

Sub Open(Container)

  CheckLag()
  uo.UseObject(Container)
  wait(3000)

endsub # Open


Last edited by Corwin on 2005-09-15 07:20:30, edited 1 time in total.

Top
   
 Post subject:
PostPosted: 2005-08-11 09:11:49 
Offline

Joined: 2005-08-09 21:07:02
Posts: 2
Гыгыгы Карвин ))) как долго мы тебя не видели)))
Древние отцы ДРВ


Top
   
 Post subject:
PostPosted: 2005-08-11 12:34:47 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
ddd wrote:
Гыгыгы Карвин ))) как долго мы тебя не видели)))
Древние отцы ДРВ

Даже если хотел бы считаться "отцом", это все равно было бы неверно - я другой Корвин, нежели тот, которого ты, вероятно, имеешь в виду. ;) Просто ник такой же.

_________________
Никогда не бойся делать то, что ты не умеешь!
Помни, ковчег был построен любителем. Профессионалы построили "Титаник".


Top
   
 Post subject:
PostPosted: 2005-08-11 12:52:00 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Inscription full

Пишет выбранное заклинание пока есть реагенты и бланки, раскладывает написанные свитки по мешкам в соответствии с указанным количеством. Использование мешков можно и отключить.

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

Обновление: вставил в скрипт уход в хайд и автоматическое лечение бинтами - против любителей применения землетрясений.

Code:
############################################################################################
###                                                                                      ###
###                           Inscription / Написание свитков                            ###
###                                  Шард Dragon World                                   ###
###                                        v2.85                                         ###
###                                                                                      ###
###                                    Автор  Corwin                                     ###
###                                                                                      ###
###                          Автор оригинала  неизвестен                                 ###
###                                                                                      ###
############################################################################################

############################################################################################
### Глобальные переменные ###
#############################

## к скрипту Inscription
var BlankType='0x0E34'  ## - тип пустого свитка
var BlankNumber=100     ## - количество свитков, забираемое из сундука за раз
var BlankMinNumber=0    ## - минимальное количество свитков, которое надо оставить в сундуке
var DoEating=1          ## 1 - включить потребление еды, 0 - отключить.
var FoodType='0x097B'   ## - тип еды, которую будем есть (fish steaks).
var BagType='0x0E76'    ## - тип мешка для складывания вещей
var MaxWeight=700       ## - максимальный вес в рюкзаке
var MaxNumber=500       ## - максимальное количество делаемых вещей в рюкзаке и для заполнения одного мешка
var Reconnect=0         ## 1 - Включить реконнект на сервер, если выкинет, 0 - отключить реконнект.
var UseBags=0           ## 1 - Использовать раскладывание делаемых свитков по мешкам
var UseHide=1           ## 1 - включить уход в хайд во время крафта, 0 - отключить
var UseHeal=1           ## 1 - включить лечение во время крафта, если здоровье падает, 0 - отключить
                        ## бинты должны при этом лежать в рюкзаке

############################################################################################
### Код скрипта ###
###################

sub Clumsy()
  Inscription("0x0F7B", "0x0F88", "", "", "First Circle", "Spell Circle 1", "Clumsy", "0x1F2E", 6)
end sub

sub CreateFood()
  Inscription("0x0F84", "0x0F85", "0x0F86", "", "First Circle", "Spell Circle 1", "Create Food", "0x1F2F", 6)
end sub

sub Feeblemind()
  Inscription("0x0F85", "0x0F88", "", "", "First Circle", "Spell Circle 1", "Feeblemind", "0x1F30", 6)
end sub

sub Heal()
  Inscription("0x0F84", "0x0F85", "0x0F8D", "", "First Circle", "Spell Circle 1", "Heal", "0x1F31", 6)
end sub

sub MagicArrow()
  Inscription("0x0F7A", "0x0F88", "", "", "First Circle", "Spell Circle 1", "Magic Arrow", "0x1F32", 6)
end sub

sub NightSight()
  Inscription("0x0F8D", "0x0F8C", "", "", "First Circle", "Spell Circle 1", "Night Sight", "0x1F33", 6)
end sub

sub ReactiveArmor()
  Inscription("0x0F84", "0x0F8C", "0x0F8D", "", "First Circle", "Spell Circle 1", "Reactive Armor", "0x1F2D", 6)
end sub

sub Weaken()
  Inscription("0x0F84", "0x0F88", "", "", "First Circle", "Spell Circle 1", "Weaken", "0x1F34", 6)
end sub

sub Agility()
  Inscription("0x0F7B", "0x0F86", "", "", "Second Circle", "Spell Circle 2", "Agility", "0x1F35", 10)
end sub

sub Cunning()
  Inscription("0x0F86", "0x0F88", "", "", "Second Circle", "Spell Circle 2", "Cunning", "0x1F36", 10)
end sub

sub Cure()
  Inscription("0x0F84", "0x0F85", "", "", "Second Circle", "Spell Circle 2", "Cure", "0x1F37", 10)
end sub

sub Harm()
  Inscription("0x0F88", "0x0F8D", "", "", "Second Circle", "Spell Circle 2", "Harm", "0x1F38", 10)
end sub

sub MagicTrap()
  Inscription("0x0F84", "0x0F8C", "0x0F8D", "", "Second Circle", "Spell Circle 2", "Magic Trap", "0x1F39", 10)
end sub

sub MagicUntrap()
  Inscription("0x0F84", "0x0F85", "0x0F8C", "", "Second Circle", "Spell Circle 2", "Magic Untrap", "0x1F3A", 10)
end sub

sub Protection()
  Inscription("0x0F84", "0x0F85", "0x0F8C", "", "Second Circle", "Spell Circle 2", "Protection", "0x1F3B", 10)
end sub

sub Strength()
  Inscription("0x0F86", "0x0F88", "", "", "Second Circle", "Spell Circle 2", "Strength", "0x1F3C", 10)
end sub

sub Bless()
  Inscription("0x0F84", "0x0F86", "", "", "Third Circle", "Spell Circle 3", "Bless", "0x1F3D", 15)
end sub

sub Fireball()
  Inscription("0x0F7A", "0x0F8C", "", "", "Third Circle", "Spell Circle 3", "Fireball", "0x1F3E", 15)
end sub

sub MagicLock()
  Inscription("0x0F8C", "0x0F7B", "0x0F84", "", "Third Circle", "Spell Circle 3", "Magic Lock", "0x1F3F", 15)
end sub

sub Poison()
  Inscription("0x0F88", "", "", "", "Third Circle", "Spell Circle 3", "Poison", "0x1F40", 15)
end sub

sub Telekinisis()
  Inscription("0x0F7B", "0x0F86", "", "", "Third Circle", "Spell Circle 3", "Telekinisis", "0x1F41", 15)
end sub

sub Teleport()
  Inscription("0x0F7B", "0x0F86", "", "", "Third Circle", "Spell Circle 3", "Teleport", "0x1F42", 15)
end sub

sub Unlock()
  Inscription("0x0F7B", "0x0F84", "", "", "Third Circle", "Spell Circle 3", "Unlock", "0x1F43", 15)
end sub

sub WallOfStone()
  Inscription("0x0F7B", "0x0F84", "", "", "Third Circle", "Spell Circle 3", "Wall of Stone", "0x1F44", 15)
end sub

sub ArchCure()
  Inscription("0x0F84", "0x0F85", "0x0F86", "", "Fourth Circle", "Spell Circle 4", "Archcure", "0x1F45", 25)
end sub

sub ArchProtection()
  Inscription("0x0F84", "0x0F85", "0x0F86", "0x0F8C", "Fourth Circle", "Spell Circle 4", "Arch Protection", "0x1F46", 25)
end sub

sub Curse()
  Inscription("0x0F84", "0x0F88", "0x0F8C", "", "Fourth Circle", "Spell Circle 4", "Curse", "0x1F47", 25)
end sub

sub FireField()
  Inscription("0x0F7A", "0x0F8D", "0x0F8C", "", "Fourth Circle", "Spell Circle 4", "Fire Field", "0x1F48", 25)
end sub

sub GreaterHeal()
  Inscription("0x0F84", "0x0F85", "0x0F86", "0x0F8D", "Fourth Circle", "Spell Circle 4", "Greater Heal", "0x1F49", 25)
end sub

sub Lightning()
  Inscription("0x0F7A", "0x0F86", "0x0F8C", "", "Fourth Circle", "Spell Circle 4", "Lightning", "0x1F4A", 25)
end sub

sub ManaDrain()
  Inscription("0x0F7A", "0x0F86", "0x0F8D", "", "Fourth Circle", "Spell Circle 4", "ManaDrain", "0x1F4B", 25)
end sub

sub Recall()
  Inscription("0x0F7A", "0x0F7B", "0x0F86", "", "Fourth Circle", "Spell Circle 4", "Recall", "0x1F4C", 25)
end sub

sub BladeSpirits()
  Inscription("0x0F7A", "0x0F86", "0x0F88", "", "Fifth Circle", "Spell Circle 5", "Blade Spirits", "0x1F4D", 30)
end sub

sub DispelField()
  Inscription("0x0F84", "0x0F7A", "0x0F8D", "0x0F8C", "Fifth Circle", "Spell Circle 5", "Dispel Field", "0x1F4E", 30)
end sub

sub Incognito()
  Inscription("0x0F7B", "0x0F84", "0x0F88", "", "Fifth Circle", "Spell Circle 5", "Incognito", "0x1F4F", 30)
end sub

sub MagicReflection()
  Inscription("0x0F84", "0x0F86", "0x0F8D", "", "Fifth Circle", "Spell Circle 5", "Magic Reflection", "0x1F50", 30)
end sub

sub MindBlast()
  Inscription("0x0F7A", "0x0F86", "0x0F88", "0x0F8C", "Fifth Circle", "Spell Circle 5", "Mind Blast", "0x1F51", 30)
end sub

sub Paralyze()
  Inscription("0x0F84", "0x0F86", "0x0F8D", "", "Fifth Circle", "Spell Circle 5", "Paralyze", "0x1F52", 30)
end sub

sub PoisonField()
  Inscription("0x0F7A", "0x0F88", "0x0F8D", "", "Fifth Circle", "Spell Circle 5", "Poison Field", "0x1F53", 30)
end sub

sub Summ.Creature()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "", "Fifth Circle", "Spell Circle 5", "Summon Creature", "0x1F54", 30)
end sub

sub Dispel()
  Inscription("0x0F84", "0x0F86", "0x0F8C", "", "Sixth Circle", "Spell Circle 6", "Dispel", "0x1F55", 35)
end sub

sub EnergyBolt()
  Inscription("0x0F7A", "0x0F88", "", "", "Sixth Circle", "Spell Circle 6", "Energy Bolt", "0x1F56", 35)
end sub

sub Explosion()
  Inscription("0x0F7A", "0x0F86", "0x0F8C", "", "Sixth Circle", "Spell Circle 6", "Explosion", "0x1F57", 35)
end sub

sub Invisibility()
  Inscription("0x0F7B", "0x0F88", "", "", "Sixth Circle", "Spell Circle 6", "Invisibility", "0x1F58", 35)
end sub

sub Mark()
  Inscription("0x0F7A", "0x0F7B", "0x0F86", "", "Sixth Circle", "Spell Circle 6", "Mark", "0x1F59", 35)
end sub

sub MassCurse()
  Inscription("0x0F84", "0x0F86", "0x0F88", "0x0F8C", "Sixth Circle", "Spell Circle 6", "Mass Curse", "0x1F5A", 35)
end sub

sub ParalyzeField()
  Inscription("0x0F7A", "0x0F85", "0x0F8D", "", "Sixth Circle", "Spell Circle 6", "Paralyze Field", "0x1F5B", 35)
end sub

sub Reveal()
  Inscription("0x0F7B", "0x0F8C", "", "", "Sixth Circle", "Spell Circle 6", "Reveal", "0x1F5C", 35)
end sub

sub ChainLightning()
  Inscription("0x0F7A", "0x0F86", "0x0F7B", "0x0F8C", "Seventh Circle", "Spell Circle 7", "Chain Lightning", "0x1F5D", 40)
end sub

sub EnergyField()
  Inscription("0x0F7A", "0x0F86", "0x0F8D", "0x0F8C", "Seventh Circle", "Spell Circle 7", "Energy Field", "0x1F5E", 40)
end sub

sub FlameStrike()
  Inscription("0x0F8D", "0x0F8C", "", "", "Seventh Circle", "Spell Circle 7", "Flamestrike", "0x1F5F", 40)
end sub

sub GateTravel()
  Inscription("0x0F7A", "0x0F86", "0x0F8C", "", "Seventh Circle", "Spell Circle 7", "Gate Travel", "0x1F60", 40)
end sub

sub ManaVampire()
  Inscription("0x0F7A", "0x0F7B", "0x0F86", "0x0F8D", "Seventh Circle", "Spell Circle 7", "Mana Vampire", "0x1F61", 40)
end sub

sub MassDispel()
  Inscription("0x0F7A", "0x0F84", "0x0F86", "0x0F8C", "Seventh Circle", "Spell Circle 7", "Mass Dispel", "0x1F62", 40)
end sub

sub MeteorSwarm()
  Inscription("0x0F7B", "0x0F8D", "0x0F86", "0x0F8C", "Seventh Circle", "Spell Circle 7", "Meteor Storm", "0x1F63", 40)
end sub

sub Polymorph()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "", "Seventh Circle", "Spell Circle 7", "Polymorph", "0x1F64", 40)
end sub

sub Earthquake()
  Inscription("0x0F7B", "0x0F85", "0x0F86", "0x0F8C", "Eighth Circle", "Spell Circle 8", "Earthquake", "0x1F65", 50)
end sub

sub EnergyVortex()
  Inscription("0x0F7A", "0x0F7B", "0x0F86", "0x0F88", "Eighth Circle", "Spell Circle 8", "Energy Vortex", "0x1F66", 50)
end sub

sub Resurrection()
  Inscription("0x0F7B", "0x0F84", "0x0F85", "", "Eighth Circle", "Spell Circle 8", "Resurrection", "0x1F67", 50)
end sub

sub AirElemental()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "", "Eighth Circle", "Spell Circle 8", "Air Elemental", "0x1F68", 50)
end sub

sub SummonDaemon()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "0x0F8C", "Eighth Circle", "Spell Circle 8", "Summon Daemon", "0x1F69", 50)
end sub

sub EarthElemental()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "", "Eighth Circle", "Spell Circle 8", "Earth Elemental", "0x1F6A", 50)
end sub

sub FireElemental()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "0x0F8C", "Eighth Circle", "Spell Circle 8", "Fire Elemenal", "0x1F6B", 50)
end sub

sub WaterElemental()
  Inscription("0x0F7B", "0x0F86", "0x0F8D", "", "Eighth Circle", "Spell Circle 8", "Water Elememental", "0x1F6C", 50)
end sub

############################################################################################
### Процедуры поддержки ###
###########################

Sub Inscription(regi1, regi2, regi3, regi4, circle1, circle2, spell, scrolls, mana)

var Exit, AllExit=0, CExit=0, k, findnumber
var CurrentBag
var BlankInChest
var tmp

  UO.Exec ('set distance 2')
  uo.Exec('set finddistance 3')
  UO.UnSetReceivingContainer()
  UO.DeleteJournal()
  UO.CancelMenu()
  uo.AutoMenu('Spell Circles', circle1)
  uo.AutoMenu(circle2, spell)

  SetObjects()
  uo.IgnoreReset()

  Open('ChestFrom')
  Open('ChestFrom2')
  Open('ChestTo')

  if Reconnect==1 then
    uo.Exec('exec Reconnect')
  endif

  while not uo.Dead() and not (AllExit==1) and not (CExit==1)
    uo.DeleteJournal()
    Exit=0

    if (UseBags==1) then
      uo.SetReceivingContainer('backpack')

      CheckLag()
      uo.print('Выбираем пустой мешок')
      uo.findtype(BagType,'-1','backpack')
      wait(100)
      if uo.findcount()<=0 then
        while Exit==0
          uo.findtype(BagType,'-1','ChestFrom')
          wait(100)
          if uo.findcount()>0 then
            CurrentBag=uo.GetSerial('finditem')
            Open(CurrentBag)
            uo.findtype('-1','-1',CurrentBag)
            wait(100)
            if uo.findcount()>0 then
              uo.Ignore(CurrentBag,'on')
            else
              uo.grab('0',CurrentBag)
              wait(1000)
              uo.IgnoreReset()
              Exit=1
            endif
          else
            uo.print('Пустые мешки закончились, скрипт остановлен')
            uo.IgnoreReset()
            Exit=1
            CExit=1
          endif
        wend
      else
        CurrentBag=uo.getserial('finditem')
      endif

      wait(1000)
      uo.UnSetReceivingContainer('backpack')
      Exit=0
    else
      CurrentBag=uo.getserial('ChestTo')
    endif

    while (Exit==0) and (CExit==0)
      if UseHeal == 1 then
        ToHeal()
      endif
      if UseHide == 1 then
        ToHide()
      endif

      CheckLag()
      uo.findtype(BlankType,'0x0000','ChestFrom')
      wait(100)
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<0) then
        BlankInChest=0
      else
        BlankInChest=uo.GetQuantity('finditem')
      endif

      CheckLag()
      uo.findtype(BlankType,'0x0000',uo.GetSerial('backpack'))
      wait(100)
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then
        if (BlankInChest-BlankMinNumber)<BlankNumber then
          MoveItems(BlankType,'0x0000',str((BlankInChest-BlankMinNumber),0),'ChestFrom',uo.GetSerial('backpack'))
        else
          MoveItems(BlankType,'0x0000',str(BlankNumber,0),'ChestFrom',uo.GetSerial('backpack'))
        endif
      endif

      if regi1<>'' then
        CheckLag()
        wait(100)
        uo.findtype(regi1,'0x0000',uo.GetSerial('backpack'))
        if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then
          MoveItems(regi1,'0x0000',str(BlankNumber,0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      if regi2<>'' then
        CheckLag()
        uo.findtype(regi2,'0x0000',uo.GetSerial('backpack'))
        wait(100)
        if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then
          MoveItems(regi2,'0x0000',str(BlankNumber,0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      if regi3<>'' then
        CheckLag()
        uo.findtype(regi3,'0x0000',uo.GetSerial('backpack'))
        wait(100)
        if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then
          MoveItems(regi3,'0x0000',str(BlankNumber,0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      if regi4<>'' then
        CheckLag()
        uo.findtype(regi4,'0x0000',uo.GetSerial('backpack'))
        wait(100)
        if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then
          MoveItems(regi4,'0x0000',str(BlankNumber,0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      CheckLag()
      if (uo.Count(BlankType)<=0) or ((BlankInChest-BlankMinNumber)<BlankNumber) then
        uo.Print('Скрипт работу заканчивает')
        Exit=1
        AllExit=1
      endif
      if (regi1<>'') then
        if (uo.Count(regi1)<=0) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif
      if (regi2<>'') then
        if (uo.Count(regi2)<=0) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif
      if (regi3<>'') then
        if (uo.Count(regi3)<=0) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif
      if (regi4<>'') then
        if (uo.Count(regi4)<=0) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif

      if uo.Mana<mana then
        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()
        Wend
      endif

      if AllExit<>1 then
        k=0
        uo.DeleteJournal()
        CheckLag()
        UO.UseType(BlankType, '0x0000')
        while not UO.InJournal('You put') and not UO.InJournal('fail') and (k<200)
          wait(100)
          k=k+1
        wend
        if (uo.Weight>=MaxWeight) or (uo.Count(Scrolls)>=MaxNumber) then
          Exit=1
        endif
      endif
    wend

    if CExit==0 then
      CheckLag()
      MoveItems(Scrolls,'0x0000','0',uo.GetSerial('backpack'),CurrentBag)

      if (UseBags==1) then
        CheckLag()
        uo.SetReceivingContainer('ChestTo')
        uo.Grab('0',CurrentBag)
        wait(1000)
        uo.UnSetReceivingContainer('ChestTo')
      endif
    endif

    if DoEating==1 then
      CheckLag()
      Eating()
    endif
    wait(3000)
  wend

  uo.Print('Скрипт Inscription остановлен')

end sub # Inscription

##########

Sub SetObjects()

  UO.Print('Выберите сундук-источник с бланками, пустыми мешками и едой: ')
  UO.Exec('addobject ChestFrom')
  While UO.Targeting()
    Wait(100)
  Wend

  UO.Print('Выберите сундук-источник с реагентами: ')
  UO.Exec('addobject ChestFrom2')
  While UO.Targeting()
    Wait(100)
  Wend

  UO.Print('Выберите сундук-приемник: ')
  UO.Exec('addobject ChestTo')
  While UO.Targeting()
    Wait(100)
  Wend

end sub # SetObjects

##########

Sub CheckLag()

  while (uo.ObjAtLayer('Bpack')=='')
    wait(1000)
  wend
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  uo.DeleteJournal()
  uo.Click('backpack')
  repeat
    wait(50)
  until uo.InJournal('backpack')

end sub # CheckLag

##########

Sub MoveItems(ItemType,ItemColor,ItemQuantity,FromContainer,ToContainer)

var CurrentQuantity, flag=true

  CheckLag()
  uo.SetReceivingContainer(ToContainer)

  uo.FindType(ItemType,ItemColor,FromContainer)
  wait(100)
  CurrentQuantity=uo.GetQuantity('finditem') ## кол-во предметов в найденной стопке

  while (uo.FindCount()>0) and (flag==true) ## если что-то нашли и еще не все нужное переместили
    CheckLag()
    if val(ItemQuantity)<=CurrentQuantity then ## если переместить нужно все или меньше, чем в стопке
      uo.Grab(ItemQuantity,'finditem') ## перемещаем всю стопку или заданное кол-во
      wait(500)
      if ItemQuantity=='0' then ## если переместить надо все
        CheckLag()
        uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
        wait(100)
        CurrentQuantity=uo.GetQuantity('finditem')
      else ## если уже переместили нужное кол-во - выход из процедуры
        flag=false
      endif
    else ## если переместить нужно не все, но больше, чем в найденной стопке
      uo.Grab('0','finditem') ## перемещаем всю стопку
      wait(500)
      ItemQuantity=str((val(ItemQuantity)-CurrentQuantity),0) ## вычисляем, сколько еще нужно
      CheckLag()
      uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
      wait(100)
      CurrentQuantity=uo.GetQuantity('finditem')
    endif
  wend

  uo.UnSetReceivingContainer(ToContainer)

end sub # MovingItems

##########

Sub Eating()

var flag=true

  MoveItems(FoodType,'-1','10','ChestFrom',uo.GetSerial('backpack'))

  repeat
    uo.DeleteJournal()
    uo.FindType(FoodType,'-1',uo.GetSerial('backpack'))
    wait(100)
    if uo.FindCount()>0 then
      CheckLag()
      uo.UseType(FoodType)
      repeat
        wait(100)
      until uo.InJournal('full') or uo.InJournal('stuffed') or uo.InJournal('hungry') or uo.InJournal('satiated') or uo.Dead()
      wait(1000)
    else
      flag=false
    endif
  until uo.InJournal('too full') or uo.Dead() or (flag==false)

  MoveItems(FoodType,'-1','0',uo.GetSerial('backpack'),'ChestFrom')

end sub # Eating

##########

Sub Open(Container)

  CheckLag()
  uo.UseObject(Container)
  wait(3000)

end sub # Open

##########

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

end sub # 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)
  endif

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

  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)
  endif

  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)
  endif

  return hh+":"+mm+":"+ss

end sub # Time

##########

Sub ToHide()
  while not uo.Hidden()
    uo.Print('Пытаемся уйти в хайд...')
    CheckLag()
    uo.UseSkill('Hiding')
    repeat
      wait(200)
    until uo.InJournal('have hidden') or uo.InJournal('seem to hide')
    wait(100)
  wend
end sub # ToHide

##########

Sub ToHeal()
  var k
  while uo.Life < (uo.Str-10)
    CheckLag()
    uo.BandageSelf()
    k=0
    repeat
      Wait(100)
      k=k+1
    until UO.InJournal("You put") or UO.InJournal("barely help") or UO.InJournal("don't need") or k>300
  wend
end sub # ToHeal

_________________
Никогда не бойся делать то, что ты не умеешь!

Помни, ковчег был построен любителем. Профессионалы построили "Титаник".


Last edited by Corwin on 2005-09-05 09:52:50, edited 1 time in total.

Top
   
 Post subject:
PostPosted: 2005-09-05 09:35:50 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Alchemy full

Написан на основе предыдущего скрипта на inscription. Позволяет сделать любой крафт, кроме рунбуки.

Настройка производится так же, как и в Inscription full.

Ну и, естественно, хайд и лечение бинтами.

Code:
############################################################################################
###                                                                                      ###
###                                 Alchemy / Алхимия                                    ###
###                                  Шард Dragon World                                   ###
###                                        v2.85                                         ###
###                                                                                      ###
###                                    Автор  Corwin                                     ###
###                                                                                      ###
###                             Тестирование  Euronimus                                  ###
###                                                                                      ###
############################################################################################

############################################################################################
### Глобальные переменные ###
#############################

## к скрипту Alchemy
var BottleType='0x0F0E'  ## - тип пустой бутылки
var BottleNumber=100     ## - количество бутылок, забираемое из сундука за раз
var BottleMinNumber=0    ## - минимальное количество бутылок, которое надо оставить в сундуке
var DoEating=1           ## 1 - включить потребление еды, 0 - отключить
var FoodType='0x097B'    ## - тип еды, которую будем есть (fish steaks)
var BagType='0x0E76'     ## - тип мешка для складывания вещей
var MaxWeight=700        ## - максимальный вес в рюкзаке
var MaxNumber=500        ## - максимальное количество делаемых вещей в рюкзаке и для заполнения одного мешка
var Reconnect=0          ## 1 - включить реконнект на сервер, если выкинет, 0 - отключить реконнект
var UseBags=0            ## 1 - использовать раскладывание делаемых бутылок по мешкам
var UseHide=1            ## 1 - включить уход в хайд во время крафта, 0 - отключить
var UseHeal=0            ## 1 - включить лечение в хайд во время крафта, если здоровье падает, 0 - отключить

############################################################################################
### Код скрипта ###
###################

# Формат вызова процедуры алхимии для получения нужного снадобья
# Sub Alchemy('тип реагента 1', 'тип реагента 2', 'тип реагента 3', 'название снадобья в меню крафта',
#             'цвет бутылки с готовым снадобьем', количество реагента 1 для одного крафта,
#             количество реагента 2 для одного крафта, количество реагента 3 для одного крафта)

sub Agility()
  Alchemy("0x0F7B", "", "", "Agility", "0x0489", 1, 0, 0)
end sub

sub GreaterAgility()
  Alchemy("0x0F7B", "", "", "Greater Agility", "0x0489", 3, 0, 0)
end sub

sub LesserCure()
  Alchemy("0x0F84", "", "", "Lesser Cure", "0x09A6", 1, 0, 0)
end sub

sub Cure()
  Alchemy("0x0F84", "", "", "Cure", "0x09A6", 3, 0, 0)
end sub

sub GreaterCure()
  Alchemy("0x0F84", "", "", "Greater Cure", "0x09A6", 6, 0, 0)
end sub

sub LesserHeal()
  Alchemy("0x0F85", "", "", "Lesser Heal", "0x09BB", 1, 0, 0)
end sub

sub Heal()
  Alchemy("0x0F85", "", "", "Heal", "0x09BB", 3, 0, 0)
end sub

sub GreaterHeal()
  Alchemy("0x0F85", "", "", "Greater Heal", "0x09BB", 7, 0, 0)
end sub

sub NightSight()
  Alchemy("0x0F8D", "", "", "Nightsight", "0x0B9D", 1, 0, 0)
end sub

sub LesserPoison()
  Alchemy("0x0F88", "", "", "Lesser Poison", "0x0998", 1, 0, 0)
end sub

sub Poison()
  Alchemy("0x0F88", "", "", "Poison", "0x0998", 2, 0, 0)
end sub

sub GreaterPoison()
  Alchemy("0x0F88", "", "", "Greater Poison", "0x0998", 3, 0, 0)
end sub

sub DeadlyPoison()
  Alchemy("0x0F88", "", "", "Deadly Poison", "0x0998", 8, 0, 0)
end sub

sub Refresh()
  Alchemy("0x0F7A", "", "", "Refresh", "0x0997", 1, 0, 0)
end sub

sub TotalRefresh()
  Alchemy("0x0F7A", "", "", "Total Refresh", "0x0997", 5, 0, 0)
end sub

sub Strength()
  Alchemy("0x0F86", "", "", "Strength", "0x0482", 2, 0, 0)
end sub

sub GreaterStrength()
  Alchemy("0x0F86", "", "", "Greater Strength", "0x0482", 5, 0, 0)
end sub

sub Shrink()
  Alchemy("0x0F78", "", "", "Shrink", "0x0388", 10, 0, 0)
end sub

sub Invisibility()
  Alchemy("0x0F91", "", "", "Invisibility", "0x0631", 4, 0, 0)
end sub

sub ManaRefresh()
  Alchemy("0x0F87", "", "", "Total Mana", "0x09DF", 3, 0, 0)
end sub

sub TotalManaRefresh()
  Alchemy("0x0F87", "", "", "Total Mana", "0x09DF", 6, 0, 0)
end sub

sub Clever()
  Alchemy("0x0F81", "", "", "Clever", "0x0482", 1, 0, 0)
end sub

sub GreaterClever()
  Alchemy("0x0F81", "", "", "Greater Clever", "0x0482", 2, 0, 0)
end sub

sub Bless()
  Alchemy("0x0F81", "0x0F86", "0x0F7B", "Bless", "0x09C5", 1, 1, 1)
end sub

sub GreaterBless()
  Alchemy("0x0F81", "0x0F86", "0x0F7B", "Greater Bless", "0x09C5", 2, 5, 3)
end sub

sub Steelskin()
  Alchemy("0x0F84", "0x0F85", "0x0F86", "Steelskin", "0x0962", 1, 1, 2)
end sub

sub Stoneskin()
  Alchemy("0x0F84", "0x0F85", "0x0F86", "Stoneskin", "0x0964", 1, 1, 1)
end sub

sub LavaBomb()
  Alchemy("0x0F8F", "", "", "Lava Bomb", "0x09DA", 1, 0, 0)
end sub

#sub RuneBook()
#  Alchemy("0x1F4C", "0x0E34", "0x0F80", "0x0F90", "Runebook", "0x0510", 50, 50, 50, 50)
#end sub
#
############################################################################################
### Процедуры поддержки ###
###########################

Sub Alchemy(Reagent1, Reagent2, Reagent3, Potion, BottleColor, ReagentNumber1, ReagentNumber2, ReagentNumber3)

var Exit, AllExit=0, CExit=0, k, findnumber
var BottleInChest=0
var ReagentNumber=0
var CurrentBag
var tmp

  UO.Exec ('set distance 2')
  uo.Exec('set finddistance 3')
  UO.UnSetReceivingContainer()
  UO.DeleteJournal()
  UO.CancelMenu()
  uo.AutoMenu('What sort of potion do you want to', Potion)

  SetObjects()
  uo.IgnoreReset()

  Open('ChestFrom')
  Open('ChestFrom2')
  Open('ChestTo')

  if Reconnect==1 then
    uo.Exec('exec Reconnect')
  endif

  while not uo.Dead() and not (AllExit==1) and not (CExit==1)
    uo.DeleteJournal()
    Exit=0

    if (UseBags==1) then
      uo.SetReceivingContainer('backpack')

      CheckLag()
      uo.print('Выбираем пустой мешок')
      uo.findtype(BagType,'-1','backpack')
      wait(100)
      if uo.findcount()<=0 then
        while Exit==0
          uo.findtype(BagType,'-1','ChestFrom')
          wait(100)
          if uo.findcount()>0 then
            CurrentBag=uo.GetSerial('finditem')
            Open(CurrentBag)
            uo.findtype('-1','-1',CurrentBag)
            wait(100)
            if uo.findcount()>0 then
              uo.Ignore(CurrentBag,'on')
            else
              uo.grab('0',CurrentBag)
              wait(1000)
              uo.IgnoreReset()
              Exit=1
            endif
          else
            uo.print('Пустые мешки закончились, скрипт остановлен')
            uo.IgnoreReset()
            Exit=1
            CExit=1
          endif
        wend
      else
        CurrentBag=uo.getserial('finditem')
      endif

      wait(1000)
      uo.UnSetReceivingContainer('backpack')
      Exit=0
    else
      CurrentBag=uo.getserial('ChestTo')
    endif

    while (Exit==0) and (CExit==0)
      if UseHeal == 1 then
        ToHeal()
      endif
      if UseHide == 1 then
        ToHide()
      endif

      CheckLag()
      uo.findtype(BottleType,'0x0000','ChestFrom')
      wait(100)
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<0) then
        BottleInChest=0
      else
        BottleInChest=uo.GetQuantity('finditem')
      endif

      CheckLag()
      uo.findtype(BottleType,'0x0000',uo.GetSerial('backpack'))
      wait(100)
      if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then
        if (BottleInChest-BottleMinNumber)<BottleNumber then
          MoveItems(BottleType,'0x0000',str((BottleInChest-BottleMinNumber),0),'ChestFrom',uo.GetSerial('backpack'))
        else
          MoveItems(BottleType,'0x0000',str(BottleNumber,0),'ChestFrom',uo.GetSerial('backpack'))
        endif
      endif

      if Reagent1<>'' then
        CheckLag()
        uo.findtype(Reagent1,'0x0000',uo.GetSerial('backpack'))
        wait(100)
        ReagentNumber = uo.GetQuantity('finditem')
        if (uo.findcount()<=0) or (ReagentNumber<ReagentNumber1) then
          MoveItems(Reagent1,'0x0000',str((ReagentNumber1*BottleNumber-ReagentNumber),0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      if Reagent2<>'' then
        CheckLag()
        uo.findtype(Reagent2,'0x0000',uo.GetSerial('backpack'))
        wait(100)
        ReagentNumber = uo.GetQuantity('finditem')
        if (uo.findcount()<=0) or (ReagentNumber<ReagentNumber2) then
          MoveItems(Reagent2,'0x0000',str((ReagentNumber2*BottleNumber-ReagentNumber),0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      if Reagent3<>'' then
        CheckLag()
        uo.findtype(Reagent3,'0x0000',uo.GetSerial('backpack'))
        wait(100)
        ReagentNumber = uo.GetQuantity('finditem')
        if (uo.findcount()<=0) or (ReagentNumber<ReagentNumber3) then
          MoveItems(Reagent3,'0x0000',str((ReagentNumber3*BottleNumber-ReagentNumber),0),'ChestFrom2',uo.GetSerial('backpack'))
        endif
      endif

      CheckLag()
      if (uo.Count(BottleType)<=0) or ((BottleInChest-BottleMinNumber)<BottleNumber) then
        uo.Print('Скрипт работу заканчивает')
        Exit=1
        AllExit=1
      endif
      if (Reagent1<>'') then
        if (uo.Count(Reagent1)<ReagentNumber1) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif
      if (Reagent2<>'') then
        if (uo.Count(Reagent2)<ReagentNumber2) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif
      if (Reagent3<>'') then
        if (uo.Count(Reagent3)<ReagentNumber3) and (AllExit<>1) then
          uo.Print('Скрипт работу заканчивает')
          Exit=1
          AllExit=1
        endif
      endif

      if AllExit<>1 then
        k=0
        uo.DeleteJournal()
        CheckLag()
        uo.UseType(Reagent1,'0x0000')
        while not UO.InJournal('You put the') and not UO.InJournal('You toss the failed') and (k<200)
          wait(100)
          k=k+1
        wend
        if (uo.Weight>=MaxWeight) or (uo.Count(BottleType,BottleColor)>=MaxNumber) then
          Exit=1
        endif
      endif
    wend

    if CExit==0 then
      CheckLag()
      MoveItems(BottleType,BottleColor,'0',uo.GetSerial('backpack'),CurrentBag)

      if (UseBags==1) then
        CheckLag()
        uo.SetReceivingContainer('ChestTo')
        uo.Grab('0',CurrentBag)
        wait(1000)
        uo.UnSetReceivingContainer('ChestTo')
      endif
    endif

    if DoEating==1 then
      CheckLag()
      Eating()
    endif
    wait(3000)
  wend

  uo.Print('Скрипт Alchemy остановлен')
end sub

##########

Sub SetObjects()

  UO.Print('Выберите сундук-источник с пустыми бутылками, пустыми мешками и едой: ')
  UO.Exec('addobject ChestFrom')
  While UO.Targeting()
    Wait(100)
  Wend

  UO.Print('Выберите сундук-источник с реагентами: ')
  UO.Exec('addobject ChestFrom2')
  While UO.Targeting()
    Wait(100)
  Wend

  UO.Print('Выберите сундук-приемник: ')
  UO.Exec('addobject ChestTo')
  While UO.Targeting()
    Wait(100)
  Wend

end sub # SetObjects

##########

Sub CheckLag()

  while (uo.ObjAtLayer('Bpack')=='')
    wait(1000)
  wend
  if UO.Waiting() then
    UO.CancelTarget()
  endif
  uo.DeleteJournal()
  uo.Click('backpack')
  repeat
    wait(50)
  until uo.InJournal('backpack')

end sub # CheckLag

##########

Sub MoveItems(ItemType,ItemColor,ItemQuantity,FromContainer,ToContainer)

var CurrentQuantity, flag=true

  CheckLag()
  uo.SetReceivingContainer(ToContainer)

  uo.FindType(ItemType,ItemColor,FromContainer)
  wait(100)
  CurrentQuantity=uo.GetQuantity('finditem') ## кол-во предметов в найденной стопке

  while (uo.FindCount()>0) and (flag==true) ## если что-то нашли и еще не все нужное переместили
    CheckLag()
    if val(ItemQuantity)<=CurrentQuantity then ## если переместить нужно все или меньше, чем в стопке
      uo.Grab(ItemQuantity,'finditem') ## перемещаем всю стопку или заданное кол-во
      wait(500)
      if ItemQuantity=='0' then ## если переместить надо все
        CheckLag()
        uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
        wait(100)
        CurrentQuantity=uo.GetQuantity('finditem')
      else ## если уже переместили нужное кол-во - выход из процедуры
        flag=false
      endif
    else ## если переместить нужно не все, но больше, чем в найденной стопке
      uo.Grab('0','finditem') ## перемещаем всю стопку
      wait(500)
      ItemQuantity=str((val(ItemQuantity)-CurrentQuantity),0) ## вычисляем, сколько еще нужно
      CheckLag()
      uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку
      wait(100)
      CurrentQuantity=uo.GetQuantity('finditem')
    endif
  wend

  uo.UnSetReceivingContainer(ToContainer)

end sub # MovingItems

##########

Sub Eating()

var flag=true

  MoveItems(FoodType,'-1','10','ChestFrom',uo.GetSerial('backpack'))

  repeat
    uo.DeleteJournal()
    uo.FindType(FoodType,'-1',uo.GetSerial('backpack'))
    wait(100)
    if uo.FindCount()>0 then
      CheckLag()
      uo.UseType(FoodType)
      repeat
        wait(100)
      until uo.InJournal('full') or uo.InJournal('stuffed') or uo.InJournal('hungry') or uo.InJournal('satiated') or uo.Dead()
      wait(1000)
    else
      flag=false
    endif
  until uo.InJournal('too full') or uo.Dead() or (flag==false)

  MoveItems(FoodType,'-1','0',uo.GetSerial('backpack'),'ChestFrom')

end sub # Eating

##########

Sub Open(Container)

  CheckLag()
  uo.UseObject(Container)
  wait(3000)

end sub # Open

##########

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

end sub # 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)
  endif

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

  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)
  endif

  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)
  endif

  return hh+":"+mm+":"+ss

end sub # Time

##########

Sub ToHide()
  while not uo.Hidden()
    uo.Print('Пытаемся уйти в хайд...')
    CheckLag()
    uo.UseSkill('Hiding')
    repeat
      wait(200)
    until uo.InJournal('have hidden') or uo.InJournal('seem to hide')
    wait(100)
  wend
end sub # ToHide

##########

Sub ToHeal()
  var k
  while uo.Life < (uo.Str-10)
    CheckLag()
    uo.BandageSelf()
    k=0
    repeat
      Wait(100)
      k=k+1
    until UO.InJournal("You put") or UO.InJournal("barely help") or UO.InJournal("don't need") or k>300
  wend
end sub # ToHeal

_________________
Никогда не бойся делать то, что ты не умеешь!

Помни, ковчег был построен любителем. Профессионалы построили "Титаник".


Top
   
 Post subject:
PostPosted: 2005-09-05 10:58:50 
Offline
Expert!
User avatar

Joined: 2004-07-04 00:14:58
Posts: 1284
а массивы для лохов придумали :roll:


Top
   
 Post subject:
PostPosted: 2005-09-05 11:21:03 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Sfagnum wrote:
а массивы для лохов придумали :roll:

Ага, а "единственно верный способ - мой" - так? :wink: :lol:

_________________
Никогда не бойся делать то, что ты не умеешь!

Помни, ковчег был построен любителем. Профессионалы построили "Титаник".


Top
   
 Post subject:
PostPosted: 2005-09-05 11:28:41 
Offline
Sphere expert
User avatar

Joined: 2004-10-01 08:27:38
Posts: 1143
Location: Уфа
Sfagnum wrote:
а массивы для лохов придумали :roll:

Ты чё злой такой ?

_________________
Сделал дело - флуди смело !!!


Top
   
 Post subject:
PostPosted: 2005-09-05 12:40:18 
Offline
Expert!
User avatar

Joined: 2004-07-04 00:14:58
Posts: 1284
Corwin wrote:
Sfagnum wrote:
а массивы для лохов придумали :roll:
Ага, а "единственно верный способ - мой" - так? :wink: :lol:
ты мой видел?

гыг :D
таки мой блок в скрипте есть :) как минимум один... правда нахерам то переделанный по "правильному".


Last edited by Sfagnum on 2005-09-05 12:57:18, edited 1 time in total.

Top
   
 Post subject:
PostPosted: 2005-09-05 12:40:47 
Offline
Expert!
User avatar

Joined: 2004-07-04 00:14:58
Posts: 1284
Askaneli wrote:
Sfagnum wrote:
а массивы для лохов придумали :roll:
Ты чё злой такой ?
не злой... скролить скрипт пустяшный устал.


Top
   
 Post subject:
PostPosted: 2005-09-05 12:44:17 
Offline
Sphere expert
User avatar

Joined: 2004-10-01 08:27:38
Posts: 1143
Location: Уфа
Sfagnum wrote:
Askaneli wrote:
Sfagnum wrote:
а массивы для лохов придумали :roll:
Ты чё злой такой ?
не злой... скролить скрипт пустяшный устал.

Я сбоку проста движок передёрнул.

_________________
Сделал дело - флуди смело !!!


Top
   
 Post subject:
PostPosted: 2005-09-05 12:47:59 
Offline

Joined: 2005-05-22 08:35:28
Posts: 25
Sfagnum wrote:
Corwin wrote:
Sfagnum wrote:
а массивы для лохов придумали :roll:
Ага, а "единственно верный способ - мой" - так? :wink: :lol:
ты мой видел?

Если не совсем понятно, поясняю - я иронизирую ;)
Твоего скрипта я не видел; верю, что он ничуть не хуже и, вполне возможно, намного лучше, чем мой.
Однако писал я этот скрипт для себя и моим собственным запросам он полностью удовлетворяет. Если кому-то скрипт пригодится именно в таком виде - замечательно. Нет - сильно не огорчусь.
Критика всегда полезна. Но критиковать в _грубой_ форме считаю несколько неуместным.

_________________
Никогда не бойся делать то, что ты не умеешь!

Помни, ковчег был построен любителем. Профессионалы построили "Титаник".


Last edited by Corwin on 2005-09-05 13:26:46, edited 3 times in total.

Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 38 posts ]  Go to page 1 2 Next

All times are UTC+02:00


Who is online

Users browsing this forum: Bing [Bot] 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