Spine events strange behavior? (SOLVED)

I try to use spine event in my game. I open default spine exmple spineboy. In animation run i have event footstep.
The event_id and string is hash unknown.

 if message_id == hash("spine_event") then
	 	print("event")
	 	print(message.animation_id)
	 	print(message.string)
	 	print(message.float)
	 	print(message.integer)
	 	print(message.event_id)
	 end
DEBUG:SCRIPT: hash: [run]
DEBUG:SCRIPT: hash: [506781175942165360 (unknown)]
DEBUG:SCRIPT: -6.0999999046326
DEBUG:SCRIPT: -6
DEBUG:SCRIPT: hash: [16224603004384669073 (unknown)]

If i add line
print(message.event_id == hash(“footstep”))
Is it expected behavior?

DEBUG:SCRIPT: event
DEBUG:SCRIPT: hash: [run]
DEBUG:SCRIPT: hash: [506781175942165360 (unknown)]
DEBUG:SCRIPT: -6.0999999046326
DEBUG:SCRIPT: -6
DEBUG:SCRIPT: hash: [16224603004384669073 (unknown)]
DEBUG:SCRIPT: true
DEBUG:SCRIPT: state changed 0
DEBUG:SCRIPT: state changed 1
DEBUG:SCRIPT: event
DEBUG:SCRIPT: hash: [run]
DEBUG:SCRIPT: hash: [506781175942165360 (unknown)]
DEBUG:SCRIPT: -6.0999999046326
DEBUG:SCRIPT: -6
DEBUG:SCRIPT: hash: [footstep]
DEBUG:SCRIPT: true

This is because during the build step, we hash the event names and just store the hashed value. Which means the engine is unable to “reverse hash” the event names at runtime… Unless if you hash the string “footstep” yourself before the reverse hashing occurs (as in your last code example), the engine will then be able to reverse hash the event name. :slight_smile:

So I would not say that this is a bug. As you can see the hashes are the same in both examples, but the reverse hashing mechanism were not able to find the corresponding string in the first code example.

3 Likes