Community Forum

How to get ActionEvent status from existing Specialization

Forum Overview >> Scripting

CategoryScripting
Created18.01.2019 11:56


Kenny Je (kenny456) 18.01.2019 11:56
How can i get if LOWER_IMPLEMENT is pressed? Like this in FS17:
if InputBinding.hasEvent(InputBinding.LOWER_IMPLEMENT) then...

I know how to register new action events in new specialization and how to use them but i need this.

Viper Gts (ViperGTS96) 18.01.2019 13:17
I'm still unsure how to get if it was called but have a look here:

https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=102&class=7134#updateActionEvents119349

--

So " InputAction.LOWER_IMPLEMENT " is *probably the new input name,

" g_inputBinding:setActionEventActive(InputAction.LOWER_IMPLEMENT, true); " - *Should activate the input.

Possibly the table " self.inputInformation " may be the table which contains fired events. like "hasEvent" (eg. self.inputInformation.hasEvent)

Hope this helps & best of luck!

* = no guarantee

Kenny Je (kenny456) 21.01.2019 14:57
Table "self.inputInformation" doesnt exists. I also tried to search in whole table self for similar information but didnt find anything. Can anyone help me please?

Viper Gts (ViperGTS96) 22.01.2019 12:06
This shows how to get the value InputAction.TOGGLE_COVER:

function TurnOnVehicle:setIsTurnedOn(isTurnedOn, noEventSend)
local spec = self.spec_turnOnVehicle
if isTurnedOn ~= spec.isTurnedOn then
SetTurnedOnEvent.sendEvent(self, isTurnedOn, noEventSend)
spec.isTurnedOn = isTurnedOn
local actionEvent = spec.actionEvents[InputAction.TOGGLE_COVER]
local text
if spec.isTurnedOn then
SpecializationUtil.raiseEvent(self, "onTurnedOn")
text = string.format(g_i18n:getText(spec.turnOffText), self.typeDesc)
else
SpecializationUtil.raiseEvent(self, "onTurnedOff")
text = string.format(g_i18n:getText(spec.turnOnText), self.typeDesc)
end
if actionEvent ~= nil then
g_inputBinding:setActionEventText(actionEvent.actionEventId, text)
end
end
end

https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=70&class=7318#setIsTurnedOn120852
------------------


if self.isClient then
if not spec.isAlwaysTurnedOn and not spec.turnedOnByAttacherVehicle then
-- update activity of actionEvent
if spec.actionEvents ~= nil then
local actionEvent = spec.actionEvents[spec.toggleTurnOnInputBinding]
if actionEvent ~= nil and actionEvent.actionEventId ~= nil then
local state = self:getCanToggleTurnedOn()
if state then
local text
if isTurnedOn then
text = string.format(g_i18n:getText("action_turnOffOBJECT"), self.typeDesc)
else
text = string.format(g_i18n:getText("action_turnOnOBJECT"), self.typeDesc)
end
g_inputBinding:setActionEventText(actionEvent.actionEventId, text)
end
g_inputBinding:setActionEventActive(actionEvent.actionEventId, state)
end
end
end
end

https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=70&class=7318#onUpdate120850



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