Time Nick Message 02:32 OldCoder 02:46 OldCoder Brackston, welcome! 03:08 Brackston Thank you 03:08 OldCoder 03:09 OldCoder Hm 06:02 OldCoder lumidify, lumidihi 06:03 lumidify Hi OldCoder 06:07 OldCoder o/ 06:41 OldCoder CWz, welcome 06:41 OldCoder CWz, this channel is not "shutting down" 06:41 OldCoder at all 19:18 tenplus1 hi folks 20:37 OldCoder https://github.com/Grandolf/filez.git 20:37 OldCoder Grandolf, cloning 20:37 OldCoder into grandolfia 20:38 Grandolf kk 20:38 OldCoder Which is still up, actually 20:38 OldCoder OK I C 2 mods 20:38 OldCoder npcf and wiki 20:38 Grandolf yea 20:38 OldCoder Wait 20:38 OldCoder Adding those to the test modset in grandolfia 20:39 OldCoder mv -i npcf wiki /opt/minebest/mtworlds/grandolfia/world_game/mods/ 20:39 Grandolf :P 20:40 OldCoder You added code to npcf... 20:40 Grandolf yes 20:40 OldCoder Well, it's a test world now 20:40 OldCoder Hold on 20:40 OldCoder I don't see the code; which file? 20:40 OldCoder Wait 20:40 OldCoder Found it 20:40 Grandolf mynpc.lua 20:40 Grandolf kk 20:41 OldCoder Grandolf, you're doing this call: 20:41 OldCoder wikilib.show_wiki_page(clicker:get_player_name(), "Main") 20:41 Grandolf yea 20:41 OldCoder But there is nothing to define wikilib 20:41 OldCoder Correct? 20:42 OldCoder Let me make a stub mod to work this out... 20:42 Grandolf kk 20:47 OldCoder Working on it 20:47 Grandolf k 20:48 OldCoder minetest.register_on_chat_message (function (name, message) 20:48 OldCoder if message == '/turtles' then 20:48 OldCoder minetest.chat_send_player (name, "moo") 20:48 OldCoder -- wikilib.show_wiki_page (name, "Main") 20:48 OldCoder return true 20:48 OldCoder end 20:48 OldCoder end) 20:48 OldCoder I have reduced your entire mod to that 20:48 OldCoder If we can make the wikilib line work, in business, right? 20:49 OldCoder This is a useful approach. Start simple. 20:49 OldCoder Now... How would this mod work? There is no wikilib. 20:49 OldCoder You asked me, how to include wikilib file. 20:49 Grandolf thats in /wiki 20:49 OldCoder Right, but where is the code? 20:49 OldCoder Check your mod 20:49 OldCoder You never include it 20:50 OldCoder Reviewing wiki mod now 20:50 OldCoder Adding this line to your mod's depends.txt 1st: 20:50 OldCoder wiki 20:50 OldCoder Now your mod will be sure to come after wiki is loaded 20:50 Grandolf there is a wikilib.lua 20:51 OldCoder Not in the github sources 20:51 OldCoder Check for yourself 20:51 OldCoder Only in the wiki mod 20:51 OldCoder I mean... 20:51 OldCoder Not in your new mod 20:51 OldCoder You included the wiki mod 20:52 Grandolf the wiki mod has the wiki.lua 20:52 OldCoder But there is no connection to your mod 20:52 OldCoder Right 20:52 OldCoder But is wikilib a public object? 20:52 Grandolf *wikilib.lua 20:52 OldCoder Hold on 20:53 OldCoder The wiki *mod* has a public object... so is the issue that you did not load wiki first? 20:53 OldCoder Testing 20:53 OldCoder minetest-restart grandolfia 20:54 OldCoder Forgot to uncomment that line... 20:55 OldCoder It works 20:55 OldCoder I see the Jailbreak page 20:55 OldCoder Go into Grandolfia if you like and type /turtles 20:55 Grandolf thats old 20:55 Grandolf kk 20:55 OldCoder Right 20:55 OldCoder But it came with the mod 20:55 Grandolf hm 20:55 OldCoder So, this actually works 20:55 OldCoder In your home world 20:56 OldCoder Try adding wiki to depends.txt in your revised mod 20:56 OldCoder Confirm that nothing still happens 20:56 OldCoder Can do that now? 20:56 Grandolf yes, doing it 20:57 Grandolf the npc on rightclick still isnt showing it :/ 20:57 OldCoder Fine 20:57 OldCoder Next test is this 20:58 OldCoder Rename init.lua in your new mod to init.save or something 20:58 OldCoder and add this init.lua instead: 20:58 OldCoder minetest.register_on_chat_message (function (name, message) 20:58 OldCoder if message == '/turtles' then 20:58 OldCoder minetest.chat_send_player (name, "moo") 20:58 OldCoder wikilib.show_wiki_page (name, "Main") 20:58 OldCoder return true 20:59 OldCoder end 20:59 OldCoder end) 20:59 OldCoder 20:59 OldCoder Double check typing or paste 20:59 OldCoder then restart your test world 20:59 OldCoder And after in and past any initial screens, type /turtles 20:59 OldCoder What happens? 21:01 Grandolf it works 21:01 Grandolf the wiki shows up 21:01 OldCoder So, we have 21:01 OldCoder a divide by two situation 21:01 OldCoder It is good to have such 21:01 OldCoder If something works and does not work... 21:02 OldCoder You look for middle and repeat 21:02 OldCoder Until issue is found 21:02 OldCoder But next step is this... 21:02 OldCoder In the place where the other call is... 21:02 OldCoder Add the "moo" line you see here 21:02 OldCoder minetest.chat_send_player (name, "moo") 21:02 OldCoder Hm, wait 21:02 OldCoder Need to get player name there, hold on 21:03 OldCoder Ah, you have it... 21:03 OldCoder wikilib.show_wiki_page(clicker:get_player_name(), "Main") 21:03 OldCoder Before that line... 21:03 OldCoder minetest.chat_send_player (clicker:get_player_name(), "moo") 21:03 OldCoder Insert that and restart 21:03 OldCoder All right? 21:03 Grandolf in the mynpc.lua? 21:04 OldCoder It is called 21:04 OldCoder newnpc.lua in my copy 21:04 Grandolf yea srry XD 21:04 OldCoder Wherever you have this line: 21:04 Grandolf it is that 21:04 OldCoder OK proceed 21:07 Grandolf nothing changed 21:07 OldCoder Grandolf, meaning 21:07 OldCoder Moo did not appear, right? 21:07 Grandolf on rightclick still give me the npc's name only 21:07 OldCoder Moo did not appear, right? 21:07 Grandolf correct 21:07 OldCoder This is good news 21:08 OldCoder Let us confirm next point... 21:08 OldCoder Moment, grepping 21:08 OldCoder minetest.log("action", "I Like Turtles") 21:08 OldCoder Insert that before the two special lines 21:08 OldCoder the chat_send_player and the show_wiki_page 21:08 OldCoder When you run minetest 21:09 OldCoder can you save output? How do you presently start it? 21:09 Grandolf i use the terminal 21:09 OldCoder You type just "minetest" or what? 21:09 Grandolf lotta.log has the logs 21:09 Grandolf ./runlotta.sh 21:09 OldCoder So, this is based on lotta and the logs are saved? 21:09 OldCoder Proceed 21:09 Grandolf for server 21:09 OldCoder Add that .log line 21:10 Grandolf minetest for minetest game 21:10 OldCoder Delete the old log file first 21:10 OldCoder 1) Stop game 21:10 OldCoder 2) Delete log file 21:10 OldCoder 3) Add that .log line 21:10 OldCoder 4) Restart 21:10 OldCoder 5) Profit 21:10 OldCoder minetest.log("action", "I Like Turtles") 21:10 OldCoder Insert that before the two special lines 21:10 OldCoder the chat_send_player and the show_wiki_page 21:10 Grandolf lotta.log right? 21:10 OldCoder Probably, let us try this 21:10 OldCoder Do #1-5 21:11 Grandolf alright 21:11 Grandolf server running 21:13 Grandolf https://pastebin.com/rW8LjbxU 21:19 OldCoder Grandolf, back in 4 minutes 21:19 OldCoder Or so 21:19 Grandolf kk 21:24 OldCoder Grandolf, R 21:24 OldCoder Grandolf, so, no turtles? 21:25 OldCoder Grandolf, conclusion: that block of code isn't being called 21:25 OldCoder Meaning, the issue isn't [presently] with the wiki code at all 21:25 Grandolf ic 21:27 OldCoder So, progress 21:27 OldCoder Does the output 21:27 OldCoder definitely contain no turtles? 21:28 Grandolf 2017-04-21 17:28:09: ACTION[Server]: Grandolf right-clicks object 38: LuaEntitySAO at (7,24,6) 21:28 Grandolf when i rightclick 21:30 Grandolf i gtg eat dinner 21:30 Grandolf cu later 21:31 OldCoder OK 21:31 OldCoder Grandolf, if you see this later, your code isn't hooking the event 21:31 OldCoder So, no need to worry about the wiki code yet 21:52 Grandolf kk 21:52 Grandolf im back 21:53 OldCoder Grandolf, see above 21:53 OldCoder Looking at how you hooked the event now 21:54 OldCoder So, you called register_npc 21:54 OldCoder Let's look at that... 21:55 OldCoder Grandolf, here? you can see the explanation for yourself if so 21:55 Grandolf yes 21:55 OldCoder OK 21:55 OldCoder Follow the preceding so far? 21:55 OldCoder The wikicode wasn't working 21:55 OldCoder Because the code was never *called* 21:55 Grandolf yea 21:55 OldCoder Understand how we have demonstrated this? 21:55 OldCoder Understand how we have demonstrated this? 21:55 Grandolf how do i get it to call? 21:55 Grandolf yes\ 21:55 OldCoder Well, that is the next part... 21:56 OldCoder We ask, How is it supposedly getting called? 21:56 OldCoder Answer is 21:56 OldCoder You are setting on_rightclick 21:56 OldCoder But who is using that? 21:56 OldCoder All of this is in a function call 21:56 OldCoder Scroll up, what function are you calling? 21:56 OldCoder Hint: 21:56 OldCoder Line 37 21:57 OldCoder of newnpcs.lua 21:57 OldCoder Grandolf 21:57 Grandolf npcf:register_npc("npcf:deco_npc9" ,{ 21:57 OldCoder So 21:57 Grandolf regist_npc 21:57 OldCoder You are calling a function named register_npc 21:57 OldCoder Which you are passing 21:57 OldCoder on_register = to 21:57 OldCoder and that is how 21:58 OldCoder you expect the wiki code to be called 21:58 OldCoder Got all that? 21:58 Grandolf yea 21:58 OldCoder Well, do this 21:58 OldCoder In the mod top dir 21:58 OldCoder grep register_npc *.lua 21:58 OldCoder What do you see? 21:59 Grandolf repalce * with what? 21:59 OldCoder Nothing 21:59 OldCoder grep register_npc *.lua 21:59 OldCoder Type that 21:59 Grandolf grep: *.lua: No such file or directory 21:59 OldCoder in the folder that has init.lua 21:59 OldCoder Where are you? 21:59 Grandolf in home 21:59 Grandolf moving 21:59 OldCoder No 21:59 OldCoder the mod's folder 22:00 OldCoder BTW We forgot something 22:00 OldCoder Grandolf, go to the mod's folder 22:00 OldCoder Indicate when there 22:00 Grandolf npcf.lua:function npcf:register_npc(name, def) 22:00 OldCoder Right 22:00 OldCoder Now 22:00 OldCoder Did you put init.lua back to normal? 22:00 OldCoder I forgot to advise this 22:00 Grandolf doing 22:01 Grandolf done 22:01 OldCoder Put init.lua back to normal, then restart 22:01 OldCoder Question 22:01 OldCoder Since there was no init.lua really 22:01 OldCoder How was it you could see the entity to click on? 22:01 OldCoder It should have said unknown? 22:01 OldCoder Not a minor point 22:01 OldCoder Is it being defined somewhere else? 22:01 Grandolf prob 22:01 OldCoder While you were using my debug code 22:02 OldCoder Right, so totally different problem 22:02 OldCoder Am I going too fast? 22:02 Grandolf no 22:02 OldCoder Let us track this 22:02 OldCoder Rename init.lua to something 22:02 OldCoder and type touch init.lua 22:02 OldCoder Do you now have your original init.lua renamed 22:02 OldCoder and a zero-length init.lua ? 22:03 Grandolf yea 22:03 OldCoder Restart and your NPCs should be gone 22:03 OldCoder Unknowns 22:03 OldCoder Confirm this 22:04 Grandolf yep 22:04 OldCoder But earlier 22:04 OldCoder Did you restart and do the /turtles test 22:04 OldCoder Or maybe forgot to restart? 22:04 OldCoder How was it that we reduced the mod to a /turtles command 22:05 OldCoder and your NPCs were still there? 22:05 Grandolf i left everything else 22:05 OldCoder OK! 22:05 Grandolf just added the turtles 22:05 OldCoder ^ Explanation 22:05 OldCoder Gud 22:05 OldCoder Now, put the init.lua back 22:05 OldCoder And let us review the register_npc function 22:05 OldCoder You will see something interesting there 22:06 OldCoder Indicate when ready to review 22:06 Grandolf ready 22:06 OldCoder Edit npcf.lua 22:06 OldCoder the file that grep showed 22:06 OldCoder register_npc is around line 150 22:06 OldCoder Go there or search for the name 22:07 Grandolf function npcf:register_npc(name, def) 22:07 OldCoder Scroll down and look for on_rightclick. What you will see... 22:08 OldCoder is that register_npc is a thin wrapper 22:08 OldCoder around register_entity 22:08 OldCoder It does not pass on_rightclick through directly 22:08 OldCoder Find this function's on_rightclick 22:08 Grandolf on_rightclick = function(self, clicker) 22:09 OldCoder There 22:09 OldCoder minetest.chat_send_player(player_name, self.npc_name) 22:09 OldCoder >>> minetest.chat_send_player(player_name, "woof") 22:09 OldCoder if type(def.on_rightclick) == "function" then 22:09 OldCoder >>> minetest.chat_send_player(player_name, "meow") 22:09 OldCoder def.on_rightclick(self, clicker) 22:09 OldCoder end 22:09 OldCoder Add the two lines I marked with >>> but leave out the >>> 22:09 OldCoder I will then explain 22:10 Grandolf add that or replace the on_rightclick= 22:10 OldCoder Add those two lines 22:10 OldCoder Leave everything 22:10 OldCoder I will then explain 22:11 Grandolf kk 22:12 OldCoder done? 22:12 Grandolf on rightclick im getting woof and meow too now 22:12 OldCoder What is happening 22:12 OldCoder is that the woof is coming from where the register_npc's own rightclick code is 22:12 OldCoder and the meow is coming from the code that is supposed to call YOUR rightclick code 22:13 OldCoder But you say that your rightclick code is not being called 22:13 OldCoder So, we have an inconsistency 22:13 OldCoder They are fun 22:13 OldCoder Wait 22:13 OldCoder Definitely getting a meow? 22:13 Grandolf yep 22:13 OldCoder Wait 22:14 OldCoder And this is definitely that entity 22:14 OldCoder the one with the stuff we added to its click function? 22:14 Grandolf im pretty sure, double checking 22:15 Grandolf hm 22:16 Grandolf i tried useing the giveme command and its claiming it doesnt exist\ 22:16 OldCoder 'cause somebody's right-click code is being called 22:16 OldCoder One bug at a time... 22:16 OldCoder Let's try this, then 22:16 OldCoder def.on_rightclick(self, clicker) 22:16 OldCoder Change that in the register_npc call to 22:17 OldCoder def.on_rightclick(self, clicker,player_name) 22:17 OldCoder Able to do that? 22:17 OldCoder Oh wait 22:17 OldCoder Stop 22:17 OldCoder Ha 22:17 OldCoder Grandolf, you here? 22:17 Grandolf yea 22:17 OldCoder Grandolf, look at the meow code 22:17 Grandolf just finished 22:17 Grandolf kk 22:17 OldCoder The lines after it 22:18 OldCoder def.on_rightclick(self, clicker) 22:18 OldCoder That is how your on_rightclick function is called 22:18 OldCoder Do you understand so far? 22:18 OldCoder That is the actual call to your function 22:18 Grandolf kk 22:18 OldCoder Now, the self part is odd, disregard it 22:18 Grandolf um was i suppose to put the meow with the npc? 22:18 OldCoder What is passed 22:18 OldCoder No, relax 22:18 OldCoder Now, the self part is odd, disregard it 22:18 OldCoder def.on_rightclick(self, clicker) 22:19 OldCoder What is being passed to your on_rightclick function 22:19 OldCoder What function arguments? 22:19 OldCoder If you don't know 22:19 OldCoder the terminology yet, I will explain 22:19 OldCoder def.on_rightclick(self, clicker) <<< this is a function call 22:20 OldCoder The function being called is your on_rightclick 22:20 OldCoder What is being sent to your on_rightclick to use 22:20 OldCoder Pro Tip: This is fun 22:20 OldCoder It is not Satanic Torture. Oh, well. 22:20 Grandolf minetest.chat_send_player(player_name, self.npc_name) 22:20 Grandolf if type(def.on_rightclick) == "function" then 22:20 Grandolf def.on_rightclick(self, clicker,player_name) 22:20 Grandolf minetest.chat_send_player(player_name, self.npc_name) 22:20 Grandolf minetest.chat_send_player(player_name, "woof") 22:20 Grandolf if type(def.on_rightclick) == "function" then 22:20 OldCoder Grandolf, indicate when back, we are about done 22:20 Grandolf minetest.chat_send_player(player_name, "meow") 22:20 Grandolf def.on_rightclick(self, clicker) 22:20 OldCoder 22:20 OldCoder Grandolf, look at this function call 22:21 OldCoder def.on_rightclick(self, clicker) 22:21 OldCoder Which you just pasted 22:21 OldCoder Do you know what a function argument is, yet? 22:21 Grandolf ik what a function is 22:21 OldCoder Do you know what a function argument is, yet? 22:21 OldCoder Not a function 22:21 OldCoder But a function argument 22:21 Grandolf not rerally XD 22:21 OldCoder You are bad 22:21 Grandolf ik lol 22:21 OldCoder I m going back to Mother 22:22 OldCoder A function 22:22 OldCoder in most languages 22:22 OldCoder takes arguments 22:22 Grandolf is it the else if stuff? 22:22 OldCoder Nope 22:22 OldCoder Guess! Point OFF! 22:22 OldCoder Bzzt 22:22 OldCoder A function 22:22 OldCoder takes arguments 22:22 OldCoder To work with 22:22 OldCoder for example 22:22 OldCoder int addme (int a, b) { return a+b; } 22:23 OldCoder That is a 'C' function. It takes a and b. 22:23 OldCoder It adds them and returns the result. 22:23 OldCoder In Lua... 22:23 OldCoder Testing 22:24 OldCoder Minute 22:24 OldCoder Business email came in, but just a minute 22:24 OldCoder We are almost done 22:24 Grandolf kk 22:27 OldCoder Letter answered, checking something about Lua 22:27 Grandolf kk 22:28 OldCoder function addme (a,b) return a+b; end 22:28 OldCoder I believe that is correct 22:29 OldCoder Grandolf, do you understand what a and b are here for? 22:29 Grandolf they are3 variable 22:29 Grandolf *are variables 22:29 OldCoder 2, not 3 22:29 OldCoder and they are function arguments 22:29 OldCoder Function arguments are things passed to a function 22:29 OldCoder to work with 22:29 OldCoder function addme (a,b) return a+b; end 22:29 OldCoder This function takes 2 of them 22:29 OldCoder Study that and comment 22:30 OldCoder Questions? 22:30 Grandolf no 22:30 OldCoder Can you write us a function that adds 3 integers? 22:30 Grandolf i think i get it 22:30 OldCoder Hint: 22:30 OldCoder function addme (a,b) return a+b; end 22:30 OldCoder ^ writes 2 22:30 OldCoder Show us one that adds 3 ? 22:31 OldCoder s/writes/adds/ 22:31 Grandolf function addme (a,b,c) return a+b; end 22:31 OldCoder Close 22:31 Grandolf oops 22:31 OldCoder Does that add 3 numbers? 22:31 Grandolf a+b 22:31 OldCoder should be? 22:31 Grandolf should b a+b+c 22:31 OldCoder yes 22:31 OldCoder OK NOW 22:31 OldCoder 22:31 OldCoder function addme (a,b,c) return a+b+c; end 22:32 OldCoder What would happen 22:32 OldCoder If somebody called that like this: 22:32 OldCoder 22:32 OldCoder addme ("bacon") 22:32 OldCoder I do not no wat to do 22:32 Grandolf return bacon 22:32 OldCoder Nope 22:32 OldCoder What does the function do? 22:32 OldCoder function addme (a,b,c) return a+b+c; end 22:32 OldCoder What is it expecting? 22:32 Grandolf more suff 22:32 Grandolf it would error? 22:32 OldCoder And stuff you can add 22:32 OldCoder Probably 22:33 OldCoder Or just ignore it or so on 22:33 OldCoder Able to see where this is headed? 22:33 OldCoder 22:33 OldCoder In the register_npc function 22:33 OldCoder Go to the meow code 22:33 OldCoder Indicate when there 22:33 Grandolf there 22:33 OldCoder Look at the on_rightclick call after it 22:33 OldCoder paste that call here 22:34 Grandolf def.on_rightclick(self, clicker) 22:34 OldCoder Now 22:34 OldCoder Go to the new file that has your wiki call 22:34 OldCoder Indicate when there 22:34 Grandolf on_rightclick = function(pos, node, clicker, itemstack) 22:34 OldCoder Ignore the self part 22:35 OldCoder That part is weird 22:35 OldCoder So 22:35 OldCoder clicker 22:35 OldCoder is sent 22:35 OldCoder and 22:35 OldCoder pos,node,clicker,itemstack 22:35 OldCoder is expected 22:35 OldCoder See a problem yet? 22:35 Grandolf yes 22:35 OldCoder Replace pos,node,clicker,itemstack 22:35 OldCoder with just clicker 22:35 Grandolf we need to add pos node and iremstack 22:35 OldCoder No 22:35 OldCoder because 22:35 OldCoder wikilib.show_wiki_page(clicker:get_player_name(), "Main") 22:35 OldCoder Does that need anything but clicker? 22:36 Grandolf not really 22:36 OldCoder Replace pos,node,clicker,itemstack with just clicker 22:36 OldCoder on_rightclick = function(pos, node, clicker, itemstack) 22:36 OldCoder becomes 22:36 OldCoder on_rightclick = function(clicker) 22:36 OldCoder Make that change 22:36 Grandolf no , after clicker right? 22:36 OldCoder Save file, exit, restart MT, click on your Disco Dancer 22:36 OldCoder Hm? 22:36 OldCoder Explain? 22:36 Grandolf nvm 22:36 OldCoder Ah 22:36 OldCoder It is optional 22:36 Grandolf kk 22:36 OldCoder Omit it this time 22:37 OldCoder Save file, exit, restart MT, click on your Disco Dancer 22:37 Grandolf it crashed 22:38 Grandolf luaentity_Rightclick(): ...esktop/lotta/worlds/lotta/worldmods/npcf/npcs/newnpc.lua:98: attempt to call method 'get_player_name' (a nil value) 22:38 OldCoder Moment 22:38 OldCoder Progress, anyway 22:38 Grandolf lol 22:38 OldCoder clicker does not have getplayername 22:38 OldCoder Go back 22:38 OldCoder to the register_npc function in the other file 22:38 OldCoder Indicate when there 22:38 Grandolf wikilib.show_wiki_page(clicker:get_player_name(), "Main") 22:39 Grandolf add player_name after clicker? 22:39 OldCoder Yes 22:39 OldCoder Worth a shot 22:39 OldCoder Not there 22:39 OldCoder Go back to the register_npc function in the other file 22:39 OldCoder Indicate when there 22:40 Grandolf minetest.chat_send_player(player_name, self.npc_name) 22:40 Grandolf if type(def.on_rightclick) == "function" then 22:40 Grandolf def.on_rightclick(self, clicker,player_name) 22:40 OldCoder Right 22:40 OldCoder Save and edit the other file now 22:40 Grandolf its already got playername 22:40 Grandolf npcf.lua 22:40 OldCoder on_rightclick = function(clicker, player_name) 22:40 OldCoder Is that it? 22:41 OldCoder make that change 22:41 OldCoder and 22:41 Grandolf on_rightclick = function(clicker,player_name) 22:41 OldCoder wikilib.show_wiki_page(player_name, "Main") 22:41 OldCoder that one too 22:41 OldCoder Note underscore in both places 22:41 OldCoder Now, the "self" part doesn't line up, but ignore that unless it still crashes 22:41 OldCoder Can you paste 22:42 OldCoder the entire short on_rightclick = function block ? 22:42 Grandolf in the npcf or newnpc? 22:42 OldCoder on_rightclick = only happens in newnpc 22:42 OldCoder IIRC 22:42 Grandolf on_rightclick = function(clicker,player_name) 22:42 Grandolf if clicker then 22:42 Grandolf minetest.log("action", "I Like Turtles") 22:42 Grandolf minetest.chat_send_player (name, "moo") 22:43 Grandolf wikilib.show_wiki_page(clicker:get_player_name(), "Main") 22:43 Grandolf end 22:43 Grandolf end, 22:43 OldCoder You did not make the 2nd change 22:43 OldCoder wikilib.show_wiki_page(player_name, "Main") 22:43 OldCoder That one 22:43 Grandolf take out get_ 22:43 OldCoder No 22:43 OldCoder Reduce it all the way to this: 22:43 OldCoder wikilib.show_wiki_page(player_name, "Main") 22:43 Grandolf kk 22:44 OldCoder Also change the chat call to 22:44 OldCoder minetest.chat_send_player (player_name, "moo") 22:44 OldCoder Then repaste this block here 22:44 Grandolf on_rightclick = function(clicker,player_name) 22:44 Grandolf if clicker then 22:45 Grandolf minetest.log("action", "I Like Turtles") 22:45 Grandolf minetest.chat_send_player (player_name, "moo") 22:45 Grandolf wikilib.show_wiki_page(player_name, "Main") 22:45 Grandolf end 22:45 Grandolf end, 22:45 OldCoder Right 22:45 OldCoder In general 22:45 OldCoder Look at functions and understand 22:45 OldCoder where all of the values come from 22:45 OldCoder Here, two are passed in 22:45 OldCoder And both are used 22:45 OldCoder Study this code briefly, please 22:46 OldCoder Indicate if do or don't understand each line 22:46 Grandolf i do 22:46 OldCoder Now, the other file... 22:46 OldCoder def.on_rightclick(self, clicker,player_name) 22:46 OldCoder Lines up... except for self 22:46 OldCoder Ignore that for the moment 22:46 OldCoder Save, restart, go find a Disco 22:47 Grandolf it crashed again 22:47 Grandolf getting log 22:47 Grandolf luaentity_Rightclick(): ...esktop/lotta/worlds/lotta/worldmods/npcf/npcs/newnpc.lua:97: bad argument #1 to 'chat_send_player' (string expected, got userdata) 22:47 Grandolf 2017-04-21 18:46:06: ERROR[Main]: stack traceback: 22:47 Grandolf 2017-04-21 18:46:06: ERROR[Main]: [C]: in function 'chat_send_player' 22:47 Grandolf 2017-04-21 18:46:06: ERROR[Main]: ...esktop/lotta/worlds/lotta/worldmods/npcf/npcs/newnpc.lua:97: in function 'on_rightclick' 22:47 Grandolf 2017-04-21 18:46:06: ERROR[Main]: .../halt/Desktop/lotta/worlds/lotta/worldmods/npcf/npcf.lua:248: in function <.../halt/Desktop/lotta/worlds/lotta/worldmods/npcf/npcf.lua:235> 22:47 OldCoder Wait 22:48 OldCoder Try changing 22:48 OldCoder Moment, checking, close 22:49 OldCoder on_rightclick = function(clicker,player_name) 22:49 OldCoder change that to 22:49 OldCoder on_rightclick = function(stuff,clicker,player_name) 22:50 OldCoder then save, restart 22:50 sfan5 chat_send_player takes a string, you'll need to use clicker:get_player_name() in the call 22:50 OldCoder sfan5, t y 22:50 OldCoder sfan5, is self to be added or ignored here? 22:50 OldCoder If the API does 22:50 OldCoder def.on_rightclick(self, clicker,player_name) 22:51 sfan5 for entities self is always included IIRC 22:51 OldCoder def.on_rightclick(self, clicker,player_name) 22:51 OldCoder Should the receiving function say 22:51 OldCoder on_rightclick = function(something,clicker,player_name) 22:51 OldCoder ? 22:51 sfan5 probably 22:51 Grandolf it crashed 22:51 OldCoder Grandolf, 2 changes 22:51 OldCoder sfan5 just added another one 22:51 OldCoder Change #1 22:51 OldCoder on_rightclick = function(something,clicker,player_name) 22:51 OldCoder You made that one? 22:52 Grandolf kk 22:52 Grandolf and #2? 22:52 sfan5 i usually define entity callbacks outside of the table as function EntityClass:on_rightlick(params, here) 22:52 OldCoder He is just learning function arguments 22:52 OldCoder Possibly just removing the chat line 22:52 OldCoder will finish 22:53 OldCoder Grandolf, remove the "moo" line for now 22:53 OldCoder If still crashes, we must be very close, regardless 22:54 Grandolf it did 22:54 Grandolf [Mod Aging] Recorded Ages. 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback luaentity_Rightclick(): ...lt/Desktop/lotta/worlds/lotta/worldmods/wiki/wikilib.lua:34: Invalid core.check_player_privs argument type: nil 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: stack traceback: 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: [C]: in function 'error' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: /opt/minetest/share/minetest/builtin/game/misc.lua:13: in function 'check_player_privs' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: ...lt/Desktop/lotta/worlds/lotta/worldmods/wiki/wikilib.lua:34: in function 'get_page_path' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: ...lt/Desktop/lotta/worlds/lotta/worldmods/wiki/wikilib.lua:97: in function 'load_page' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: ...lt/Desktop/lotta/worlds/lotta/worldmods/wiki/wikilib.lua:142: in function 'get_wiki_page_formspec' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: ...lt/Desktop/lotta/worlds/lotta/worldmods/wiki/wikilib.lua:188: in function 'show_wiki_page' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: ...esktop/lotta/worlds/lotta/worldmods/npcf/npcs/newnpc.lua:97: in function 'on_rightclick' 22:54 Grandolf 2017-04-21 18:53:42: ERROR[Main]: .../halt/Desktop/lotta/worlds/lotta/worldmods/npcf/npcf.lua:253: in function <.../halt/Desktop/lotta/worlds/lotta/worldmods/npcf/npcf.lua:235> 22:54 OldCoder Oops 22:54 Grandolf shouldve pastebinned that 22:54 OldCoder Wait, Reviewing 22:55 OldCoder Made it into the wiki code... 22:55 OldCoder Grandolf, I think I'd better try to reproduce this one... 22:56 OldCoder Able to github latest versions of the two mods? And are they all I need from you for this? 22:56 OldCoder I spawn the entity 22:56 OldCoder and try to right click on it? 22:56 Grandolf yea 22:56 Grandolf 1 sec 22:57 OldCoder Nathans21, good day 22:58 Nathans21 Hi oldcoder 22:58 OldCoder o/ 22:58 Grandolf https://github.com/Grandolf/filez.git 22:59 OldCoder Grandolf, I will clone and attempt reproduce. Sorry not fixed but this was hopefully instructive... 22:59 OldCoder You had two function contexts 22:59 OldCoder A call and a definition 22:59 OldCoder That definitely were not lining up. Probably still off. Do you understand this part? 22:59 Grandolf yea\ 22:59 OldCoder Not the still off part... might be several explanations 23:00 OldCoder But function call and function definition must match 23:00 OldCoder With special cases 23:00 OldCoder There are languages 23:00 OldCoder where the 1st argument is weird... "self" looked like that, but sfan5 is not sure 23:00 OldCoder So, the key lessons for the day are... 23:00 OldCoder * understand function arguments in calls and definitions 23:01 OldCoder * debug code such as the woof and meow we did can tell you if code is being called at all 23:01 OldCoder * get basics of setup down; you were missing a line in depends.txt. To get basics down, simple test cases can be helpful. 23:01 OldCoder Is this acceptable for today? 23:02 OldCoder I propose to check to see if the arguments both line up and are correct 23:02 OldCoder The player parameter, clicker probably 23:02 OldCoder Is not coming through correctly... 23:02 OldCoder when privs of that player are checked, deep in the wiki operation 23:03 OldCoder The player is being rejected, things turn up nil, and game goes belly up 23:03 OldCoder 23:03 Grandolf kk 23:03 Grandolf thks OC :) 23:03 OldCoder Grandolf, pleasure to fiddle with this, we will talk again... 23:03 OldCoder I'll have time to clone and test after I finish some SQL work this weekend 23:03 OldCoder AFK for now 23:03 Grandolf k, cu 23:03 OldCoder