Man, you are soooo close!
The first suggestion is that if you are going to use namespaces, you should go ahead and convert your worker variables to the namespace variables !var.
Second is that you need to search through all the input arguments to the function starting at %1, %2, %3, etc up to how many is in %0. You can do this by using the !loop variable as an index and then doing this:
set !Property % . !Loop ;<-----Want %Property = Blacksmith then Weaponsmith then Etc
So for your example, !Property will return Blacksmith for %1 and Weaponsmith for %2. Does this make sense how it's working? I can explain further if you are confused.
Finally, since you are just returning something, you might as well put your return value in your #RESULT variable. So you are either returning a #FINDID if successful, or #FALSE if nothing is found. That way you won't loose the result when you switch back to the home namespace (and also clear the worker namespace like you are doing)
Here's kinda what I'm talking about.
;############################
;Sub FindVendor
;############################
; %1 Vendor property 1
; %2 Vendor property 2
; %3 etc
sub findvendor
Namespace Push
Namespace Local XIIxFindVendor
for !Loop 1 %0
{
set !tmp
set !Property % . !Loop ;<-----Want %Property = Blacksmith then Weaponsmith then Etc
finditem !VendorTypes G_8
if #findkind <> -1
{
event property #findid
if !Property in #property
{
ignoreitem reset vendors
Namespace Clear
Namespace Pop
return #findid
}
}
}
ignoreitem reset vendors
Namespace Clear
Namespace Pop
return #false