Yün makrosu |
Yazar
Mesaj
goto behindComment
;==================================
; Script Name: ZsCotton2Cloth
; Author: ZanyScum
; Version: 1.0
; Client Tested with: 5.0.1d
; EUO version tested with: 1.5 77
; Shard FS: Allure
; Revision Date: 2006-07-24
; Public Release: 2006-08-07
; Global Variables Used:
; Purpose: cotton/wool etc from open container to cloth and back to container
; Known bugs: none
;==================================
behindComment:
set %nIterationCount 4 ; if you have to change, how many resourses are done each turn
; lower numbers for chars who can not carry much
gosub zInit
gosub zSetup
gosub zMain
gosub zHalt (normal halt)
; *******************************************************************
sub zMain ; ----------------------------------------
gosub setTypesAndTools
if %bUseBackPack = #false
gosub moveAllTypesFromBackpackToBox
mainLoop:
if %bUseBackPack = #false
gosub moveResourcesToBackpack
for %nIt 1 %nIterationCount
{
gosub useWheels
gosub useLooms
}
if %bUseBackPack = #false
gosub moveAllTypesFromBackpackToBox
gosub exitIfNothingToDo
goto mainLoop
return ; ----------------------------------------
; *******************************************************************
sub zInit ;------------ zInit
namespace local zInit
set %zScriptName ZsCotton2ClothV1
initEvents
event SysMessage starting script %zScriptName ...
event macro 8 2 ; open status
wait 5
event macro 8 7 ; open backpack
wait 5
return ; -----------------------
sub zHalt ;------------ zHalt <text> if text contains spaces, limit is 10 params
namespace local zHalt
gosub zParamsToVar sAllParams %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
set %sMsg stopping , #spc , script , %zScriptName , %sAllParams
event SysMessage %sMsg
display ok %sMsg
halt
return ; -----------------------
sub zParamsToVar ;------------ zParamsToVar
namespace local zParamsToVar
if %0 <= 1 || %2 = n/a ;no parameters -> return a space
{
set % . %1 #spc
return
}
set %tempAll %2
for %nParam 3 %0
{
if ! ( % . %nParam = n/a )
{
set %currentParameter % . %nParam
set %currentAll %tempAll , #spc
set %tempAll %currentAll , %currentParameter
};if !n/a
};for each parameter
set % . %1 %tempAll
for %n 1 20
{
set % , %n
};for
return
; *******************************************************************
sub setTypesAndTools
set %ThreadTypes UAG_TAG_NLF_QLF_PLF
set %BoltTypes ZZF_CAG_BAG_MAG_LAG_OAG_NAG_IAG
set %CottonTypes NFF_OFF_HFG_TEK_WEK_VEK_QEK_PEK
set %WheelTypes XEG_AFG_ZEG_JFG_MFG_LFG_GFG_FFG_IFG_MKG_LKG_OKG
set %LoomTypes GDG_VCG_FDG_IDG_HDG_CDG_BDG_EDG
set %MaterialTypes %ThreadTypes , _ , %BoltTypes , _ , %CottonTypes
; Spinning Wheels
finditem %WheelTypes
if #findkind = -1
gosub zHalt "(no SpinningWheels found)"
set %nWheelCount #findcnt
for %i 1 %nWheelCount
{
finditem %WheelTypes %i
set %nWheelId , %i #findid
event sysmessage Found Spinning Wheel %i
wait 1
event ExMsg #findid 0 0 Wheel %i
wait 1
}
event sysmessage Found %nWheelCount Spinning Wheels
; Looms
finditem %LoomTypes
if #findkind = -1
gosub zHalt "(no Looms found)"
set %nLoomCount #findcnt
for %i 1 %nLoomCount
{
finditem %LoomTypes %i
set %nLoomId , %i #findid
event sysmessage Found Loom %i
wait 1
event ExMsg #findid 0 0 Loom %i
wait 1
}
event sysmessage Found %nLoomCount Looms
; Box
set %nBoxId N/A
if %bUseBackPack = #true
{
set %nBoxId #BackPackId
}
else
{
finditem %MaterialTypes
if #findkind <> -1
{
event sysmessage found #findcnt material stacks...
for %i 1 #findcnt
{
finditem %MaterialTypes %i
event exmsg #findid 0 0 (checking box %i ... )
wait 1
if #FindBagId <> #BackPackId
set %nBoxId #FindBagId
else
event sysmessage ignoring backpack...
wait 1
} ; for
} ; if findkind
} ; else, backpack = false
if %nBoxId = N/A
{
gosub zHalt "(no box with resources found)"
}
else
{
event sysMessage found box with resourses
wait 1
event ExMsg %nBoxId 0 0 ResourceBox
}
set %nNeededCottonPerTurn %nWheelCount * %nIterationCount
set %nNeededThreadsPerTurn %nLoomCount * %nIterationCount
return
sub moveAllTypesFromBackpackToBox
finditem %MaterialTypes C_ , #backPackId
if #findkind <> -1
{
event sysmessage "found #findcnt material stacks in backpack ..."
set %nStackCount #findcnt
for %i 1 %nStackCount
{
event sysmessage "moving stack " %i ...
finditem %MaterialTypes 1 C_ , #backPackId
wait 1
exevent drag #findid #findstack
wait 20
exevent dropc %nBoxId
wait 20
}
}
return
sub exitIfNothingToDo
if %bUseBackPack = #false
finditem %ThreadTypes , _ , %CottonTypes C_ , %nBoxId
else
finditem %ThreadTypes , _ , %CottonTypes C_ , #BackPackId
if #findkind = -1
{
gosub zHalt "(nothing to do left)"
}
return
sub moveResourcesToBackpack
finditem %ThreadTypes C_ , %nBoxId
if #findkind <> -1
{
exevent drag #findid %nNeededThreadsPerTurn
wait 20
exevent dropc #BACKPACKID
wait 20
}
finditem %CottonTypes C_ , %nBoxId
if #findkind <> -1
{
exevent drag #findid %nNeededCottonPerTurn
wait 20
exevent dropc #BACKPACKID
wait 20
}
return
sub useLooms
finditem %ThreadTypes C_ , #BackPackId
if #findkind = -1
return
set %nIdThread #findid
set %nThreadCount #findstack
set %nLoomsToUse %nLoomCount
if %nThreadCount < %nLoomCount
set %nLoomsToUse %nThreadCount
for %i 1 %nLoomsToUse
{
event exMsg %nLoomId . %i 0 0 ( using loom %i )
set #lObjectId %nIdThread
set #lTargetKind 1
set #lTargetId %nLoomId . %i
event macro 17 0 ;lastobject
target 5s
event Macro 22 0 ;last target
wait 1s
}
return
sub useWheels
finditem %CottonTypes C_ , #BackPackId
if #findkind = -1
return
set %nIdCotton #findid
set %nCottonCount #findstack
set %nWheelsToUse %nWheelCount
if %nCottonCount < %nWheelCount
set %nWheelsToUse %nCottonCount
for %i 1 %nWheelsToUse
{
event exMsg %nWheelId . %i 0 0 ( using wheel %i )
set #lObjectId %nIdCotton
set #lTargetKind 1
set #lTargetId %nWheelId . %i
event macro 17 0 ;lastobject
target 5s
event Macro 22 0 ;last target
wait 1s
}
return
sub zSetup
display yesNoCancel Are your resources in your backpack ?
if #dispRes = Cancel
gosub zHalt (Cancel)
if #dispRes = Yes
set %bUseBackPack #true
if #dispRes = No
set %bUseBackPack #false
display ok Remember to have your chosen resource source visible, when starting the script !
return
;==================================
; Script Name: ZsCotton2Cloth
; Author: ZanyScum
; Version: 1.0
; Client Tested with: 5.0.1d
; EUO version tested with: 1.5 77
; Shard FS: Allure
; Revision Date: 2006-07-24
; Public Release: 2006-08-07
; Global Variables Used:
; Purpose: cotton/wool etc from open container to cloth and back to container
; Known bugs: none
;==================================
behindComment:
set %nIterationCount 4 ; if you have to change, how many resourses are done each turn
; lower numbers for chars who can not carry much
gosub zInit
gosub zSetup
gosub zMain
gosub zHalt (normal halt)
; *******************************************************************
sub zMain ; ----------------------------------------
gosub setTypesAndTools
if %bUseBackPack = #false
gosub moveAllTypesFromBackpackToBox
mainLoop:
if %bUseBackPack = #false
gosub moveResourcesToBackpack
for %nIt 1 %nIterationCount
{
gosub useWheels
gosub useLooms
}
if %bUseBackPack = #false
gosub moveAllTypesFromBackpackToBox
gosub exitIfNothingToDo
goto mainLoop
return ; ----------------------------------------
; *******************************************************************
sub zInit ;------------ zInit
namespace local zInit
set %zScriptName ZsCotton2ClothV1
initEvents
event SysMessage starting script %zScriptName ...
event macro 8 2 ; open status
wait 5
event macro 8 7 ; open backpack
wait 5
return ; -----------------------
sub zHalt ;------------ zHalt <text> if text contains spaces, limit is 10 params
namespace local zHalt
gosub zParamsToVar sAllParams %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
set %sMsg stopping , #spc , script , %zScriptName , %sAllParams
event SysMessage %sMsg
display ok %sMsg
halt
return ; -----------------------
sub zParamsToVar ;------------ zParamsToVar
namespace local zParamsToVar
if %0 <= 1 || %2 = n/a ;no parameters -> return a space
{
set % . %1 #spc
return
}
set %tempAll %2
for %nParam 3 %0
{
if ! ( % . %nParam = n/a )
{
set %currentParameter % . %nParam
set %currentAll %tempAll , #spc
set %tempAll %currentAll , %currentParameter
};if !n/a
};for each parameter
set % . %1 %tempAll
for %n 1 20
{
set % , %n
};for
return
; *******************************************************************
sub setTypesAndTools
set %ThreadTypes UAG_TAG_NLF_QLF_PLF
set %BoltTypes ZZF_CAG_BAG_MAG_LAG_OAG_NAG_IAG
set %CottonTypes NFF_OFF_HFG_TEK_WEK_VEK_QEK_PEK
set %WheelTypes XEG_AFG_ZEG_JFG_MFG_LFG_GFG_FFG_IFG_MKG_LKG_OKG
set %LoomTypes GDG_VCG_FDG_IDG_HDG_CDG_BDG_EDG
set %MaterialTypes %ThreadTypes , _ , %BoltTypes , _ , %CottonTypes
; Spinning Wheels
finditem %WheelTypes
if #findkind = -1
gosub zHalt "(no SpinningWheels found)"
set %nWheelCount #findcnt
for %i 1 %nWheelCount
{
finditem %WheelTypes %i
set %nWheelId , %i #findid
event sysmessage Found Spinning Wheel %i
wait 1
event ExMsg #findid 0 0 Wheel %i
wait 1
}
event sysmessage Found %nWheelCount Spinning Wheels
; Looms
finditem %LoomTypes
if #findkind = -1
gosub zHalt "(no Looms found)"
set %nLoomCount #findcnt
for %i 1 %nLoomCount
{
finditem %LoomTypes %i
set %nLoomId , %i #findid
event sysmessage Found Loom %i
wait 1
event ExMsg #findid 0 0 Loom %i
wait 1
}
event sysmessage Found %nLoomCount Looms
; Box
set %nBoxId N/A
if %bUseBackPack = #true
{
set %nBoxId #BackPackId
}
else
{
finditem %MaterialTypes
if #findkind <> -1
{
event sysmessage found #findcnt material stacks...
for %i 1 #findcnt
{
finditem %MaterialTypes %i
event exmsg #findid 0 0 (checking box %i ... )
wait 1
if #FindBagId <> #BackPackId
set %nBoxId #FindBagId
else
event sysmessage ignoring backpack...
wait 1
} ; for
} ; if findkind
} ; else, backpack = false
if %nBoxId = N/A
{
gosub zHalt "(no box with resources found)"
}
else
{
event sysMessage found box with resourses
wait 1
event ExMsg %nBoxId 0 0 ResourceBox
}
set %nNeededCottonPerTurn %nWheelCount * %nIterationCount
set %nNeededThreadsPerTurn %nLoomCount * %nIterationCount
return
sub moveAllTypesFromBackpackToBox
finditem %MaterialTypes C_ , #backPackId
if #findkind <> -1
{
event sysmessage "found #findcnt material stacks in backpack ..."
set %nStackCount #findcnt
for %i 1 %nStackCount
{
event sysmessage "moving stack " %i ...
finditem %MaterialTypes 1 C_ , #backPackId
wait 1
exevent drag #findid #findstack
wait 20
exevent dropc %nBoxId
wait 20
}
}
return
sub exitIfNothingToDo
if %bUseBackPack = #false
finditem %ThreadTypes , _ , %CottonTypes C_ , %nBoxId
else
finditem %ThreadTypes , _ , %CottonTypes C_ , #BackPackId
if #findkind = -1
{
gosub zHalt "(nothing to do left)"
}
return
sub moveResourcesToBackpack
finditem %ThreadTypes C_ , %nBoxId
if #findkind <> -1
{
exevent drag #findid %nNeededThreadsPerTurn
wait 20
exevent dropc #BACKPACKID
wait 20
}
finditem %CottonTypes C_ , %nBoxId
if #findkind <> -1
{
exevent drag #findid %nNeededCottonPerTurn
wait 20
exevent dropc #BACKPACKID
wait 20
}
return
sub useLooms
finditem %ThreadTypes C_ , #BackPackId
if #findkind = -1
return
set %nIdThread #findid
set %nThreadCount #findstack
set %nLoomsToUse %nLoomCount
if %nThreadCount < %nLoomCount
set %nLoomsToUse %nThreadCount
for %i 1 %nLoomsToUse
{
event exMsg %nLoomId . %i 0 0 ( using loom %i )
set #lObjectId %nIdThread
set #lTargetKind 1
set #lTargetId %nLoomId . %i
event macro 17 0 ;lastobject
target 5s
event Macro 22 0 ;last target
wait 1s
}
return
sub useWheels
finditem %CottonTypes C_ , #BackPackId
if #findkind = -1
return
set %nIdCotton #findid
set %nCottonCount #findstack
set %nWheelsToUse %nWheelCount
if %nCottonCount < %nWheelCount
set %nWheelsToUse %nCottonCount
for %i 1 %nWheelsToUse
{
event exMsg %nWheelId . %i 0 0 ( using wheel %i )
set #lObjectId %nIdCotton
set #lTargetKind 1
set #lTargetId %nWheelId . %i
event macro 17 0 ;lastobject
target 5s
event Macro 22 0 ;last target
wait 1s
}
return
sub zSetup
display yesNoCancel Are your resources in your backpack ?
if #dispRes = Cancel
gosub zHalt (Cancel)
if #dispRes = Yes
set %bUseBackPack #true
if #dispRes = No
set %bUseBackPack #false
display ok Remember to have your chosen resource source visible, when starting the script !
return
1. sayfa (Toplam 1 sayfa) [ 5 mesaj ] |
Bu forumda yeni başlıklar açamazsınız Bu forumdaki başlıklara cevap veremezsiniz Bu forumdaki mesajlarınızı değiştiremezsiniz Bu forumdaki mesajlarınızı silemezsiniz Bu forumdaki anketlerde oy kullanamazsınız |