Problem in functions in Python
Hi.
I've solved by myself a small problem of programming in python.
https://1drv.ms/u/s!AkbR0UiK-Eh-i6s5Iy2j9Te-rxW7Sg?e=gEFjng
I wrote this code in Python, I can't compile it.
According to what I understand, helping the translation into javascript the problem is that Python, in Minecraft makes a difference between a basic function, and function defined as a method (of the object player here).
Where I'm confusing, is I did not find any post about this reality, and that is true that I don't have any suggestion to make to Microsoft about it, except to have a compiling error message more explicit, introducing this kind of problem.
Thanks for all I'm learning through #MEE and those posts...
Fr. Bertrand
-
Hello, I think problem is in makecode core. When we define function call in event player.on_chat it has 3 hidden parameters (num1, num2, num3).
But in Your code on_chat function is called directly without parapmeters and compiler don't know what call is right and what to do with parameters
0 -
def on_chat(num1, num2, num3):player.tell(mobs.target(LOCAL_PLAYER), "This is a method of player")
on_chat(0, 0, 0)
player.on_chat("jump", on_chat)
def example():player.tell(mobs.target(LOCAL_PLAYER), "This is a real funtion")0
Please sign in to leave a comment.
Comments
2 comments