Jump to content

need to find out what object was used in recipe and return empty version


Recommended Posts


i have a list of items i can use for recipe input 

but to return the right empty version after use i need to find out what 

item was used to trigger 


found this in a post but need some help 



-- We iterate through the table of clicked items. We have
	-- to seperate between single items, stacks and expanded
	-- stacks.	
for i1 = 1, #itemTable do
		local item = itemTable[i1];
		if instanceof(item, "InventoryItem") and instanceof(item, "InventoryContainer") then
Edited by excon
Link to comment
Share on other sites

hi - i cannot do that as the items need type food to have the alcohol kicker.

something so i can if fork it would be the best 


if player item used is whiskey add item to inventory whiskey empty




i foul=nd this here where we take the right click item 


function objectRightClicked(player, context, worldObjects, test)
  print("Objects right clicked");
  -- Not sure but it's all around production code so probably
  -- important
  if test and ISWorldObjectContextMenu.Test then
     return true
  -- Pick first object in worldObjects as refference one
  local firstObject;
  for _,o in ipairs(worldObjects) do
    if not firstObject then firstObject = o; end
  -- the square this object is in is the clicked square
  local square = firstObject:getSquare()
  -- and all objects on that square will be affected
  local worldObjects = square:getObjects();
  -- Loop over objects on square
  for i=0,worldObjects:size()-1 do
    local object = worldObjects:get(i);
    print("Clicked object!");
    print("      Name:"..(object:getName() or ""));
    print("    Object:"..(object:getObjectName() or ""));
    print("    Sprite:"..(object:getSpriteName() or ""));
    print("   Texture:"..(object:getTextureName() or ""));



Edited by excon
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...