OnUpdatingSign and OnUpdatedSign - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: OnUpdatingSign and OnUpdatedSign (/thread-819.html) |
OnUpdatingSign and OnUpdatedSign - NiLSPACE - 03-04-2013 when do these get fired? becouse i am now working on a sign plugin where you can right-click on a sign to make the weather or time change but they both only get fired when i created a sign. RE: OnUpdatingSign and OnUpdatedSign - xoft - 03-04-2013 Yes, they both fire only when the sign is created (when its text is set). If you want to catch a rightclick on a sign, you need to use OnPlayerRightClick() hook. RE: OnUpdatingSign and OnUpdatedSign - NiLSPACE - 03-04-2013 but how can the plugin know what text is on the sign? RE: OnUpdatingSign and OnUpdatedSign - xoft - 03-04-2013 Use the cWorld::GetSignLines() function. RE: OnUpdatingSign and OnUpdatedSign - NiLSPACE - 03-04-2013 how to use that function? i can't find it on the wiki. RE: OnUpdatingSign and OnUpdatedSign - xoft - 03-04-2013 should be as easy as calling: Code: local Line1, Line2, Line3, Line4 = World:GetSignLines(BlockX, BlockY, BlockZ); RE: OnUpdatingSign and OnUpdatedSign - NiLSPACE - 03-04-2013 it wants more parameters than only BlockX, BlockY and BlockZ. it wants 4 more in total. RE: OnUpdatingSign and OnUpdatedSign - xoft - 03-04-2013 Hmm, then the ToLua is generating wrong lua glue code. True, it cannot know that those 4 parameters are out-only. Until we fix that, pass in 4 more empty strings: Code: local Line1, Line2, Line3, Line4 = World:GetSignLines(BlockX, BlockY, BlockZ, "", "", "", ""); RE: OnUpdatingSign and OnUpdatedSign - NiLSPACE - 03-04-2013 i don't get the lines when i do LOG(Line1) i get nothing :S RE: OnUpdatingSign and OnUpdatedSign - xoft - 03-04-2013 Then build a debug version of MCServer, put a breakpoint in cChunk::GetSignLines() and try to find out why it's not working Debugging the problem is often the most fun, so why not try it? |