Page 1 of 1

Unable to find "Expedition Team Scout"

Posted: Thu Aug 04, 2011 7:33 pm
by klubi
The bot is unable to find this merchant, but it finds "Diloss" the NPC near him.

npcname = RoMScript("TEXT('Sys114291_name')"); yrest(500) -- ie. "Expedition Team Scout"
player:merchant(npcname);

also

player:merchant("Expedition Team Scout");

doesn't work.

Anyone how knows this problem and how to deal with it?

Thank you for your help :)

Re: Unable to find "Expedition Team Scout"

Posted: Fri Aug 05, 2011 10:19 am
by SpiralV
I would try

player:merchant(114291);

or

player:merchant("Expedition");

Re: Unable to find "Expedition Team Scout"

Posted: Sat Aug 06, 2011 6:36 pm
by klubi
player:merchant(114291);

works well, thank you

Re: Unable to find "Expedition Team Scout"

Posted: Sat Aug 06, 2011 9:24 pm
by rock5
klubi wrote:player:merchant(114291);

works well, thank you
That's good. I'm still curious why

Code: Select all

player:merchant("Expedition Team Scout");
didn't work. You are on an English client right?

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 1:12 am
by klubi
I'm on the European Client with german as Ingame language, but I tried it on german and on english with the full name and a short version
player:merchant(114291);
is still the only function that works

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 1:50 am
by rock5
I just translated the name and see that in german it includes a hyphen '-'. Hyphens have special meaning when doing string comparisons.
Try replacing it with a period '.' A period means "any character". That should work.

In future if you have similar problems just try replacing any suspect characters with periods.

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 4:49 am
by Administrator
rock5 wrote:I just translated the name and see that in german it includes a hyphen '-'. Hyphens have special meaning when doing string comparisons.
Try replacing it with a period '.' A period means "any character". That should work.

In future if you have similar problems just try replacing any suspect characters with periods.
Is there any reason why this is needed in this particular case? Couldn't we just set the 4th parameter to true so that patterns cannot be used, or is this actually used somewhere?

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 8:01 am
by rock5
Administrator wrote:Is there any reason why this is needed in this particular case? Couldn't we just set the 4th parameter to true so that patterns cannot be used, or is this actually used somewhere?
Good point. Merchant would only ever get a name for an argument. I don't see the need for any special pattern matching features. But untumately the base function is findNearestNameOrId. I don't know if it would be wise to block pattern features with such a far reaching function. I certainly couldn't say for sure that it would be safe to do so.

If we think that merchant wouldn't be used with special pattern matching, maybe we could fix the string with a general purpose string fixing function that fix all the special characters? Or does a function like that already exist?

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 8:05 am
by Administrator
rock5 wrote:If we think that merchant wouldn't be used with special pattern matching, maybe we could fix the string with a general purpose string fixing function that fix all the special characters? Or does a function like that already exist?
Not that I'm aware of. Could just use string.gsub() to replace certain characters with an escaped representation, though.

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 8:30 am
by rock5
That's exactly what I mean. I know there are functions like that, to do with converting strings for differnt languages but I wasn't sure if there was one just for this purpose.

Ok, so what do we call it? ConvertName FixName FixString? What characters need to be fixed? Just ' " -? Any others?

What should it be used for? merchant, target_npc? Any others?

Re: Unable to find "Expedition Team Scout"

Posted: Thu Aug 11, 2011 10:00 pm
by Administrator
Well, obviously, the best solution would be the simplest. I can't really see any place you would need the patterns in findNearestNameOrId(). I mean, if you want to look for say "Brown Bear" and "Young Bear", you could just search for "Bear", so you wouldn't need the .* pattern.

If we really need to, I guess we could just replace the patterns. What other special characters might appear in NPC names?

Re: Unable to find "Expedition Team Scout"

Posted: Fri Aug 12, 2011 12:02 am
by rock5
Administrator wrote:I can't really see any place you would need the patterns in findNearestNameOrId().
On second thought, maybe your right. I can't think of any use for it.