Jump to content

[Solved] Get the name of IsoObject


Amenophis

Recommended Posts

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.

image.png.48a68f175c68adf2f9203c4ed524830e.png

 

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 by Amenophis
Link to comment
Share on other sites

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 by Svarog
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...