Yoko
http://forum.yoko.com.ua/

fun with strings
http://forum.yoko.com.ua/viewtopic.php?f=1&t=8159
Page 1 of 1

Author:  verY [ 2006-07-06 17:07:21 ]
Post subject:  fun with strings

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

Author:  verY [ 2006-07-07 20:28:56 ]
Post subject: 

i finally found teh answer myself..
for those of you that care (:o) :
Code:
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

Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/