eduardbean
Member
- Joined
- Nov 26, 2010
- Messages
- 129
- Solutions
- 2
- Reaction score
- 15
This script get player text in 'TextEdit' and see if is = Demon, but dont work, player text return "", how i can make a Text Editor in .otui for player make text and search for Demon.
.lua
.otui
.lua
Code:
function init()
MonstersButton = modules.client_topmenu.addRightGameToggleButton('MonstersButton', tr('Monsters'), '/images/topbuttons/Monsters', toggle)
MonstersButton:setOn(false)
MonstersWindow = g_ui.displayUI('Monsters.otui')
MonstersWindow:setVisible(false)
ShowDemon = g_ui.displayUI('Monsters/Demon')
ShowDemon:setVisible(false)
MonsterName = MonstersWindow:getChildById('getMonsterName'):getText()
end
function searchMonster()
if MonsterName == 'Demon' then
ShowDemon:show()
end
print(MonsterName)
end
.otui
Code:
TextEdit
id: getMonsterName
anchors.top: GetMonster1.bottom
anchors.left: parent.left
anchors.right: searchButton.left
margin-top: 5
margin-right: 5
Button
id: searchButton
!text: tr('Search')
width: 50
anchors.top: GetMonster1.bottom
anchors.right: parent.right
margin-top: 5
@onClick: searchMonster()
Last edited: