I mean return from the drawing function, like that:
Code: Select all
party.party:addConnector("onDrawGui", self.go.id, "newsheet")
drawFlag = true
function newsheet(self, context)
if drawFlag then
textlist()
local width = context.width
local height = context.height
local offset = context.width * .1
context.drawImage2("mod_assets/textures/dc_octog4_panel.tga",5,5,0,0,640, 480, width, height)
context.drawRect(offset, (0.8 * height), 90, 30)
context.color(0,0,0,255)
context.drawText("CLOSE", offset+10, (0.8 * height)+20)
if ( context.button("CLOSE", offset+10, (0.8 * height)+10, 90, 90) ) then
print("CLOSED")
--party.party:removeConnector("onDrawGui", self.go.id, "newsheet")
drawFlag = false
end
context.font("large")
context.drawParagraph(bufferpage, offset, context.height*.1, width*.8)
end
end
Re-Edit: oops! I did not see that you used self.go.id in your removeConnector. This can not work, as in this function, self is the party component. You should use instead:
Code: Select all
party.party:removeConnector("onDrawGui", "myScript", "newsheet")
where "myScript" is the ID of your script entity with the newsheet function.