• 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!

Hide or Show experience bar

diegortw

Member
Joined
Oct 10, 2014
Messages
68
Reaction score
8
Hi guys, I need your help :D

I'm trying to add a checkbox to game options...

healthinfo.lua has a function:
Code:
function hideExperience()
  local removeHeight = experienceBar:getMarginRect().height
  experienceBar:setOn(false)
  healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end

Then I added:
Code:
function showExperience()
  experienceBar:setOn(true)
  local addHeight = experienceBar:getMarginRect().height
  healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() + addHeight))
end

The hide function works but the show function doesn't

(Sorry for my english :p)
 
Because when it's hidden and it will run the show function, it will get 0 height :D
So instead of playing in some math things, it's better to setHeight(0) in hide function, and in show function make it setHeight(16) - I think 16 is correct pixel value, but I'm not sure.
 
Back
Top