This is a sub intended to be used to move stackable resources from one container to another. You must have the item color and type to use the sub.
;==========================================================
Sub Move_Resource_To_Container
; Sub moves a stackable resource from one container to another
; Checks Item Color to insure proper identification (Required)
; Will return #False if there are not enough of the resource
; #True with a successful move
;----------------------------------------------------------
; SAMPLE CALL LINE
; Gosub Move_Resource_To_Container ItemType ItemColor ContaInerIDSource ContainerIDDestination AmountToMve
;----------------------------------------------------------
namespace push
namespace local NCS
Set !ResourceItemType %1
Set !ResourceColor %2
Set !ResourceSource %3
Set !ResourceDestination %4
Set !ResourceCountToMove %5
Set !ResourceCountToMoveCheck %5
Finditem !ResourceItemType C_ , !ResourceSource
Set #findindex 0
Set #FindCol N/A
Set !ResourceLocated No
while #findindex < #findcnt && No in !ResourceLocated
{
set #findindex #findindex + 1
If #FindCol = !ResourceColor && #FindStack < !ResourceCountToMove && #FindCnt > #findindex
{
exevent drag #FindID #FindStack
Wait 15
exevent dropc !ResourceDestination
Wait 15
Set !ResourceCountToMove !ResourceCountToMove - #FindStack
Set #findindex 0
Finditem !ResourceItemType C_ , !ResourceSource
}
If #FindCol = !ResourceColor && #FindStack >= !ResourceCountToMove
{
exevent drag #FindID !ResourceCountToMove
Wait 15
exevent dropc !ResourceDestination
Wait 15
Set !ResourceLocated Yes
}
}
If #FindIndex = 0 || No in !ResourceLocated
{
IgnoreItem Reset
Namespace pop
Return #False
}
Finditem !ResourceItemType C_ , !ResourceDestination
Set #findindex 0
Set #FindCol N/A
Set !ResourceLocated No
while #findindex < #findcnt && No in !ResourceLocated
{
set #findindex #findindex + 1
If #FindCol = !ResourceColor && #FindStack >= !ResourceCountToMoveCheck
{
Namespace pop
IgnoreItem Reset
Return #True
}
}
Namespace pop
Return #False