Amenophis Posted September 21, 2017 Share Posted September 21, 2017 (edited) Hi! First sorry for my english. I want put the name of an IsoObject on context menu. But getName() returns nil... For example if i right click on Green Oven getName() returns nil. But when i take it is name is Green Oven. I searched in "ISMoveableInfoWindow.lua" but it did not help me... Any solution? I have another question. It's possible to open an inventory in the container window by script? Thanks Edited September 21, 2017 by Amenophis Link to comment Share on other sites More sharing options...
Svarog Posted September 21, 2017 Share Posted September 21, 2017 To get the name of the object you're currently mousing over try this local properties = UIManager.getLastPicked():getSprite():getProperties() local name = (properties :Is("CustomName") and properties :Val("CustomName")) or "None" print(name) Amenophis 1 Link to comment Share on other sites More sharing options...
Amenophis Posted September 21, 2017 Author Share Posted September 21, 2017 Thank you! It's not perfect. The Green Oven is just named Oven but the result is satisfactory. Link to comment Share on other sites More sharing options...
Svarog Posted September 21, 2017 Share Posted September 21, 2017 (edited) 23 minutes ago, Amenophis said: Thank you! It's not perfect. The Green Oven is just named Oven but the result is satisfactory. Try this then, this is how the moveable code works local properties = UIManager.getLastPicked():getSprite():getProperties() local groupname = properties:Is("GroupName") and properties:Val("GroupName") or nil; local name = (groupname and (groupname .. " ") or "") .. (properties:Is("CustomName") and properties:Val("CustomName") or "None"); Group Name should be the "Green" part of the name then. Also keep in mind that this stuff is pretty much only defined for Objects you can move., most other objects only have some very basic properties set. Edited September 21, 2017 by Svarog Amenophis 1 Link to comment Share on other sites More sharing options...
Amenophis Posted September 21, 2017 Author Share Posted September 21, 2017 Ho! It's works perfectly now! Thank you! How to marked the topic as solved? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now