13 Jan 2024 |
urm (uramer) | I'm confused about what's wrong | 08:23:14 |
ancient7861 | Hello. Functions with an interface AI will only work from a local script attached to specific actors? Or can they work from a local script attached to the activator? I need to start a fight with a player | 10:14:20 |
come1244 | Local attached to the actor i think. Otherwise there is no reason to attach it to a local. GameObject:sendEvent(eventName, eventData) from activator to actor. (I think, i'm still a trainee) | 11:48:08 |
ancient7861 | thanks, I'm even more of a trainee | 12:36:30 |
zackhasacat | Sorry for the unclearness.
If I use the example linked above, I get this error:
[08:39:27.604 E] Can't start L@0x1[filename]; Lua error: Unknown action key: "Activate" | 14:40:28 |
zackhasacat | And doing for i, x in pairs(input.actions) do print(i) end produces weird results. If I do input.triggers it doesn't print anything | 14:41:09 |
| sarge945 changed their profile picture. | 15:59:03 |
urm (uramer) | Alright, I'll try it later | 16:48:37 |
clavernever | Hello! | 19:07:31 |
clavernever | Just a short question: can I have multiple engine handlers on a single script to trigger different parts of it on different timers/events? | 19:08:05 |
zackhasacat | You can have any amount of different engine handlers | 19:08:32 |
zackhasacat | and then, in your engine handler you can handle it depending on your situation | 19:08:45 |
clavernever | And as a followup is there any trouble if I define functions with all the stuff I'll do first and then clump all the engine triggers at the end, by calling such functions? | 19:09:14 |
clavernever | Awesome :D | 19:09:23 |
plan9fromtauceti | you cant have something like this though
return {
engineHandlers = {
exampleEngineHandler = function() end
exampleEngineHandler = function() end
}
} | 19:10:17 |
| plan9fromtauceti changed their profile picture. | 19:10:22 |
zackhasacat | Many of my files look like this:
return { engineHandlers = { onKeyPress = onKeyPress,
onSave = function() return { bookData = bookData } end, onLoad = function(data) if not data then return end if not data.bookData then return end bookData = data.bookData updateNearbyBooks() end, }, eventHandlers = {BookUpdate = bookUpdate} } | 19:10:40 |
zackhasacat | You can only have one onLoad, but any amount of logic inside of it. | 19:10:57 |
zackhasacat | * Many of my files look like this:
return {
engineHandlers = {
onKeyPress = onKeyPress,
onSave = function()
return { bookData = bookData }
end,
onLoad = function(data)
if not data then return end
if not data.bookData then return end
bookData = data.bookData
updateNearbyBooks()
end,
},
eventHandlers = {BookUpdate = bookUpdate}
} | 19:11:04 |
clavernever | Download image.png | 19:12:25 |
clavernever | alright that helps, I.. didn't quite get how to write them at first | 19:12:25 |
clavernever | So if I'm getting it right, engine handlers are just lua data that gets "opened" by the engine, so I should define them as I would any other variable, right? | 19:13:28 |
clavernever | Yes I said right twice in the same sentence, yes it's redundant, no I won't fix it | 19:14:05 |
clavernever | My inner grammar nazi screams in agony | 19:14:21 |
clavernever | * My inner grammar nazi screams in agony xD | 19:14:42 |
plan9fromtauceti | engine Handlers are functions that are called by the engine when an event happens that triggers them (onKeyPress handlers are called when a key is pressed, onFrame is called every frame etc) | 19:15:09 |
zackhasacat | What is oninit? | 19:15:26 |
zackhasacat | I don't see any function declaration on it | 19:15:39 |
plan9fromtauceti | yeah im confused about the syntax too | 19:15:47 |
clavernever | Download image.png | 19:15:57 |