Ivan Posted July 3, 2014 Share Posted July 3, 2014 I used similar tooltip descriptions similar totooltip.description = tooltip.description .. " <RGB:1,0,0>" .. getItemText("Plank") .. " " .. ISBuildMenu.planks .. "/" .. plankNb .. " <LINE>";But instead of being interpreted, the text is display verbatim. There are no errors in the console. Maybe I am forgetting something? *edit* Added entire code.ISSafe = {};ISSafe.planks = 0;ISSafe.nails = 0;ISSafe.hinge = 0;ISSafe.doorknob = 0;ISSafe.cheat = false;ISSafe.woodWorkXp = 0;ISSafe.doBuildMenu = function(player, context, worldobjects, test) if getCore():getGameMode()=="LastStand" then return; end ISSafe.woodWorkXp = getSpecificPlayer(player):getPerkLevel(Perks.Woodwork); local thump = nil; local square = nil; -- we get the thumpable item (like wall/door/furniture etc.) if exist on the tile we right clicked for i,v in ipairs(worldobjects) do square = v:getSquare(); if instanceof(v, "IsoThumpable") and not v:isDoor() then thump = v; end end -- dismantle stuff if thump and thump:isDismantable() and getSpecificPlayer(player):getInventory():contains("Saw") and getSpecificPlayer(player):getInventory():contains("Screwdriver") then if test == true then return true; end context:addOption(getText("ContextMenu_Dismantle"), worldobjects, ISSafe.onDismantle, thump, getSpecificPlayer(player)); end -- build menu -- if we have any thing to build in our inventory if ISSafe.haveSomethingtoBuild(player) then if test == true then return true; end local buildOption = context:addOption("ISZ Build", worldobjects, nil); -- create a brand new context menu wich contain our different material (wood, stone etc.) to build local subMenu = ISContextMenu:getNew(context); -- We create the different option for this new menu (wood, stone etc.) -- check if we can build something in wood material if haveSomethingtoBuildWood(player) then -- we add the subMenu to our current option (Build) context:addSubMenu(buildOption, subMenu); ------------------ WOODEN CRATE ------------------ ISSafe.buildContainerMenu(subMenu, player); end endendfunction ISSafe.haveSomethingtoBuild(player)--~ return true; return haveSomethingtoBuildWood(player);endfunction haveSomethingtoBuildWood(player) if ISSafe.cheat then return true; end ISSafe.planks = 0; ISSafe.nails = 0; ISSafe.hinge = 0; ISSafe.doorknob = 0; -- if not getSpecificPlayer(player):getInventory():contains("Hammer") and not haveSandbags then return false; end -- get the number of plank we got for i = 0, getSpecificPlayer(player):getInventory():getItems():size() - 1 do local item = getSpecificPlayer(player):getInventory():getItems():get(i); if item:getType() == "Plank" then ISSafe.planks = ISSafe.planks + 1; elseif item:getType() == "Nails" then ISSafe.nails = ISSafe.nails + 1; elseif item:getType() == "Doorknob" then ISSafe.doorknob = ISSafe.doorknob + 1; elseif item:getType() == "Hinge" then ISSafe.hinge = ISSafe.hinge + 1; end end -- we also check if there's any material on the ground, in a 3x3 square around the player local materialOnGround = buildUtil.checkMaterialOnGround(getSpecificPlayer(player):getCurrentSquare()); for i,v in pairs(materialOnGround) do if i == "Plank" then ISSafe.planks = ISSafe.planks + v; elseif i == "Nails" then ISSafe.nails = ISSafe.nails + v; elseif i == "Doorknob" then ISSafe.doorknob = ISSafe.doorknob + v; elseif i == "Hinge" then ISSafe.hinge = ISSafe.hinge + v; end end return true;end-- **********************************************-- ** *CONTAINER* **-- **********************************************ISSafe.buildContainerMenu = function(subMenu, player) local crateSprite = ISSafe.getSafeSprites(player); local crateOption = subMenu:addOption("Safe", worldobjects, ISSafe.onWoodenCrate, square, crateSprite, player); local toolTip = ISSafe.canBuild(4,8,2,1,0,0,crateOption, player); toolTip:setName("Safe"); toolTip.description = "Make a safe to keep a few items secure." .. toolTip.description; toolTip:setTexture(crateSprite.sprite);endISSafe.onWoodenCrate = function(worldobjects, square, crateSprite, player) -- sprite, northSprite local crate = ISWoodenContainer:new(crateSprite.sprite, crateSprite.northSprite); crate.renderFloorHelper = true crate.canBeAlwaysPlaced = true; crate.modData["need:Base.Plank"] = "4"; crate.modData["need:Base.Nails"] = "8"; crate.modData["need:Base.Hinge"] = "2"; crate.modData["need:Base.Doorknob"] = "1"; crate:setEastSprite(crateSprite.eastSprite); crate.player = player getCell():setDrag(crate, player);end-- **********************************************-- ** SPRITE FUNCTIONS **-- **********************************************ISSafe.getSafeSprites = function(player) local sprite = {}; sprite.sprite = "carpentry_01_16"; sprite.northSprite = "carpentry_01_17"; sprite.eastSprite = "carpentry_01_18"; return sprite;end-- **********************************************-- ** DISMANTLE **-- **********************************************ISSafe.onDismantle = function(worldobjects, thumpable, player) if luautils.walkAdj(thumpable:getSquare()) then ISTimedActionQueue.add(ISDismantleAction:new(player, thumpable)) endend-- **********************************************-- ** OTHER **-- **********************************************-- Create our toolTip, depending on the required materialISSafe.canBuild = function(plankNb, nailsNb, hingeNb, doorknobNb, baredWireNb, carpentrySkill, option, player) -- create a new tooltip local tooltip = ISSafe.addToolTip(); -- add it to our current option option.toolTip = tooltip; local result = true; if ISSafe.cheat then return tooltip; end tooltip.description = "<LINE> <LINE>" .. getText("Tooltip_craft_Needs") .. " : <LINE>"; -- now we gonna test all the needed material, if we don't have it, they'll be in red into our toolip if ISSafe.planks < plankNb then tooltip.description = tooltip.description .. " <RGB:1,0,0>" .. getItemText("Plank") .. " " .. ISSafe.planks .. "/" .. plankNb .. " <LINE>"; result = false; elseif ISSafe.planks >= plankNb then tooltip.description = tooltip.description .. " <RGB:1,1,1>" .. getItemText("Plank") .. " " .. ISSafe.planks .. "/" .. plankNb .. " <LINE>"; end if ISSafe.nails < nailsNb then tooltip.description = tooltip.description .. " <RGB:1,0,0>" .. getItemText("Nails") .. " " .. ISSafe.nails .. "/" .. nailsNb .. " <LINE>"; result = false; elseif ISSafe.nails >= nailsNb then tooltip.description = tooltip.description .. " <RGB:1,1,1>" .. getItemText("Nails") .. " " .. ISSafe.nails .. "/" .. nailsNb .. " <LINE>"; end if ISSafe.doorknob < doorknobNb then tooltip.description = tooltip.description .. " <RGB:1,0,0>" .. getItemText("Doorknob") .. " " .. ISSafe.doorknob .. "/" .. doorknobNb .. " <LINE>"; result = false; elseif ISSafe.doorknob >= doorknobNb then tooltip.description = tooltip.description .. " <RGB:1,1,1>" .. getItemText("Doorknob") .. " " .. ISSafe.doorknob .. "/" .. doorknobNb .. " <LINE>"; end if ISSafe.hinge < hingeNb then tooltip.description = tooltip.description .. " <RGB:1,0,0>" .. getItemText("Door Hinge") .. " " .. ISSafe.hinge .. "/" .. hingeNb .. " <LINE>"; result = false; elseif ISSafe.hinge >= hingeNb then tooltip.description = tooltip.description .. " <RGB:1,1,1>" .. getItemText("Door Hinge") .. " " .. ISSafe.hinge .. "/" .. hingeNb .. " <LINE>"; end if getSpecificPlayer(player):getPerkLevel(Perks.Woodwork) < carpentrySkill then tooltip.description = tooltip.description .. " <RGB:1,0,0>" .. getText("IGUI_perks_Carpentry") .. " " .. getSpecificPlayer(player):getPerkLevel(Perks.Woodwork) .. "/" .. carpentrySkill .. " <LINE>"; result = false; elseif getSpecificPlayer(player):getPerkLevel(Perks.Woodwork) >= carpentrySkill then tooltip.description = tooltip.description .. " <RGB:1,1,1>" .. getText("IGUI_perks_Carpentry") .. " " .. getSpecificPlayer(player):getPerkLevel(Perks.Woodwork) .. "/" .. carpentrySkill .. " <LINE>"; end if not result then option.onSelect = nil; option.notAvailable = true; end return tooltip;endISSafe.addToolTip = function() local toolTip = ISToolTip:new(); toolTip:initialise(); toolTip:setVisible(false); return toolTip;endEvents.OnFillWorldObjectContextMenu.Add(ISSafe.doBuildMenu); Link to comment Share on other sites More sharing options...
RoboMat Posted July 3, 2014 Share Posted July 3, 2014 Please post the rest of your code. It's kind of hard to tell from looking at just one line. Link to comment Share on other sites More sharing options...
Ivan Posted July 3, 2014 Author Share Posted July 3, 2014 Also on another note, after calling getCell():setDrag(container, _player); Im having trouble getting it to actually place the item. There is probably more to add. Link to comment Share on other sites More sharing options...
RoboMat Posted July 3, 2014 Share Posted July 3, 2014 As I said, without your code it is close to impossible to help you... Link to comment Share on other sites More sharing options...
Ivan Posted July 3, 2014 Author Share Posted July 3, 2014 I edited the first post and put the code up there earlier. Link to comment Share on other sites More sharing options...
RoboMat Posted July 3, 2014 Share Posted July 3, 2014 Ha! Didn't see that Link to comment Share on other sites More sharing options...
Ivan Posted July 3, 2014 Author Share Posted July 3, 2014 I was thinking to myself, "Hmm maybe he thought the above code was a copy from the installed lua." Which wouldn't be a huge mistake considering I borrowed all of the structure. *edit* I just looked at my code again...its spaghetti. Im going to redo the whole deal. Link to comment Share on other sites More sharing options...
Ivan Posted July 3, 2014 Author Share Posted July 3, 2014 Found the issue.toolTip.description = "A safe to keep a few things safe" .. toolTip.description;similar to ISBuildMenu.lua line 476toolTip.description = getText("Tooltip_craft_woodenCrateDesc") .. toolTip.description;My line needed to have a space at the end of the string liketoolTip.description = "A safe to keep a few things safe " .. toolTip.description;for the rest of the description tags to get interpreted. 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