Error with message (SOLVED)

ERROR:SCRIPT: main/enemy.script:46: Field id not specified in table
stack traceback:
[C]: in function 'post’
main/enemy.script:46: in function <main/enemy.script:41>

enemy.script

45  msg.post("/enemies#script", "delete_me")
46  msg.post("main:/script#script", "animation")
47  msg.post(".", "explosion")

main.script (message receptor script)

34  if message_id == hash("animation") then
35    msg.post(sender.path, "play_animation")
36  end

1 Like

You have unfortunately hit an old bug. If you give your message the same name as a predefined system message (“play_animation” in this case), the engine will detect that as a system message and try to validate it according to the format of that specific message. This is why it complains about the missing “id” field. You need to give your message a different name. Sorry about that!

3 Likes

Thanks I am doing my first project and I have this problem and I don’t have any idea to make it work.

@Raul_Gilabert: Were you able to solve your problem based on the reply from Ragnar?

Yes, I could

2 Likes

Just hit this bug after updating Defold - message name “resize” was to blame. Changing it to “_resize” fixed it.

Just FYI
I’m still getting the same exact error with “resize” in 1.2.184

1 Like

I’m learning Defold and I came across this same error when using:

msg.post("/secondobject#secondobject", "animation_done")

I found this topic and solved it by changing “animation_done” to something else.