Yoko

All sides of Injection
It is currently 2024-04-19 23:56:34

All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2010-03-21 12:33:20 
Offline

Joined: 2010-03-21 12:27:54
Posts: 2
# Bowcraft script by Poncha, v. 1.0
# @author Poncha
# @shard middle-earth.ru
# @file bowcraft.sc
# @version 1.0
#
sub bowcraft()
# 0 means no limit
# íîëü - áåç îãðàíè÷åíèé
var maxProducts = 0

# resources and products types / òèïû ðåñóðñîâ è ïðîäóêöèè
var shaftType = '0x1bd4' # shaft type / òèï øàôòîâ
var featherType = '0x1bd1' # feather type / òèï ïåðüåâ
var productType = '0x0f3f' # arrow type / òèï ïðîäóêòà

# product name / èìÿ ïðîäóêòà
# used in gump and reporting / èñïîëüçóåòñÿ â ãàìïå è îò÷åòå
var productName = 'Arrow'

var attemptsTotal = 0 # attempts counter
var attemptsSuccessfull = 0 # success counter

# skillname to use with SkillVal to detect skill growth
# èìÿ ñêèëëà äëÿ îïðåäåëåíèÿ ïðèðîñòà...
var bowcraftSkillName = 'Bowcraft'

# runtime flag, used to stop gracefully
# ãëîáàëüíûé ôëàã, èñïîëüçóåòñÿ äëÿ êîððåêòíîé îñòàíîâêè
var bowcraftRuntime = "1"


UO.SetGlobal("bowcraft", bowcraftRuntime)

UO.CancelMenu()
UO.CancelTarget()

UO.AddObject("shaftsContainer")
while UO.Targeting()
wait(100)
wend
UO.FindType(shaftType, -1, "shaftsContainer")
if UO.FindCount() == 0 then
UO.Print("There are no shafts in container you specified")
return
endif
var shafts = UO.GetSerial('finditem')

UO.AddObject("feathersContainer")
while UO.Targeting()
wait(100)
wend
UO.FindType(featherType, -1, "feathersContainer")
if UO.FindCount() == 0 then
UO.Print("There are no feathers in container you specified")
return
endif
var feathers = UO.GetSerial('finditem')

UO.AddObject("productsCatchbag")
while UO.Targeting()
wait(100)
wend

var bowcraftSkillStart = UO.SkillVal(bowcraftSkillName)

while not UO.Dead() and bowcraftRuntime == "1" and (maxProducts == 0 or attemptsSuccessfull < maxProducts) and UO.GetQuantity(shafts) and UO.GetQuantity(feathers)
UO.DeleteJournal()

attemptsTotal = attemptsTotal + 1

UO.MoveItem(shafts, 1)
repeat
wait(100)
UO.FindType(shaftType)
until UO.FindCount() > 0
UO.WaitMenu('create', productName)
UO.WaitTargetObject(feathers)
UO.UseObject(UO.GetSerial('finditem'))

while not UO.InJournal('create') and not UO.InJournal('put') and not UO.InJournal('destroy')
wait(100)
wend
if UO.InJournal('put') then
attemptsSuccessfull = attemptsSuccessfull + 1
UO.FindType(productType)
UO.MoveItem(UO.GetSerial('finditem'), 1, "productsCatchbag")
endif

UO.FindType(shaftType, -1, "shaftsContainer")
if UO.FindCount() then
shafts = UO.GetSerial('finditem')
endif

bowcraftRuntime = UO.GetGlobal("bowcraft")
if UO.InJournal("!stop bowcraft") then
bowcraftRuntime = "0"
UO.SetGlobal("bowcraft", bowcraftRuntime)
end if
wend

var bowcraftSkillEnd = UO.SkillVal(bowcraftSkillName)
var bowcraftSkillDiff = (bowcraftSkillEnd - bowcraftSkillStart)/10

if not bowcraftRuntime then
UO.Print("Terminated on user request.")
endif
UO.Print(bowcraftSkillName + ' Stats:')
UO.Print('Resources used: ' + str(attemptsTotal) + ' shafts and feathers')
UO.Print('Products created (' + productName + '): ' + str(attemptsSuccessfull))
UO.Print(bowcraftSkillName + ' skill growth: ' + str(bowcraftSkillDiff, 1))

UO.CancelMenu()
UO.CancelTarget()

end sub

sub stop_bowcraft()
UO.SetGlobal("bowcraft", "0")
end sub


Overview / Описание:

The script makes arrows/bolts (configurable) from shafts and feathers, upon startup it asks to set container of shatfs, feathers and container to put arrows in. The script terminates if there are no shafts or feathers left, maximum limit of produced arrows/bolts reached or upon user request (see 'Runtime'). At the end of execution (unless was terminated by ,terminate) reports stats - amount of resources used, count of products made and skill growth.

Скрипт делает стрелы/болты из шафтов и перьев. При запуске требует указать контейнеры шафтов и перьев, а также контейнер куда складывать готовую продукцию. Завершается при нехватке шафтов или перьев, а также если был достигнут максимум продукции (опционально заданный в конфигурации) либо по запросу пользователя (см. "Команды"). После завершения работы (если не был убит командой terminate) выдает результаты - количество израсходованных ресурсов, произведенной продукции, и прирост скилла.


Configuration / Конфигурация:

Set maxProducts to the number of arrows/bolts you wish to produce (or 0 for no limit)
Установите значение maxProducts - количество страл/болтов которое вы хотите произвести.

If you wish to produce bolts and not arrows (default), change productType to match bolts type, and productName to name matching bolts in gump (i.e. "Bolt")
Если вы хотите, чтобы скрипт производил болты вместо стрел, замените тип продукции в productType и смените productName на соответственное название болтов в гампе.

Я в скриптах 0 =) Помогите плз переделать его так, что бы он брал по 5 шавтов и 5 перьев и делал стрелы, так как на сервере котором играю я это минимальное кол-во ресов что бы сделать стрелы. Заранее очень благодарен


Top
   
PostPosted: 2010-03-21 12:34:27 
Offline

Joined: 2010-03-21 12:27:54
Posts: 2
viewtopic.php?f=20&t=3582&p=20528&hilit=bowcraft+bowcraft+bowcraft+%D1%81%D1%82%D1%80%D0%B5%D0%BB%D1%8B#p20528

вот ссылка на скрипт который я взял


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 10 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