Какбе работает.
Надеюсь, со свитками не промахнулся.
Кому важна красивая табуляция, ссылка на текстовый документ:
http://orden-armageddon.org/files/scripts/magicbook.sc
Code:
# Книга магии для Dragon World - http://drw.ru
# Сходил с ума: Vitali De Vir
# Редакция от: 2008-06-07
#
# Каст по заданному таргету. WT - With Target
# cast_wt(scrollmana, castmana, drinkmana, scroll, cast, target, msgStatScr, msgStat)
#
# Каст по ручному таргету. WO - Without Target
# cast_wo(scrollmana, castmana, drinkmana, scroll, cast, msgStatScr, msgStat)
#
# Заметки.
# Хорошо смотрится в текстовом редакторе под шрифтом Lucida Console.
# Вносите вклады: http://forum.yoko.com.ua/viewtopic.php?t=13635
# First Circle
sub mgwt_clumsy()
   cast_wt(5,  10, 1, '0x1F2D', 'Clumsy',      'lastattack',    "Clumsy by scroll!",       "Clumsy NOT by scroll!")
end sub
sub mgwo_createfood()
   cast_wo(8,  16, 1, '0x1F2E', 'Create Food',         "Create Food by scroll!",    "Create Food NOT by scroll!")
end sub
sub mgwt_feeblemind()
   cast_wt(5,  10, 1, '0x1F2F', 'Feeblemind',   'lastattack',    "Feeblemind by scroll!",    "Feeblemind NOT by scroll!")
end sub
sub mgwt_heal()
   cast_wt(5,  10, 1, '0x1F30', 'Heal',      'self',      "Heal by scroll!",       "Heal NOT by scroll!")
end sub
sub mgwt_magicarrow()
   cast_wt(6,  12, 1, '0x1F31', 'Magic Arrow',    'lastattack',    "Magic Arrow by scroll!",    "Magic Arrow NOT by scroll!")
end sub
sub mgwt_magicarrow_ls()
   cast_wt(6,  12, 1, '0x1F31', 'Magic Arrow',    'laststatus',    "Magic Arrow by scroll!",    "Magic Arrow NOT by scroll!")
end sub
sub mgwo_nightsight()
   cast_wo(8,  16, 1, '0x1F32', 'Night Sight',          "Night Sight by scroll!",    "Night Sight NOT by scroll!")
end sub
sub mgwt_reactivearmor()
   cast_wt(5,  10, 1, '0x1F33', 'Reactive Armor',   'self',      "Reactive Armor by scroll!",    "Reactive Armor NOT by scroll!")
end sub
sub mgwt_weaken()
   cast_wt(8,  16, 1, '0x1F34', 'Weaken',       'lastattack',    "Weaken by scroll!",       "Weaken NOT by scroll!")
end sub
   
# Second Circle
sub mgwt_agility()
   cast_wt(8,  16, 1, '0x1F35', 'Agility',      'self',      "Agility by scroll!",       "Agility NOT by scroll!")
end sub
sub mgwt_cunning()
   cast_wt(8,  16, 1, '0x1F36', 'Cunning',      'self',      "Cunning by scroll!",       "Cunning NOT by scroll!")
end sub
sub mgwt_cure_sf()
   cast_wt(8,  16, 1, '0x1F37', 'Cure',      'self',      "Cure by scroll!",       "Cure NOT by scroll!")
end sub
sub mgwt_cure_ls()
   cast_wt(8,  16, 1, '0x1F37', 'Cure',      'laststatus',   "Cure by scroll!",       "Cure NOT by scroll!")
end sub
sub mgwt_harm()
   cast_wt(6,  12, 1, '0x1F38', 'Harm',      'lastattack',    "Harm by scroll!",       "Harm NOT by scroll!")
end sub
sub mgwo_magictrap()
   cast_wo(6,  12, 1, '0x1F39', 'Magic Trap',         "Magic Trap by scroll!",    "Magic Trap NOT by scroll!")
