Surilindur Posted December 17, 2014 Posted December 17, 2014 Hello again, I have a small clothing-related project that involves checking whether the name of a certain item contains a certain word. OBSE seems to offer such a function, the CompareName, and I did manage to make it work, but I have run into a small problem. I have traced it to the combination CompareName and string_var. When I enter the word directly into the function, it works. Like the following: If CompareName "Legion" Item (do something)EndIf But when I try to use a string_var ("Keyword", for example) containing the word, the function does not work. Like the following: If CompareName Keyword Item (do something)EndIf So I would like to know whether or not it is possible to use some kind of string. And if it is, am I doing something wrong? I would like to be able to change the variable and then run the same script again, so as to be able to determine which keyword (there will be many) the name includes.
QQuix Posted December 17, 2014 Posted December 17, 2014 Use "If CompareName $Keyword Item" The $ makes a string_var behave as a hardcoded string. Very useful for functions created before OBSE added full string support
TheWhispers Posted July 27, 2020 Posted July 27, 2020 Use "If CompareName $Keyword Item" The $ makes a string_var behave as a hardcoded string. Very useful for functions created before OBSE added full string supportA whole 6 years later, this post saved my sanity...
Recommended Posts