!bZkoSqWsCTysAjmRaC:matrix.org

OpenMW Lua

1568 Members
https://openmw.org/ || Rules: https://rentry.co/omw_rules || Other rooms related to OpenMW: #openmw-space:matrix.org5 Servers

Load older messages


SenderMessageTime
13 Jan 2024
@_discord_102182125494636544:t2bot.iourm (uramer) I'm confused about what's wrong 08:23:14
@_discord_841196818838847528:t2bot.ioancient7861 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
@_discord_692321051480293406:t2bot.iocome1244 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
@_discord_841196818838847528:t2bot.ioancient7861 thanks, I'm even more of a trainee 12:36:30
@_discord_127678330722844672:t2bot.iozackhasacat 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
@_discord_127678330722844672:t2bot.iozackhasacat 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
@_discord_194426276356816896:t2bot.iosarge945 changed their profile picture.15:59:03
@_discord_102182125494636544:t2bot.iourm (uramer) Alright, I'll try it later 16:48:37
@_discord_384870211381100544:t2bot.ioclavernever Hello! 19:07:31
@_discord_384870211381100544:t2bot.ioclavernever 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
@_discord_127678330722844672:t2bot.iozackhasacat You can have any amount of different engine handlers 19:08:32
@_discord_127678330722844672:t2bot.iozackhasacat and then, in your engine handler you can handle it depending on your situation 19:08:45
@_discord_384870211381100544:t2bot.ioclavernever 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
@_discord_384870211381100544:t2bot.ioclavernever Awesome :D 19:09:23
@_discord_325534431756550144:t2bot.ioplan9fromtauceti you cant have something like this though
return {
  engineHandlers = {
    exampleEngineHandler = function() end
    exampleEngineHandler = function() end
  }
}
19:10:17
@_discord_325534431756550144:t2bot.ioplan9fromtauceti changed their profile picture.19:10:22
@_discord_127678330722844672:t2bot.iozackhasacat 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
@_discord_127678330722844672:t2bot.iozackhasacat You can only have one onLoad, but any amount of logic inside of it. 19:10:57
@_discord_127678330722844672:t2bot.iozackhasacat * 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
@_discord_384870211381100544:t2bot.ioclaverneverimage.png
Download image.png
19:12:25
@_discord_384870211381100544:t2bot.ioclavernever alright that helps, I.. didn't quite get how to write them at first 19:12:25
@_discord_384870211381100544:t2bot.ioclavernever 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
@_discord_384870211381100544:t2bot.ioclavernever Yes I said right twice in the same sentence, yes it's redundant, no I won't fix it 19:14:05
@_discord_384870211381100544:t2bot.ioclavernever My inner grammar nazi screams in agony 19:14:21
@_discord_384870211381100544:t2bot.ioclavernever * My inner grammar nazi screams in agony xD 19:14:42
@_discord_325534431756550144:t2bot.ioplan9fromtauceti 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
@_discord_127678330722844672:t2bot.iozackhasacat What is oninit? 19:15:26
@_discord_127678330722844672:t2bot.iozackhasacat I don't see any function declaration on it 19:15:39
@_discord_325534431756550144:t2bot.ioplan9fromtauceti yeah im confused about the syntax too 19:15:47
@_discord_384870211381100544:t2bot.ioclaverneverimage.png
Download image.png
19:15:57

Show newer messages


Back to Room ListRoom Version: 6