end sub
sub mgwo_magicuntrap()
   cast_wo(6,  12, 1, '0x1F3A', 'Magic Untrap',         "Magic Untrap by scroll!",    "Magic Untrap NOT by scroll!")
end sub
sub mgwt_protection()
   cast_wt(8,  16, 1, '0x1F3B', 'Protection',   'self',      "Protection by scroll!",    "Protection NOT by scroll!")
end sub
sub mgwt_strength()
   cast_wt(8,  16, 1, '0x1F3C', 'Strength',   'self',      "Strength by scroll!",       "Strength NOT by scroll!")
end sub
# Third Circle
sub mgwo_bless()
   cast_wo(10, 20, 1, '0x1F3D', 'Bless',            "Bless by scroll!",       "Bless NOT by scroll!")
end sub
sub mgwt_fireball()
   cast_wt(7,  14, 1, '0x1F3E', 'Fireball',   'lastattack',    "Fireball by scroll!",       "Fireball NOT by scroll!")
end sub
sub mgwo_magiclock()
   cast_wo(10, 20, 1, '0x1F3F', 'Magic Lock',         "Magic Lock by scroll!",    "Magic Lock NOT by scroll!")
end sub
sub mgwt_poison()
   cast_wt(7,  14, 1, '0x1F40', 'Poison',      'lastattack',    "Poison by scroll!",       "Poison NOT by scroll!")
end sub
sub mgwo_telekinesis()
   cast_wo(10, 20, 1, '0x1F41', 'Telekinesis',          "Telekinesis by scroll!",    "Telekinesis NOT by scroll!")
end sub
sub mgwo_teleport()
   cast_wo(7,  14, 1, '0x1F42', 'Teleport',         "Teleport by scroll!",       "Teleport NOT by scroll!")
end sub
sub mgwo_unlock()
   cast_wo(7,  14, 1, '0x1F43', 'Unlock',            "Unlock by scroll!",       "Unlock NOT by scroll!")
end sub
sub mgwo_wallofstone()
   cast_wo(10, 20, 1, '0x1F44', 'Wall of Stone',         "Wall of Stone by scroll!",    "Wall of Stone NOT by scroll!")
end sub
sub mgwt_wallofstone()
   cast_wt(10, 20, 1, '0x1F44', 'Wall of Stone',   'backpack',   "Wall of Stone by scroll!",    "Wall of Stone NOT by scroll!")
end sub
# Fourth Circle
sub mgwt_archcure()
   cast_wt(12, 24, 1, '0x1F45', 'Arch Cure',   'self',      "Arch Cure by scroll!",      "Arch Cure NOT by scroll!")
end sub
sub mgwt_archprotection()
   cast_wt(12, 24, 1, '0x1F46', 'Arch Protection',   'self',      "Arch Protection by scroll!",    "Arch Protection NOT by scroll!")
end sub
sub mgwo_curse()
   cast_wo(8,  16, 1, '0x1F47', 'Curse',            "Curse by scroll!",      "Curse NOT by scroll!")
end sub
sub mgwt_curse()
   cast_wt(8,  16, 1, '0x1F47', 'Curse',      'lastattack',   "Curse by scroll!",      "Curse NOT by scroll!")
end sub
sub mgwo_firefield()
   cast_wo(12, 24, 1, '0x1F48', 'Fire Field',         "Fire Field by scroll!",   "Fire Field NOT by scroll!")
end sub
sub mgwt_firefield()
   cast_wt(12, 24, 1, '0x1F48', 'Fire Field',   'backpack',   "Fire Field by scroll!",   "Fire Field NOT by scroll!")
end sub
sub mgwt_greaterheal_sf()
   cast_wt(8,  16, 1, '0x1F49', 'Greater Heal',   'self',      "Greater Heal by scroll!",    "Greater Heal NOT by scroll!")
end sub
sub mgwt_greaterheal_ls()
   cast_wt(8,  16, 1, '0x1F49', 'Greater Heal',   'laststatus',   "Greater Heal by scroll!",    "Greater Heal NOT by scroll!")
