Can someone help me know why this isn’t working?
I have a loader (aka controller) that loads my main collection when the user selects the play button. I’m Trying to also send a message to the main telling the main collection what mode to play. I guess I can create 3 different collection of game modes, but it’s so much smaller code if I just capture the few minor differences in the main collection. So anyway I get this error:
Could not send message ‘casual_game’ from ‘loader:/go#loader’ to ‘main:/factories#startgame’.
I’ve done a print(msg.url()) and confirmed it’s the correct full URL from the loader to the startgame script.
this is my loader script:
local function load_menu(self)
msg.post("go#mainmenu", "load")
msg.post("go#mainmenu", "enable")
end
local function unload_menu(self)
msg.post("go#mainmenu","unload")
end
local function load_main(self)
msg.post("go#main", "load")
msg.post("go#main", "enable")
msg.post("main:/factories#startgame", hash("casual_game"))
end
local function unload_main(self)
msg.post("go#main", "unload")
end
function init(self)
msg.post(".", "acquire_input_focus")
load_menu(self)
end
function on_message(self, message_id, message, sender)
if message_id == hash("start_casual") then
unload_menu(self)
load_main(self)
elseif message_id == hash("goto_menu") then
unload_main(self)
load_menu(self)
end
end
Any suggestions are very much welcomed.