set %saltpeter SPT (whatever the objecttype is)
set %saltpeterColor 1150
finditem %saltpeter C_ , #BACKPACKID
if #FINDCNT > 0
{
for #FINDINDEX 1 #FINDCNT
{
if #FINDCOL = %saltpeterColor
{
; do specific something with this type
}
else
{
; drag to container
}
}
}
Would just adding color and the color onto %saltpeter actually allow it to read the color?
set %saltpeter AZF
set %saltpeterColor 1150
;[[str]] {"Len"} {string}
;[[str]] {"Pos"} {string} {sub string} [index]
;[[str]] {"Left"} {string} {length}
;[[str]] {"Right"} {string} {length}
;[[str]] {"Mid"} {string} {start} {length}
;[[str]] {"Lower"} {string}
;[[str]] {"Ins"} {string} {sub string} {start}
;[[str]] {"Del"} {string} {start} {length}
;[[str]] {"Count"} {string} {substring}
;Len Stores the length of the string in the #strRes system variable.
;Pos Stores the position of the sub string in the #strRes system variable. index tells which occurrence to return (if there's more than one).
;Left Stores a part of the string taken from the left, in the #strRes system variable.
;Right Stores a part of the string taken from the right, in the #strRes system variable.
;Mid Stores a part of the string taken from the middle, in the #strRes system variable.
;Lower Stores a lower case version of the string in the #strRes system variable.
;Ins Inserts a string into the string and stores it in the #strRes system variable.
;Del Deletes a part of the string and stores it in the #strRes system variable.
;Count Returns the number of occurrences of substring in string
event Property RXAEBOD ; set this to the item id of an armor piece in your backpack
set %string #property
display %string
Str Count %string resist ; 5 (check how many times substring resist is found)
set %resistnum #strres ; total of 5 resists
for %index 1 %resistnum
{
STR Pos %string Resist 1 ; 39 (get position of first 'resist' in string)
set %end #strres - 3 ; 36
Str Del %String 1 %end ; remove everything from string including position 36 ; result = l resist 2%
set %string #strres
str left %string 1 ; get first letter of string e.g. l (physical), e (fire), d (cold), n (poison), y (energy)
if #strres = l
set %resist physical
if #strres = e
set %resist Fire
if #strres = d
set %resist Cold
if #strres = n
set %resist Poison
if #strres = y
set %resist Energy
STR Pos %string Resist 1 ; should always be 3 i guess ; e.g. l resist 2%
set %end #strres + 6 ; removing everything from string up to the string resist value ; 9 characters ("l resist " = 9)
Str Del %String 1 %end ; removing everything from string up to the string resist value ; l resist 2% => 2%
set %string #strres
Str Pos %string % ; either 2 or 3 for armor resist ; 2% or 12%
set %delete #strres ; think this is not being used anywhere...
set %left #strres - 1 ; get the resist value, e.g. 12% => % is position 3, 3 - 1 = 2, get first 2 characters of string = 12
STR Left %string %left ; get the resist value
set % . %Resist #strres ; dynamically setting resist variables %physical %cold etc
}
set %resourcex 475
set %resourcey 450
; locate/open resource secure
str len %ResourceSecure
if ( N/A notin %ResourceSecure ) && ( #strres > 0 )
{
finditem %ResourceSecure
if #findkind <> -1
goto _openres
}
_selres:
display Ok Select your Resource Container.
set #targcurs 1
while #targcurs = 1
wait 10
set %ResourceSecure #ltargetid
_openres:
set #lobjectid %ResourceSecure
event macro 17 0
wait 10
contpos %resourcex %resourcey
wait 10
gosub CheckColor
;===================================================================
sub CheckColor
finditem AFZ C_ , %ResourceSecure
wait 10
[
if #findcol = 1150
set %resoucrce 1
if #findcol = 1190
set %resource 2
if #findcol = 1102
set %resource 3
if #findcol = 1109
set %resource 4
]
gosub CheckSaltpeter
;===================================================================
sub CheckSaltpeter
finditem %resource1 C_ , #backpackid
if #findstack <= 20
{
wait 10
gosub moveit #backpackid %ResourceSecure %resource1 200
wait 10
if #result = 0
{
display Out of saltpeter in secure, halting...
halt
}
}
pause
return
;===================================================================
sub moveit
; %1 destination container ID
; %2 source container ID, or * (any except destination), or # (ground)
; %3 specific item types to move, or * (all found items)
; %4 optional, stacksize
set %_max 60000
set %_total 0
if %0 = 4
set %_max %4
set %_from C_ , %2
if * in %2
set %_from C
if # in %2
set %_from G_2
finditem %3 %_from
if #findkind = -1
return %_total
set %pd _NULL_
if * in %2
set %pd #charid
for #findindex 1 #findcnt
{
if ( #findbagid <> %1 ) && ( #findbagid <> %pd )
{
set %_amt %_max
if #findstack < %_max
set %_amt #findstack
set %_total %_total + %_amt
exevent drag #findid %_amt
wait 5
if %1 = #charid
exevent droppd
else
exevent dropc %1
wait 10
}
}
return %_total
;===================================================================
finditem afz c_ , %ResourceSecure
{
for #findindex 1 #findcnt
{
set %resource . #findcol #findid
}
}
%resource1150 = #findid of saltpeter
%resource1190 = #findid of charcoal
%resource1102 = #findid of potash
%resource1109 = #findid of blackpowder
This solves my problem here, got some help on EUO. I was worried that no one would see it due to the limited activity in their script debug thread but luckily there are some that still read it. I am posting this here in case anyone else runs into the same problem and needs a fix! 8)Code: [Select]finditem afz c_ , %ResourceSecure
{
for #findindex 1 #findcnt
{
set %resource . #findcol #findid
}
}
%resource1150 = #findid of saltpeter
%resource1190 = #findid of charcoal
%resource1102 = #findid of potash
%resource1109 = #findid of blackpowder
Code: [Select]set %saltpeter SPT (whatever the objecttype is)
set %saltpeterColor 1150
finditem %saltpeter C_ , #BACKPACKID
if #FINDCNT > 0
{
for #FINDINDEX 1 #FINDCNT
{
if #FINDCOL = %saltpeterColor
{
; do specific something with this type
}
else
{
; drag to container
}
}
}
sub CheckColor
finditem AFZ C_ , %ResourceSecure
sub CheckColor
finditem AFZ C_ , %ResourceSecure
wait 10
[
if #findcol = 1150
set %resoucrce 1
if #findcol = 1190
set %resource 2
if #findcol = 1102
set %resource 3
if #findcol = 1109
set %resource 4
]
gosub CheckSaltpeter
;===================================================================
sub CheckSaltpeter
finditem %resource1 C_ , #backpackid
if #findstack <= 20
{
wait 10
gosub moveit #backpackid %ResourceSecure %resource1 200
wait 10
if #result = 0
{
display Out of saltpeter in secure, halting...
halt
}
}
pause
return
Sub Resource
; Gosub Resource (Secure) (Type) (Col) (Min) (Max)
Namespace Push
Namespace Local Mwinc_Resource
set !Cont_Id %1
set !Resource %2
set !Col %3
set !Min %4
set !Max %5
Finditem !Resource C_ , #backpackid
set !Amount 0
for #findindex 1 #findcnt
{
if #Findcol = !Col || !Col = N/A
set !Amount !Amount + #Findstack
}
if !Amount >= !Min
{
Namespace Pop
Return 0
}
set !Amount2 !Max - !Amount
if !Cont_id <> N/A
Finditem !Resource C_ , !Cont_Id
Else
Finditem !Resource C
if #findcnt > 0
{
For #findindex 1 #findcnt
{
if ( #findcol = !Col || !Col = N/A ) && #Findbagid <> #Backpackid
{
Exevent drag #Findid !Amount2
wait 15
Exevent dropc #backpackid
wait 15
set #Result !Amount2
Namespace Pop
Return #Result
}
}
}
Namespace Pop
Return Out
Just Test out that resource sub I sent you, I use it in all my crafting stuff. Pretty easy. I use wait 15 between drag and drop which can be changed. It works for me on a good connection and a slightly laggy connection.
Just Test out that resource sub I sent you, I use it in all my crafting stuff. Pretty easy. I use wait 15 between drag and drop which can be changed. It works for me on a good connection and a slightly laggy connection.
I have been checking my messages but I never got anything. :'(