• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Monster Level Problem

helmut7414

New Member
Joined
Mar 3, 2012
Messages
14
Solutions
1
Reaction score
3
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.

rwxsu

Computer Engineer
Joined
Mar 31, 2018
Messages
121
Solutions
5
Reaction score
165
GitHub
rwxsu
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
Top