end sub
sub mgwt_lightning()
   cast_wt(8,  16, 1, '0x1F4A', 'Lightning',   'lastattack',   "Lightning by scroll!",    "Lightning NOT by scroll!")
end sub
sub mgwt_manadrain()
   cast_wt(8,  16, 1, '0x1F4B', 'Mana Drain',   'lastattack',   "Mana Drain by scroll!",   "Mana Drain NOT by scroll!")
end sub
sub mgwo_recall()
   cast_wo(10, 20, 1, '0x1F4C', 'Recall',            "Recall by scroll!",       "Recall NOT by scroll!")
end sub
# Fifth Circle
sub mgwo_bladespirit()
   cast_wo(12, 24, 1, '0x1F4D', 'Blade Spirit',         "Blade Spirit by scroll!",   "Blade Spirit NOT by scroll!")
end sub
sub mgwt_bladespirit()
   cast_wt(12, 24, 1, '0x1F4D', 'Blade Spirit',   'backpack',   "Blade Spirit by scroll!",   "Blade Spirit NOT by scroll!")
end sub
sub mgwo_dispelfield()
   cast_wo(7,  14, 1, '0x1F4E', 'Dispel Field',         "Dispel Field by scroll!",   "Dispel Field NOT by scroll!")
end sub
sub mgwt_incognito()
   cast_wt(10, 20, 1, '0x1F4F', 'Incognito',   'self',      "Incognito by scroll!",      "Incognito NOT by scroll!")
end sub
sub mgwt_magicreflection()
   cast_wt(9,  18, 1, '0x1F50', 'Magic Reflection','self',      "Magic Reflection by scroll!",   "Magic Reflection NOT by scroll!")
end sub
sub mgwt_mindblast()
   cast_wt(9,  18, 1, '0x1F51', 'Mind Blast',   'lastattack',   "Mind Blast by scroll!",   "Mind Blast NOT by scroll!")
end sub
sub mgwt_paralyze()
   cast_wt(9,  18, 1, '0x1F52', 'Paralyze',   'lastattack',   "Paralyze by scroll!",      "Paralyze NOT by scroll!")
end sub
sub mgwo_poisonfield()
   cast_wo(12, 24, 1, '0x1F53', 'Poison Field',         "Poison Field by scroll!",   "Poison Field NOT by scroll!")
end sub
sub mgwt_poisonfield()
   cast_wt(12, 24, 1, '0x1F53', 'Poison Field',   'backpack',   "Poison Field by scroll!",   "Poison Field NOT by scroll!")
end sub
sub mgwo_summoncreature()
   cast_wo(12, 24, 1, '0x1F54', 'Summon creature',         "Summon creature by scroll!",   "Summon creature NOT by scroll!")
end sub
# Sixth Circle
sub mgwo_dispel()
   cast_wo(8,  16, 1, '0x1F55', 'Dispel',            "Dispel by scroll!",      "Dispel NOT by scroll!")
end sub
sub mgwt_dispel()
   cast_wt(8,  16, 1, '0x1F55', 'Dispel',      'self',      "Dispel by scroll!",      "Dispel NOT by scroll!")
end sub
sub mgwt_energybolt()
   cast_wt(10, 20, 1, '0x1F56', 'Energy Bolt',   'lastattack',   "Energy Bolt by scroll!",   "Energy Bolt NOT by scroll!")
end sub
sub mgwt_explosion()
   cast_wt(10, 20, 1, '0x1F57', 'Explosion',   'lastattack',   "Explosion by scroll!",      "Explosion NOT by scroll!")
end sub
sub mgwo_invisibility()
   cast_wo(10, 20, 1, '0x1F58', 'Invisibility',         "Invisibility by scroll!",   "Invisibility NOT by scroll!")
end sub
sub mgwo_mark()
   cast_wo(17, 33, 1, '0x1F59', 'Mark',            "Mark by scroll!",      "Mark NOT by scroll!")
