• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Monster Level Problem

helmut7414

New Member
Joined
Mar 3, 2012
Messages
19
Solutions
1
Reaction score
4
Hello,

Maybe someone here have a solution how to solve my problem with the monster level feature.

I am useing OTX2.9 with THIS monster level feature. Everything works fine except one thing.

I am not able to use
Lua:
getCreatureName(target)
anymore. It still returns a name but its like "Deer [8]" and its useless in scripts if the function is returning the name + the level.

Is there any possibility to make the function returning only the monstername without the level. I do not want to hide the level at the monstersnames.
If there is no other possibility to make it work I have to hide the level.
 
Solution
This is a simple string matching example:
Lua:
s = "Deer Banana [8]"
a = s:match("[^[]+")
a = a:sub(1, -2)
print(a) --> Deer Banana
It matches upto [, then uses sub to subtract the extra space between Banana and [.

--------------------------------------------------------------------------------------------------------------------------------
Real code you need starts here
Create a simple wrapper function:
Lua:
function getCreatureNameA(target)
    return getCreatureName(target):match("[^[]+"):sub(1, -2)
end

Call the new getCreatureNameA(target) function when you want the normal creature name without level.
This is a simple string matching example:
Lua:
s = "Deer Banana [8]"
a = s:match("[^[]+")
a = a:sub(1, -2)
print(a) --> Deer Banana
It matches upto [, then uses sub to subtract the extra space between Banana and [.

--------------------------------------------------------------------------------------------------------------------------------
Real code you need starts here
Create a simple wrapper function:
Lua:
function getCreatureNameA(target)
    return getCreatureName(target):match("[^[]+"):sub(1, -2)
end

Call the new getCreatureNameA(target) function when you want the normal creature name without level.
 
Last edited:
Solution
Back
Top