Page 1 of 1

fun with strings

Posted: 2006-07-06 17:07:21
by verY
I want to script the following:
A function should use the journal to check if my current target (lastattack) says something.
For example it could check if he says "Im coo".
So the basic check for it would look like this:

if uo.journal(0) == uo.getname("lastattack") + ": Im coo" then

The problem i discovered is that uo.getname returns the playername WITH guildname, however in journal the guildname is NOT displayed.
So when my target would really say "Im coo" the function would trigger as:

if "Player: Im coo" == "Player[guildname]: Im coo" then

which of course never works :/

So my question is: Is there..
1. ..another way to get the playername WITHOUT guildname?
2. ..some stuff to edit strings.. like cutting strings or comparing only parts of a string?

kthx

Posted: 2006-07-07 20:28:56
by verY
i finally found teh answer myself..
for those of you that care (:o) :

Code: Select all

VAR strfullname = ""
VAR strrealname = ""
VAR irealname = 0
VAR i = 0
strfullname = uo.getname("lastattack")
for i=0 to Len(strfullname)
   if strfullname[i] == "[" then
      irealname = i-1
   endif
next
for i=0 to irealname
   strrealname = strrealname + strfullname[i]
next