end sub
sub mgwo_masscurse()
   cast_wo(12, 24, 1, '0x1F5A', 'Mass Curse',         "Mass Curse by scroll!",   "Mass Curse NOT by scroll!")
end sub
sub mgwo_paralyzefield()
   cast_wo(12, 24, 1, '0x1F5B', 'Paralyze Field',         "Paralyze Field by scroll!",   "Paralyze Field NOT by scroll!")
end sub
sub mgwt_paralyzefield()
   cast_wt(12, 24, 1, '0x1F5B', 'Paralyze Field',   'backpack',   "Paralyze Field by scroll!",   "Paralyze Field NOT by scroll!")
end sub
sub mgwo_reveal()
   cast_wo(10, 20, 1, '0x1F5C', 'Reveal',            "Reveal by scroll!",      "Reveal NOT by scroll!")
end sub
# Seventh Circle
sub mgwt_chainlightning()
   cast_wt(12, 24, 1, '0x1F5D', 'Chain Lightning',   'self',      "Chain Lightning by scroll!",   "Chain Lightning NOT by scroll!")
end sub
sub mgwo_energyfield()
   cast_wo(12, 24, 1, '0x1F5E', 'Energy Field',         "Energy Field by scroll!",   "Energy Field NOT by scroll!")
end sub
sub mgwt_energyfield()
   cast_wt(12, 24, 1, '0x1F5E', 'Energy Field',   'backpack',   "Energy Field by scroll!",   "Energy Field NOT by scroll!")
end sub
sub mgwt_flamestrike()
   cast_wt(11, 22, 1, '0x1F5F', 'Flame Strike',   'lastattack',   "Flame Strike by scroll!",   "Flame Strike NOT by scroll!")
end sub
sub mgwo_gatetravel()
   cast_wo(14, 27, 1, '0x1F60', 'Gate Travel',         "Gate Travel by scroll!",   "Gate Travel NOT by scroll!")
end sub
sub mgwt_manavampire()
   cast_wt(11, 22, 1, '0x1F61', 'Mana Vampire',   'lastattack',   "Mana Vampire by scroll!",   "Mana Vampire NOT by scroll!")
end sub
sub mgwt_massdispel()
   cast_wt(11, 22, 1, '0x1F62', 'Mass Dispel',   'self',      "Mass Dispel by scroll!",   "Mass Dispel NOT by scroll!")
end sub
sub mgwt_meteorswarm()
   cast_wt(12, 24, 1, '0x1F63', 'Meteor Swarm',   'self',      "Meteor Swarm by scroll!",   "Meteor Swarm NOT by scroll!")
end sub
sub mgwo_polymorph()
   cast_wo(12, 24, 1, '0x1F64', 'Polymorph',         "Polymorph by scroll!",      "Polymorph NOT by scroll!")
end sub
# Eighth Circle
sub mgwo_earthquake()
   cast_wo(14, 27, 1, '0x1F65', 'Earthquake',         "Earthquake by scroll!",   "Earthquake NOT by scroll!")
end sub
sub mgwo_energyvortex()
   cast_wo(14, 27, 1, '0x1F66', 'Energy Vortex',         "Energy Vortex by scroll!",   "Energy Vortex NOT by scroll!")
end sub
sub mgwt_energyvortex()
   cast_wt(14, 27, 1, '0x1F66', 'Energy Vortex',   'backpack',   "Energy Vortex by scroll!",   "Energy Vortex NOT by scroll!")
end sub
sub mgwo_resurrection()
   cast_wo(12, 24, 1, '0x1F67', 'Resurrection',         "Resurrection by scroll!",   "Resurrection NOT by scroll!")
end sub
sub mgwt_resurrection()
   cast_wt(12, 24, 1, '0x1F67', 'Resurrection',   'laststatus',   "Resurrection by scroll!",   "Resurrection NOT by scroll!")
