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
fun with strings
Moderators: Murderator+, Murderator
i finally found teh answer myself..
for those of you that care (:o) :
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