Community Forum

hasEvent

Forum Overview >> Scripting

CategoryScripting
Created22.06.2020 16:36


Mateusz Miszczak (Unknown) 22.06.2020 16:36
Hello everyone

I have a problem. I'm converting the script but I don't know how to replace "hasEvent". I've read a bit about it but I still don't know how to solve this problem.
Here is a piece of code:

if self.currentMode ~= tool.TransportMode then
g_currentMission:addHelpButtonText(g_i18n:getText("TransportMode"), InputBinding.TransportMode)
if InputBinding.hasEvent(InputBinding.TransportMode) then
self:changeMode(Tool.TransportMode)
self:playAttachSound()
end
end

When I approach the tool, it has to change the mode of operation.
Thank you for your help.
Greetings to
Matthew

Bilbo Beutlin (BBeutlin) 22.06.2020 17:05
In FS19 the events are not reported automatically anymore. You must define explicitely which types of event should be respected. With this method you don't need to poll continously possible events.

The general scheme is
- with your mod function 'registerEventListeners()' you tell the system what should be processed.
This function has individual 'registerEventListener()' which are linked with your mod functions. So the event parser can jump directly into your function.
- these eventListeners must be refreshed for continous polling. There are several methods, see the documentations here on GDN or use example mods as template.


Note: Log in to post. Create a new account here.