end sub
sub mgwo_airelemental()
   cast_wo(14, 27, 1, '0x1F68', 'Air Elemental',         "Air Elemental by scroll!",   "Air Elemental NOT by scroll!")
end sub
sub mgwo_daemon()
   cast_wo(14, 27, 1, '0x1F69', 'Daemon',            "Daemon by scroll!",      "Daemon NOT by scroll!")
end sub
sub mgwo_earthelemental()
   cast_wo(14, 27, 1, '0x1F6A', 'Earth Elemental',         "Earth Elemental by scroll!",   "Earth Elemental NOT by scroll!")
end sub
sub mgwo_fireelemental()
   cast_wo(14, 27, 1, '0x1F6B', 'Fire Elemental',         "Fire Elemental by scroll!",   "Fire Elemental NOT by scroll!")
end sub
sub mgwo_waterelemental()
   cast_wo(14, 27, 1, '0x1F6C', 'Water Elemental',         "Water Elemental by scroll!",   "Water Elemental NOT by scroll!")
end sub
# Main Procedures
sub cast_wt(scrollmana, castmana, drinkmana, scroll, cast, target, msgStatScr, msgStat)
   # Vitali De Vir
   uo.findtype(scroll,'-1','my')         
   if uo.findcount() then
      uo.print('Scroll found!')
      if uo.mana>=scrollmana then
         uo.waittargetobject(target)
         uo.usetype(scroll)
         uo.print(msgStatScr)
      else
         if drinkmana==1 then
            uo.findtype('0x0F0E','0x09DF','my')
            if uo.findcount() then
               uo.usetype('0x0F0E','0x09DF')      # drink total mana
               wait(200)
               uo.waittargetobject(target)
               uo.usetype(scroll)
               uo.print(msgStatScr)
               uo.print("Total Mana drunk!")
            else
               uo.print("You have scrolls, but no mana potions left!")
            endif
         else
            uo.print("Low mana!")
         endif
      endif
   else
      if uo.mana>=castmana then
         uo.waittargetobject(target)
         uo.cast(cast)
         uo.print(msgStat)
      else
         if drinkmana==1 then
            uo.findtype('0x0F0E','0x09DF','my')
            if uo.findcount() then
               uo.usetype('0x0F0E','0x09DF')      # drink total mana
               wait(200)
               uo.waittargetobject(target)
               uo.cast(cast)
               uo.print(msgStat)
               uo.print("Total Mana drunk!")
            else
               uo.print("No Total Mana potions found!")
               uo.print("And no mana, sorry :D")
            endif
         else
            uo.print("Low mana!")
         endif
      endif
   endif
end sub
sub cast_wo(scrollmana, castmana, drinkmana, scroll, cast, msgStatScr, msgStat)
   # Vitali De Vir
   uo.findtype(scroll,'-1','my')         
   if uo.findcount() then
      uo.print('Scroll found!')
      if uo.mana>=scrollmana then
         uo.usetype(scroll)
         uo.print(msgStatScr)
      else
         if drinkmana==1 then
            uo.findtype('0x0F0E','0x09DF','my')
            if uo.findcount() then
               uo.usetype('0x0F0E','0x09DF')      # drink total mana
               wait(200)
               uo.usetype(scroll)
               uo.print(msgStatScr)
               uo.print("Total Mana drunk!")
            else
               uo.print("You have scrolls, but no mana potions left!")
            endif
         else
            uo.print("Low mana!")
         endif
      endif
   else
      if uo.mana>=castmana then
         uo.cast(cast)
         uo.print(msgStat)
      else
         if drinkmana==1 then
            uo.findtype('0x0F0E','0x09DF','my')
            if uo.findcount() then
               uo.usetype('0x0F0E','0x09DF')      # drink total mana
               wait(200)
               uo.cast(cast)
               uo.print(msgStat)
               uo.print("Total Mana drunk!")
            else
               uo.print("No Total Mana potions found!")
               uo.print("And no mana, sorry :D")
            endif
         else
            uo.print("Low mana!")
         endif
      endif
   endif
end sub