FS19 converted script error LUA call stack

Your forum for all discussions around Modding.
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

FS19 converted script error LUA call stack

Post by onlybr »

Hello, I was trying to convert an agricultural plane mod from fs19 to fs22 for personal use in singleplayer, but I am facing some problems, which I cannot solve. The first of them is possible to identify when I go to the store and find the plane, after selecting, it loads infinitely as per the attached photo, in addition, when making the purchase, the purchase message also loads infinitely. On the other hand, several LUA script errors are appearing in the log, which are highlighted below as well.

So I would like to ask for help if anyone can identify what I can modify to fix this please. *thumbsup*
logscript.txt
log error
(12.87 KiB) Downloaded 38 times
Image

Code: Select all

2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (322) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (447) : getConfigKey
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (258) : initExtraOptions
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (667) : raiseEvent
  dataS/scripts/gui/ShopConfigScreen.lua (1077) : load
  dataS/scripts/gui/ShopConfigScreen.lua (882) : loadCurrentConfiguration
  dataS/scripts/gui/ShopConfigScreen.lua (1242) : updateData
  dataS/scripts/gui/ShopConfigScreen.lua (1397) : updateDisplay
  dataS/scripts/gui/ShopMenu.lua (545) : setStoreItem
  dataS/scripts/gui/ShopController.lua (263) : callback
  dataS/scripts/gui/ShopController.lua (996) : switchToConfigurationCallback
  dataS/scripts/gui/ShopController.lua (972) : buyVehicle
  dataS/scripts/gui/ShopMenu.lua (947) : buy
  dataS/scripts/gui/ShopMenu.lua (1113) : buyItem
  dataS/scripts/gui/ShopItemsFrame.lua (435) : notifyActivatedDisplayItemCallback
  dataS/scripts/gui/elements/SmoothListElement.lua (1239) : raiseCallback
  dataS/scripts/gui/elements/SmoothListElement.lua (1218) : notifyDoubleClick
  dataS/scripts/gui/elements/SmoothListElement.lua (1299) : onMouseUp
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/base/Gui.lua (666) : mouseEvent
  dataS/scripts/events.lua (26) : mouseEvent
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (322) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (447) : getConfigKey
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (258) : initExtraOptions
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (667) : raiseEvent
  dataS/scripts/gui/ShopConfigScreen.lua (1077) : load
  dataS/scripts/gui/ShopConfigScreen.lua (882) : loadCurrentConfiguration
  dataS/scripts/gui/ShopConfigScreen.lua (1242) : updateData
  dataS/scripts/gui/ShopConfigScreen.lua (1397) : updateDisplay
  dataS/scripts/gui/ShopMenu.lua (545) : setStoreItem
  dataS/scripts/gui/ShopController.lua (263) : callback
  dataS/scripts/gui/ShopController.lua (996) : switchToConfigurationCallback
  dataS/scripts/gui/ShopController.lua (972) : buyVehicle
  dataS/scripts/gui/ShopMenu.lua (947) : buy
  dataS/scripts/gui/ShopMenu.lua (1113) : buyItem
  dataS/scripts/gui/ShopItemsFrame.lua (435) : notifyActivatedDisplayItemCallback
  dataS/scripts/gui/elements/SmoothListElement.lua (1239) : raiseCallback
  dataS/scripts/gui/elements/SmoothListElement.lua (1218) : notifyDoubleClick
  dataS/scripts/gui/elements/SmoothListElement.lua (1299) : onMouseUp
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/base/Gui.lua (666) : mouseEvent
  dataS/scripts/events.lua (26) : mouseEvent
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (322) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (447) : getConfigKey
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (258) : initExtraOptions
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (667) : raiseEvent
  dataS/scripts/gui/ShopConfigScreen.lua (1077) : load
  dataS/scripts/gui/ShopConfigScreen.lua (882) : loadCurrentConfiguration
  dataS/scripts/gui/ShopConfigScreen.lua (1242) : updateData
  dataS/scripts/gui/ShopConfigScreen.lua (1397) : updateDisplay
  dataS/scripts/gui/ShopMenu.lua (545) : setStoreItem
  dataS/scripts/gui/ShopController.lua (263) : callback
  dataS/scripts/gui/ShopController.lua (996) : switchToConfigurationCallback
  dataS/scripts/gui/ShopController.lua (972) : buyVehicle
  dataS/scripts/gui/ShopMenu.lua (947) : buy
  dataS/scripts/gui/ShopMenu.lua (1113) : buyItem
  dataS/scripts/gui/ShopItemsFrame.lua (435) : notifyActivatedDisplayItemCallback
  dataS/scripts/gui/elements/SmoothListElement.lua (1239) : raiseCallback
  dataS/scripts/gui/elements/SmoothListElement.lua (1218) : notifyDoubleClick
  dataS/scripts/gui/elements/SmoothListElement.lua (1299) : onMouseUp
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/elements/GuiElement.lua (612) : mouseEvent
  dataS/scripts/gui/base/Gui.lua (666) : mouseEvent
  dataS/scripts/events.lua (26) : mouseEvent
2023-11-28 22:15 C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/cropduster.i3d (14.00 ms)
2023-11-28 22:15   Warning (C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/cropduster.xml): Missing collision mask bit '21'. Please add this bit to component node 'cropduster_main_component'
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (468) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (232) : setColor
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (993) : raiseEvent
  dataS/scripts/i3d/I3DManager.lua (134) : asyncCallbackFunction
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (509) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (232) : setColor
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (993) : raiseEvent
  dataS/scripts/i3d/I3DManager.lua (134) : asyncCallbackFunction
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (322) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (554) : getConfigKey
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (240) : changeObjects
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (993) : raiseEvent
  dataS/scripts/i3d/I3DManager.lua (134) : asyncCallbackFunction
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (322) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (554) : getConfigKey
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (240) : changeObjects
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (993) : raiseEvent
  dataS/scripts/i3d/I3DManager.lua (134) : asyncCallbackFunction
2023-11-28 22:15 Warning (script): 'hasXMLProperty': Argument 1 has wrong type. Expected: Int. Actual: Table 
2023-11-28 22:15   2023-11-28 22:15 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (838)2023-11-28 22:15 : 2023-11-28 22:15 expectedType == Value::VoidType || expectedType == Value::ObjectType || expectedType == Value::IntArrayType || expectedType == Value::FloatArrayType || expectedType == Value::ArrayType
2023-11-28 22:15 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (322) : hasXMLProperty
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (554) : getConfigKey
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/AddConfig.lua (240) : changeObjects
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (993) : raiseEvent
  dataS/scripts/i3d/I3DManager.lua (134) : asyncCallbackFunction
2023-11-28 22:15 Error: Running LUA method 'loadSharedI3DFileAsyncFinished'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua:69: attempt to call field 'callSpecializationsFunction' (a nil value)
XPModder
Posts: 76
Joined: Thu Oct 30, 2014 2:45 pm

Re: FS19 converted script error LUA call stack

Post by XPModder »

Hi!
From reading the bit of the log you posted, you are doing something wrong in your AddConfig.lua script.
Specifically you are passing the hasXMLProperty an invalid argument.
The hasXMLProperty function expects the id of an xml object as its first argument, but you are passing it something else.

Without seeing a) your script and b) your entire log, thats more or less everything I can say.
Check your script and try to fix it, otherwise post your entire script and ideally also your entire log here, so we can help you more.
Das Universum ist unvorstellbar groß und wir sind im Vergleich dazu winzig.

Daher kann mir jemand der unter uns Winzlingen Unterschiede in Hautfarbe oder Herkunft sucht, nur Leid tun, weil seine Sichtweise so begrenzt ist!

Fremdenfeindlichkeit ist Menschenfeindlichkeit!
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

XPModder wrote: Wed Nov 29, 2023 6:07 pm Hi!
From reading the bit of the log you posted, you are doing something wrong in your AddConfig.lua script.
Specifically you are passing the hasXMLProperty an invalid argument.
The hasXMLProperty function expects the id of an xml object as its first argument, but you are passing it something else.

Without seeing a) your script and b) your entire log, thats more or less everything I can say.
Check your script and try to fix it, otherwise post your entire script and ideally also your entire log here, so we can help you more.
So, the script is from another person called zippyo1, I even sent him a message and he posted several updates to the script for FS22, but his last video was 11 months ago and his account here on the forum is as last seen In August. Therefore, I would like to try to correct these errors, I will send here the scrip that is in the converted mod.I fixed all the mod's problems, but it presents several LUA errors, even though it works in local singleplayer/multiplayer, only on dedicated servers (I want to use them mainly to play with friends) it doesn't work and presents the error that I will attach the log to.

https://www.mediafire.com/file/4n9kj0x3 ... r.lua/file
https://www.mediafire.com/file/p9j54egx ... y.lua/file
https://www.mediafire.com/file/k53yxa4k ... 2.txt/file
https://www.mediafire.com/file/qq9nng1l ... R.zip/file

I added the mod download too if you want to test it. I would be very happy if I could get your help.
The log attached here shows errors when I try to use it on the dedicated server. That's where I want to use it, in singleplayer and multiplayer it works normally even with LUA's errors.
XPModder
Posts: 76
Joined: Thu Oct 30, 2014 2:45 pm

Re: FS19 converted script error LUA call stack

Post by XPModder »

I am having some trouble following you here...
Your original question was about some errors caused by a wrong paramter being passed to hasXMLProperty in a script file called AddConfig.lua for a mod called FS19_PM_Cropduster_converted.
Have you fixed that issue?
Because this latest post from you seems to be about completely different errors from a completely different mod.
Can you please clarify what exactly you are asking about.
Please mention it in your post when you are suddenly talking about a completely different issue...


Apart from that:
Looking at these files you have linked, you seem to be having multiple independent errors.
So lets first break them down and concentrate on one error at a time.

The most prominent error in the log is related to a call to renderText().
The error is caused by the variable that is supposed to contain text being nil (aka not containing anything). Looking at the definition of the variable, according to the comment in the script it should get the text from your moddesc. The thing thats confusing me here is that you are apperently getting attempting to get the same text twice and assigning it to two different variables. If its the same text, why dont you just use the same variable? Or are they supposed to be two different things and the comment is wrong? If the comment is incorrect, I assume that you are likely missing the l10n entry for the second text.

Second error is that you are trying to do a string format, but the second parameter, your LVy variable is (sometimes?) empty (nil). Maybe the getLinearVelocity() function you are calling returns nil if something is incorrect or if the velocity is 0. Im not super familiar with specilization scripts, but since that only occasionally seems to be nil, I would suggest simply checking if the variable is nil and if it is maybe simply setting it to 0 before the string format.

Then there is a third error, stemming from your calls to raiseDirtyFlags().
This error is simply caused by the fact that you are passing the raiseDirtyFlag() function a variable (self.levitatorSprayerFlag) that was never defined or initialized and therefore attempting to do so results in nil being passed. It appears that this is likely just a typo, as the variable self.LevitatorSprayer.levitatorSprayerFlag is defined in your onLoad() function.
Keep in mind that this same mistake exists in three different locations in your script and needs to be fixed in all three.

I think that covers all the errors in this log file (apart from some issue with your inputBinding xml file, but thats completely unrelated to any mods).
Das Universum ist unvorstellbar groß und wir sind im Vergleich dazu winzig.

Daher kann mir jemand der unter uns Winzlingen Unterschiede in Hautfarbe oder Herkunft sucht, nur Leid tun, weil seine Sichtweise so begrenzt ist!

Fremdenfeindlichkeit ist Menschenfeindlichkeit!
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

XPModder wrote: Wed Nov 29, 2023 11:17 pm I am having some trouble following you here...
Your original question was about some errors caused by a wrong paramter being passed to hasXMLProperty in a script file called AddConfig.lua for a mod called FS19_PM_Cropduster_converted.
Have you fixed that issue?
Because this latest post from you seems to be about completely different errors from a completely different mod.
Can you please clarify what exactly you are asking about.
Please mention it in your post when you are suddenly talking about a completely different issue...


Apart from that:
Looking at these files you have linked, you seem to be having multiple independent errors.
So lets first break them down and concentrate on one error at a time.

The most prominent error in the log is related to a call to renderText().
The error is caused by the variable that is supposed to contain text being nil (aka not containing anything). Looking at the definition of the variable, according to the comment in the script it should get the text from your moddesc. The thing thats confusing me here is that you are apperently getting attempting to get the same text twice and assigning it to two different variables. If its the same text, why dont you just use the same variable? Or are they supposed to be two different things and the comment is wrong? If the comment is incorrect, I assume that you are likely missing the l10n entry for the second text.

Second error is that you are trying to do a string format, but the second parameter, your LVy variable is (sometimes?) empty (nil). Maybe the getLinearVelocity() function you are calling returns nil if something is incorrect or if the velocity is 0. Im not super familiar with specilization scripts, but since that only occasionally seems to be nil, I would suggest simply checking if the variable is nil and if it is maybe simply setting it to 0 before the string format.

Then there is a third error, stemming from your calls to raiseDirtyFlags().
This error is simply caused by the fact that you are passing the raiseDirtyFlag() function a variable (self.levitatorSprayerFlag) that was never defined or initialized and therefore attempting to do so results in nil being passed. It appears that this is likely just a typo, as the variable self.LevitatorSprayer.levitatorSprayerFlag is defined in your onLoad() function.
Keep in mind that this same mistake exists in three different locations in your script and needs to be fixed in all three.

I think that covers all the errors in this log file (apart from some issue with your inputBinding xml file, but thats completely unrelated to any mods).
You're right, I talked about another situation in another post about the same problem, because the mod was different, the one I managed to fix the i3d errors was just this one (AT_602), the other one I gave up on because in addition to the textures being worse, I got discouraged and preferred to continue with this.

hasXMLProperty in a script file called AddConfig.lua for a mod called FS19_PM_Cropduster_converted. Have you fixed that issue?
I still haven't been able to solve it, I was waiting for some answer to try to solve it, the worst of all is that I don't understand almost anything about the LUA language, I'm an adventurer here and I literally know almost nothing. So I will try to be guided by what you told me.

you are apparently getting attempted to get the same text twice and assigning it to two different variables. If its the same text, why dont you just use the same variable? Or are they supposed to be two different things and the comment is wrong? If the comment is incorrect, I assume that you are likely missing the l10n entry for the second text.
About that, as I wasn't the one who wrote the script I was also confused, if you're talking about the "ridgeMarker" variable, ignore it, only 'LevitatorSprayer" is valid from what I understand from the mod's creator. About l10n, before converting it had a file called l10n_en, which contained some information (I'll leave it in the printout), I copied it and pasted it into the folder now to see if it resolves any errors (I should have done that or pasted it directly into the <l10n>...</l10n) part. > ?). I believe I had also forgotten to add the variable to the other script (<specialization name="addConfigCategory" className="addConfigCategory" filename="scripts/addConfigCategory.lua"/>)

So, to fix the raiseDirtyFlag variables I needed to have corrected the typo (self.levitatorSprayerFlag to self.LevitatorSprayer.levitatorSprayerFlag)? I made it

The second error is that you are trying to do a string format, but the second parameter, your LVy variable is (sometimes?) empty (null). Perhaps the getLinearVelocity() function you are calling will return null if something is incorrect or if the velocity is 0. I'm not very familiar with specialization scripts, but since this only occasionally appears to be null, I suggest simply checking to see if the variable is null and if simply set it to 0 before the string format. About this, I was lost how do I check this variable and if it is really null, where exactly do I define 0 before the format string? Because there are several in this part of getLinearVelocity, I put an image so you can see if I did it right.

https://prnt.sc/z2OQSi8qFElt
print showing what i changed, i will test right now

Sorry for my lack of knowledge on the subject, I'm really new to scripting and I'm venturing here with your help!

Code: Select all

2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 18:43 LUA call stack:
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS19_PM_Cropduster_converted/scripts/fs19LevitatorSprayer.lua (303) : renderText
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (2041) : raiseEvent
  dataS/scripts/gui/hud/HUD.lua (370) : draw
  dataS/scripts/BaseMission.lua (1315) : drawControlledEntityHUD
  dataS/scripts/FSBaseMission.lua (2482) : draw
  dataS/scripts/missions/mission00.lua (608) : draw
  dataS/scripts/main.lua (1358) : draw
2023-11-29 18:43 Warning (script): 'renderText': Argument 4 has wrong type. Expected: String. Actual: Nil 
2023-11-29 18:43   2023-11-29 18:43 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 18:43 : 2023-11-29 18:43 expectedType == Value::VoidType || expectedType == Value::ClassType
Apparently, now I'm just having the same problem with this Argument 4 - renderText, I couldn't quite understand what you told me and what I should do.
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

XPModder wrote: Wed Nov 29, 2023 11:17 pm I am having some trouble following you here...
Your original question was about some errors caused by a wrong paramter being passed to hasXMLProperty in a script file called AddConfig.lua for a mod called FS19_PM_Cropduster_converted.
Have you fixed that issue?
Because this latest post from you seems to be about completely different errors from a completely different mod.
Can you please clarify what exactly you are asking about.
Please mention it in your post when you are suddenly talking about a completely different issue...


Apart from that:
Looking at these files you have linked, you seem to be having multiple independent errors.
So lets first break them down and concentrate on one error at a time.

The most prominent error in the log is related to a call to renderText().
The error is caused by the variable that is supposed to contain text being nil (aka not containing anything). Looking at the definition of the variable, according to the comment in the script it should get the text from your moddesc. The thing thats confusing me here is that you are apperently getting attempting to get the same text twice and assigning it to two different variables. If its the same text, why dont you just use the same variable? Or are they supposed to be two different things and the comment is wrong? If the comment is incorrect, I assume that you are likely missing the l10n entry for the second text.

Second error is that you are trying to do a string format, but the second parameter, your LVy variable is (sometimes?) empty (nil). Maybe the getLinearVelocity() function you are calling returns nil if something is incorrect or if the velocity is 0. Im not super familiar with specilization scripts, but since that only occasionally seems to be nil, I would suggest simply checking if the variable is nil and if it is maybe simply setting it to 0 before the string format.

Then there is a third error, stemming from your calls to raiseDirtyFlags().
This error is simply caused by the fact that you are passing the raiseDirtyFlag() function a variable (self.levitatorSprayerFlag) that was never defined or initialized and therefore attempting to do so results in nil being passed. It appears that this is likely just a typo, as the variable self.LevitatorSprayer.levitatorSprayerFlag is defined in your onLoad() function.
Keep in mind that this same mistake exists in three different locations in your script and needs to be fixed in all three.

I think that covers all the errors in this log file (apart from some issue with your inputBinding xml file, but thats completely unrelated to any mods).
I found other script here in giants forum from author zip, he fixed this errors!

Code: Select all

--[[
/*******************************************************************************\
*                                                                               *
* LevitatorSprayer.lua                                                                 *
*                                                                               *
*********************************************************************************
* Licensed under the MIT or X11 License                                         *
*                                                                               *
* Copyright (c) 2016 Eisbearg                                                   *
*                                                                               *
* Permission is hereby granted, free of charge, to any person obtaining a copy  *
* of this software and associated documentation files (the "Software"), to deal *
* in the Software without restriction, including without limitation the rights  *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell     *
* copies of the Software, and to permit persons to whom the Software is         *
* furnished to do so, subject to the following conditions:                      *
*                                                                               *
* The above copyright notice and this permission notice shall be included in    *
* all copies or substantial portions of the Software.                           *
*                                                                               *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR    *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,      *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER        *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN     *
* THE SOFTWARE.                                                                 *
\*******************************************************************************/
--]]
-- Edit FS17: werik, Silak_68
--28.05.17 network edition by igor29381
--Edit port to FS19: Zippyo v0.99b


LevitatorSprayer = {};

LevitatorSprayer._NAME			= "LevitatorSprayer"
LevitatorSprayer.title = "FS19 LEV";
LevitatorSprayer.author = "zip";
LevitatorSprayer.modDirectory  = g_currentModDirectory;

function LevitatorSprayer.prerequisitesPresent(specializations)
	return true;
	end;

function LevitatorSprayer.registerFunctions(vehicleType)
    SpecializationUtil.registerFunction(vehicleType, "mouseEvent", LevitatorSprayer.mouseEvent)
    SpecializationUtil.registerFunction(vehicleType, "keyEvent", LevitatorSprayer.keyEvent)
    SpecializationUtil.registerFunction(vehicleType, "activateFlightMode", LevitatorSprayer.activateFlightMode)
    SpecializationUtil.registerFunction(vehicleType, "deactivateFlightMode", LevitatorSprayer.deactivateFlightMode)
    SpecializationUtil.registerFunction(vehicleType, "toggleLevitatorSprayer", LevitatorSprayer.toggleLevitatorSprayer)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree", LevitatorSprayer.getMorldDirectionDegree)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree2", LevitatorSprayer.getMorldDirectionDegree2)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree3", LevitatorSprayer.getMorldDirectionDegree3)
    SpecializationUtil.registerFunction(vehicleType, "getAltitude", LevitatorSprayer.getAltitude)
    SpecializationUtil.registerFunction(vehicleType, "getTailForce", LevitatorSprayer.getTailForce)
    SpecializationUtil.registerFunction(vehicleType, "updateMovement", LevitatorSprayer.updateMovement)
  --SpecializationUtil.registerFunction(vehicleType, "saveToXMLFile", LevitatorSprayer.saveToXMLFile)
end;

function LevitatorSprayer.registerEventListeners(vehicleType)
	for _, functionName in pairs( { "onLoad", "onPostLoad", "onUpdate", "onUpdateTick", "onDraw", "saveToXMLFile" } ) do
		SpecializationUtil.registerEventListener(vehicleType, functionName, LevitatorSprayer);
	end;
end;

function LevitatorSprayer:onLoad(savegame)
    self.isSelectable = true;
    self.toggleLevitatorSprayer = SpecializationUtil.callSpecializationsFunction("toggleLevitatorSprayer");
	self.LevitatorSprayer = {};

    local name = getXMLString(self.xmlFile, "vehicle.storeData.name");
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.en"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.de"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.es"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.fr"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.pt"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.ru"); end;
    if name == nil then name = "UnknownVehicle"; end;

    self.LevitatorSprayer.id = LevitatorSprayer._NAME;
    self.LevitatorSprayer.name = name;
    self.LevitatorSprayer.move = false;
    self.LevitatorSprayer.active = false;
    self.LevitatorSprayer.downForce = 0;
    self.LevitatorSprayer.yForce = 0;
    self.LevitatorSprayer.pitch = 0;
    self.LevitatorSprayer.sendPitch = 0;
    self.LevitatorSprayer.startTimer = 0;
    self.LevitatorSprayer.levitatorSprayerFlag = self:getNextDirtyFlag();
    self.LevitatorSprayer.lastDigitalSide = 0;
	self.workAreaPositions = {};
	local lworkAreas = self.spec_workArea.workAreas[1]
	for k,c in pairs (self.spec_workArea) do
       local xs,ys,zs = getWorldTranslation(lworkAreas.start);
       local xw,yw,zw = getWorldTranslation(lworkAreas.width);
       local xh,yh,zh = getWorldTranslation(lworkAreas.height);
       local cap = {};
       cap.start = {xs,ys,zs};
       cap.width = {xw,yw,zw};
       cap.height = {xh,yh,zh};
       table.insert(self.workAreaPositions, cap);
   end;

      self.pipeGrainParticleSystem = {};
--    self.pipeGrainParticleSystemindex = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem#index"));
--    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem, "vehicle.pipeGrainParticleSystem", self.pipeGrainParticleSystemindex, false, nil, self.baseDirectory);
--    self.pipeGrainParticleSystem2 = {};
--    self.pipeGrainParticleSystem2index = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem2#index"));
--    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem2, "vehicle.pipeGrainParticleSystem2", self.pipeGrainParticleSystem2index, false, nil, self.baseDirectory);
	print("Load mod: '"..LevitatorSprayer.title.."' by: '"..LevitatorSprayer.author.."' loaded sucessfully.");
end;

function LevitatorSprayer:onDelete()
--    Utils.deleteParticleSystem(self.pipeGrainParticleSystem);
--    Utils.deleteParticleSystem(self.pipeGrainParticleSystem2);
end;

function LevitatorSprayer:mouseEvent(posX, posY, isDown, isUp, button)
end;

function LevitatorSprayer:keyEvent(unicode, sym, modifier, isDown)
end;

function LevitatorSprayer:activateFlightMode()
	local component = self.components[1]
    local massresult = self:getTotalMass(true)
		setLinearDamping(component.node, 0.15);
		setAngularDamping(component.node, 0.01);
		self.LevitatorSprayer.downForce = massresult * -9.81; 
        self.massresult = massresult *1000;
		self.yForce = self.LevitatorSprayer.downForce * -5;
--    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
--    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
end;

function LevitatorSprayer:deactivateFlightMode()
	local component = self.components[1]
		setLinearDamping(component.node, 0.0); 
		setAngularDamping(component.node, 0.01);
		self.LevitatorSprayer.downForce = self:getTotalMass(true) * -9.81;
		self.yForce = 0;
--    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
--    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
end;

function LevitatorSprayer:onPostLoad(savegame)
--[[
]]
end;

function LevitatorSprayer:onUpdate(dt, isActiveForInput, isActiveForInputIgnoreSelection, isSelected)
    local massresult = (self:getTotalMass(false)) * 1000
        self.massresult = massresult

    local component = self.components[1]
    local altAboveGround, altAboveNN = self.getAltitude(component.node); 
	
    if self.getIsMotorStarted and altAboveGround < 4 then
--        Utils.setEmittingState(self.pipeGrainParticleSystem, true);
    else
--        Utils.setEmittingState(self.pipeGrainParticleSystem, false);
    end;
    if self.getIsMotorStarted and altAboveGround < 9 then
--        Utils.setEmittingState(self.pipeGrainParticleSystem2, true);
    else
--        Utils.setEmittingState(self.pipeGrainParticleSystem2, false);
    end;

    if self.spec_motorized.isMotorStarted and self.spec_enterable.isEntered then
        if not self.LevitatorSprayer.active then
            self.LevitatorSprayer.startTimer = self.LevitatorSprayer.startTimer + dt;
            if self.LevitatorSprayer.startTimer > 18000 then
                LevitatorSprayer.activateFlightMode(self);
                self.LevitatorSprayer.active = true;
                self.wiper = true;
                self.LevitatorSprayer.startTimer = 0;
            end;
        end;
    elseif self.LevitatorSprayer.active then
        LevitatorSprayer.deactivateFlightMode(self);
        self.LevitatorSprayer.active = false;
        self.wiper = false;
    end;
    if not self.LevitatorSprayer.active then return end; 
local collectiveup = getInputAxis(10, 0);
local collectivedown = getInputAxis(11, 0);
local gamepads = getNumOfGamepads();
self.normalizedCollectiveUp = (collectiveup - (-1)) / (1 - (-1));
self.normalizedCollectiveDown = (collectivedown - (-1)) / (1 - (-1));
LevitatorSprayer.updateMovement(self, dt);
    if self.isActive and isActiveForInput and gamepads>0 then
if collectiveup <= 1 or collectivedown <= 1 then
            if collectiveup < 1 then
                self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 1/self.normalizedCollectiveUp/4, self.LevitatorSprayer.downForce * -0.85);
            end;
            if collectivedown < 1 then
                self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 1/self.normalizedCollectiveDown/4, -25.02);
            end;
        end;
if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT) or Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
            if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT)then
                self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 2, self.LevitatorSprayer.downForce * -0.85);
            end;
            if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
                self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 2, -25.02); 
            end;
       elseif self.LevitatorSprayer.pitch ~= 0 then
if collectiveup == 1 and collectivedown == 1 then 
              self.LevitatorSprayer.pitch = 0;
           end; 
        end;
	end;
        if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
            if not g_server then
                self:raiseDirtyFlags(self.levitatorSprayerFlag);
            end;
            self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
        end;
        if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
            if not g_server then
                self:raiseDirtyFlags(self.levitatorSprayerFlag);
            end;
            self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
        end;
    if self.isServer then
        local dX,dY,dZ = localDirectionToWorld(component.node, 1, 0, 0);
        local sinDir = dX / 15;
        local cosDir = dZ / -15;
        self.sd = 307;
        if self.spec_motorized.getIsMotorStarted then
            self.sd = 250;
        end;
        local zSteer = self.sd * self.spec_drivable.axisForward;
        local xForce = zSteer * cosDir;
        local zForce = zSteer * sinDir;
        if self.spec_drivable.axisForward == 1 or self.spec_drivable.axisForward == -1 or self.spec_drivable.lastDigitalForward == 1 or self.spec_drivable.lastDigitalForward == -1  then
            dg = 0.01;
        else
            dg = 3; 
        end;
        local component = self.components[1]
                self.LevitatorSprayer.yForce = (self.LevitatorSprayer.pitch + self.LevitatorSprayer.downForce * -0.8422);
                addForce(component.node, xForce, self.LevitatorSprayer.yForce,  zForce, 0, dg, 0, true); 
        local yTurnSpeed = 0;
        if self.spec_drivable.axisSide > 0.1 or self.spec_drivable.axisSide < -0.1 or self.spec_drivable.lastDigitalSide > 0.1 or self.spec_drivable.lastDigitalSide < -0.1  then
            if InputBinding.getIsAnalogInput then
                yTurnSpeed = self.spec_drivable.axisSide * -0.95;
            else
                yTurnSpeed = self.spec_drivable.lastDigitalSide * -0.95;
            end;
        end;

        local AVx, AVy, AVz = getAngularVelocity(component.node);
        if yTurnSpeed == 0 then
           yTurnSpeed = AVy * 0.85;
        end;
        setAngularVelocity(component.node, AVx * 0.75, yTurnSpeed, AVz * 0.75);
        self.yLV = getLinearVelocity(component.node);
        if self.getIsActive and self.getIsTurnedOn then
            local altAboveGround = self.getAltitude(component.node);
            local addw = altAboveGround*6.5;
            local addh = altAboveGround/5;
            local addz = (altAboveGround/2) + (self.lastSpeed * 3850/50);
local lworkAreas = self.spec_workArea.workAreas[1]
            for c=1, table.getn(lworkAreas) do
                local cp = self.workAreaPositions[c];
                local ca = lworkAreas[c];
                setTranslation(ca.start ,  cp.start[1]+ (cp.start[1] *addw/100) , cp.start[2]  , cp.start[3]- addz);
                setTranslation(ca.width ,  cp.width[1]+ (cp.width[1] *addw/100) , cp.width[2]  , cp.width[3]- addz);
                if altAboveGround > 50 then
                    setTranslation(ca.height , cp.start[1]+(cp.start[1]*addw/100) , cp.start[2] , cp.start[3] - addz);
                else
                    setTranslation(ca.height , cp.height[1]+(cp.height[1]*addw/100) , cp.height[2] , cp.height[3]-addz-addh);
                end;
            end;
        end;
    end;
end;

function LevitatorSprayer:onUpdateTick(dt)
end;

function LevitatorSprayer:saveToXMLFile(xmlFile, key)
--[[ key includes the name of the script
]]
end;

function LevitatorSprayer:onDraw()
    local component = self.components[1]
    local text = g_i18n.modEnvironments.Ka26.texts.move --just digging...should b fetched from XML as :getText("move")
    local LVx, LVy, LVz = getLinearVelocity(component.node);
    if self.spec_enterable.getIsEntered then

        setTextAlignment(RenderText.ALIGN_CENTER);
        setTextColor(1,1,1,1);
        if self.LevitatorSprayer.active then
            renderText(0.17, 0.29, 0.016, text);
            renderText(0.17, 0.36, 0.025, string.format("V S I=" .. " %4.2f m/s", LVy));
            local altAboveGround, altAboveNN = self.getAltitude(component.node);
          --renderText(0.17, 0.33, 0.025, string.format(g_i18n.modEnvironments.Ka26.texts.ground .. " %4.2f m", altAboveGround));
            renderText(0.17, 0.33, 0.025, string.format("A G L=" .. " %4.2f m", altAboveGround));
            renderText(0.17, 0.26, 0.016, string.format("BLADE PITCH" .. " %3.4f ", self.LevitatorSprayer.pitch));
            renderText(0.17, 0.24, 0.016, string.format("pretend G Downforce" .. " %4.2f m/s", self.LevitatorSprayer.downForce));
            renderText(0.17, 0.22, 0.016, string.format("LevitatorFORCE" .. " %4.2f m/s", self.LevitatorSprayer.yForce));
            renderText(0.17, 0.20, 0.016, string.format("MASS" .. " %4.2f kg", self.massresult));
            setTextBold(false);
        end;

        setTextAlignment(RenderText.ALIGN_LEFT);
        setTextColor(1,1,1,1);
    end;
--            local altAboveGround = self.getAltitude(component.node);
--        if self.isActive and altAboveGround > 50 then
--        g_currentMission:showBlinkingWarning(g_i18n.modEnvironments.Ka26.texts.helpGrid, 600);
--    end;
end;
function LevitatorSprayer:toggleLevitatorSprayer(state, nes)
end;

function LevitatorSprayer:readStream(streamId, connection)
end;

function LevitatorSprayer:writeStream(streamId, connection)
end;

function LevitatorSprayer:getMorldDirectionDegree(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(sinus, cosinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getMorldDirectionDegree2(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(cosinus, sinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getMorldDirectionDegree3(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, -1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(cosinus, sinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getAltitude(rootNode)
    local terrainHeight = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, getWorldTranslation(self));
    local x, altAboveNN = getWorldTranslation(self);
    local altAboveGround = altAboveNN - terrainHeight;
    if altAboveGround < 0 then altAboveGround = 0.0 end; 
    return altAboveGround, altAboveNN, terrainHeight;
end;

function LevitatorSprayer:getTailForce(rootNode, xSteer)
        local dX,dY,dZ = localDirectionToWorld(self, 0, 0, -1);
        local sinDir = dX / 1;
        local cosDir = dZ / 1;
        local xBackward = 10 * sinDir;
        local zBackward = 10 * cosDir;

        dX,dY,dZ = localDirectionToWorld(rootNode, 1, 0, 0);
        sinDir = dX / 1;
        cosDir = dZ / 1;
        local xTurnForce = xSteer * sinDir;
        local zTurnForce = xSteer * cosDir;

    return xTurnForce, 0, zTurnForce, xBackward, 0.6, zBackward
end;

function LevitatorSprayer:updateMovement(dt)
self.axisSideIsAnalog = InputBinding.getIsAnalogInput
self.axisForwardIsAnalog = InputBinding.getIsAnalogInput
		if not self.getIsEntered then return; end
		local axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate                 
		local axisBrake = self.spec_drivable.lastInputValues.axisBrake
		local axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
		
		if InputBinding.isAxisZero(axisForward) then
			axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate
			axisBrake = self.spec_drivable.lastInputValues.axisBrake
			self.axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
fetch = self.axisForward
        if not InputBinding.isAxisZero(self.axisForward) then
            self.axisForwardIsAnalog = true;
        end
        self.lastDigitalForward = 0;
    end
    self.axisSide = self.spec_drivable.lastInputValues.axisSide
    if InputBinding.isAxisZero(self.axisSide) then
        self.axisSide = self.spec_drivable.lastInputValues.axisSide
        if not InputBinding.isAxisZero(self.axisSide) then
            self.axisSideIsAnalog = true;
        end
        self.lastDigitalSide = 0;
    else
        self.axisSide = MathUtil.clamp(self.lastDigitalSide + dt/self.axisSmoothTime*self.axisSide, -1, 1);
        self.axisSideIsAnalog = false;
        self.lastDigitalSide = self.axisSide;
    end;

     if not self.getIsActiveForInput then
        if not self.axisSideIsAnalog then
            self.axisSide = 0;
        end
        if not self.axisForwardIsAnalog then
            self.axisForward = 0;
        end
    end;
    if not g_server then
        self:raiseDirtyFlags(self.levitatorSprayerFlag);
    end;
end;
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

onlybr wrote: Thu Nov 30, 2023 1:01 am
XPModder wrote: Wed Nov 29, 2023 11:17 pm I am having some trouble following you here...
Your original question was about some errors caused by a wrong paramter being passed to hasXMLProperty in a script file called AddConfig.lua for a mod called FS19_PM_Cropduster_converted.
Have you fixed that issue?
Because this latest post from you seems to be about completely different errors from a completely different mod.
Can you please clarify what exactly you are asking about.
Please mention it in your post when you are suddenly talking about a completely different issue...


Apart from that:
Looking at these files you have linked, you seem to be having multiple independent errors.
So lets first break them down and concentrate on one error at a time.

The most prominent error in the log is related to a call to renderText().
The error is caused by the variable that is supposed to contain text being nil (aka not containing anything). Looking at the definition of the variable, according to the comment in the script it should get the text from your moddesc. The thing thats confusing me here is that you are apperently getting attempting to get the same text twice and assigning it to two different variables. If its the same text, why dont you just use the same variable? Or are they supposed to be two different things and the comment is wrong? If the comment is incorrect, I assume that you are likely missing the l10n entry for the second text.

Second error is that you are trying to do a string format, but the second parameter, your LVy variable is (sometimes?) empty (nil). Maybe the getLinearVelocity() function you are calling returns nil if something is incorrect or if the velocity is 0. Im not super familiar with specilization scripts, but since that only occasionally seems to be nil, I would suggest simply checking if the variable is nil and if it is maybe simply setting it to 0 before the string format.

Then there is a third error, stemming from your calls to raiseDirtyFlags().
This error is simply caused by the fact that you are passing the raiseDirtyFlag() function a variable (self.levitatorSprayerFlag) that was never defined or initialized and therefore attempting to do so results in nil being passed. It appears that this is likely just a typo, as the variable self.LevitatorSprayer.levitatorSprayerFlag is defined in your onLoad() function.
Keep in mind that this same mistake exists in three different locations in your script and needs to be fixed in all three.

I think that covers all the errors in this log file (apart from some issue with your inputBinding xml file, but thats completely unrelated to any mods).
I found other script here in giants forum from author zip, he fixed this errors!

Code: Select all

--[[
/*******************************************************************************\
*                                                                               *
* LevitatorSprayer.lua                                                                 *
*                                                                               *
*********************************************************************************
* Licensed under the MIT or X11 License                                         *
*                                                                               *
* Copyright (c) 2016 Eisbearg                                                   *
*                                                                               *
* Permission is hereby granted, free of charge, to any person obtaining a copy  *
* of this software and associated documentation files (the "Software"), to deal *
* in the Software without restriction, including without limitation the rights  *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell     *
* copies of the Software, and to permit persons to whom the Software is         *
* furnished to do so, subject to the following conditions:                      *
*                                                                               *
* The above copyright notice and this permission notice shall be included in    *
* all copies or substantial portions of the Software.                           *
*                                                                               *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR    *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,      *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER        *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN     *
* THE SOFTWARE.                                                                 *
\*******************************************************************************/
--]]
-- Edit FS17: werik, Silak_68
--28.05.17 network edition by igor29381
--Edit port to FS19: Zippyo v0.99b


LevitatorSprayer = {};

LevitatorSprayer._NAME			= "LevitatorSprayer"
LevitatorSprayer.title = "FS19 LEV";
LevitatorSprayer.author = "zip";
LevitatorSprayer.modDirectory  = g_currentModDirectory;

function LevitatorSprayer.prerequisitesPresent(specializations)
	return true;
	end;

function LevitatorSprayer.registerFunctions(vehicleType)
    SpecializationUtil.registerFunction(vehicleType, "mouseEvent", LevitatorSprayer.mouseEvent)
    SpecializationUtil.registerFunction(vehicleType, "keyEvent", LevitatorSprayer.keyEvent)
    SpecializationUtil.registerFunction(vehicleType, "activateFlightMode", LevitatorSprayer.activateFlightMode)
    SpecializationUtil.registerFunction(vehicleType, "deactivateFlightMode", LevitatorSprayer.deactivateFlightMode)
    SpecializationUtil.registerFunction(vehicleType, "toggleLevitatorSprayer", LevitatorSprayer.toggleLevitatorSprayer)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree", LevitatorSprayer.getMorldDirectionDegree)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree2", LevitatorSprayer.getMorldDirectionDegree2)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree3", LevitatorSprayer.getMorldDirectionDegree3)
    SpecializationUtil.registerFunction(vehicleType, "getAltitude", LevitatorSprayer.getAltitude)
    SpecializationUtil.registerFunction(vehicleType, "getTailForce", LevitatorSprayer.getTailForce)
    SpecializationUtil.registerFunction(vehicleType, "updateMovement", LevitatorSprayer.updateMovement)
  --SpecializationUtil.registerFunction(vehicleType, "saveToXMLFile", LevitatorSprayer.saveToXMLFile)
end;

function LevitatorSprayer.registerEventListeners(vehicleType)
	for _, functionName in pairs( { "onLoad", "onPostLoad", "onUpdate", "onUpdateTick", "onDraw", "saveToXMLFile" } ) do
		SpecializationUtil.registerEventListener(vehicleType, functionName, LevitatorSprayer);
	end;
end;

function LevitatorSprayer:onLoad(savegame)
    self.isSelectable = true;
    self.toggleLevitatorSprayer = SpecializationUtil.callSpecializationsFunction("toggleLevitatorSprayer");
	self.LevitatorSprayer = {};

    local name = getXMLString(self.xmlFile, "vehicle.storeData.name");
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.en"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.de"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.es"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.fr"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.pt"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.ru"); end;
    if name == nil then name = "UnknownVehicle"; end;

    self.LevitatorSprayer.id = LevitatorSprayer._NAME;
    self.LevitatorSprayer.name = name;
    self.LevitatorSprayer.move = false;
    self.LevitatorSprayer.active = false;
    self.LevitatorSprayer.downForce = 0;
    self.LevitatorSprayer.yForce = 0;
    self.LevitatorSprayer.pitch = 0;
    self.LevitatorSprayer.sendPitch = 0;
    self.LevitatorSprayer.startTimer = 0;
    self.LevitatorSprayer.levitatorSprayerFlag = self:getNextDirtyFlag();
    self.LevitatorSprayer.lastDigitalSide = 0;
	self.workAreaPositions = {};
	local lworkAreas = self.spec_workArea.workAreas[1]
	for k,c in pairs (self.spec_workArea) do
       local xs,ys,zs = getWorldTranslation(lworkAreas.start);
       local xw,yw,zw = getWorldTranslation(lworkAreas.width);
       local xh,yh,zh = getWorldTranslation(lworkAreas.height);
       local cap = {};
       cap.start = {xs,ys,zs};
       cap.width = {xw,yw,zw};
       cap.height = {xh,yh,zh};
       table.insert(self.workAreaPositions, cap);
   end;

      self.pipeGrainParticleSystem = {};
--    self.pipeGrainParticleSystemindex = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem#index"));
--    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem, "vehicle.pipeGrainParticleSystem", self.pipeGrainParticleSystemindex, false, nil, self.baseDirectory);
--    self.pipeGrainParticleSystem2 = {};
--    self.pipeGrainParticleSystem2index = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem2#index"));
--    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem2, "vehicle.pipeGrainParticleSystem2", self.pipeGrainParticleSystem2index, false, nil, self.baseDirectory);
	print("Load mod: '"..LevitatorSprayer.title.."' by: '"..LevitatorSprayer.author.."' loaded sucessfully.");
end;

function LevitatorSprayer:onDelete()
--    Utils.deleteParticleSystem(self.pipeGrainParticleSystem);
--    Utils.deleteParticleSystem(self.pipeGrainParticleSystem2);
end;

function LevitatorSprayer:mouseEvent(posX, posY, isDown, isUp, button)
end;

function LevitatorSprayer:keyEvent(unicode, sym, modifier, isDown)
end;

function LevitatorSprayer:activateFlightMode()
	local component = self.components[1]
    local massresult = self:getTotalMass(true)
		setLinearDamping(component.node, 0.15);
		setAngularDamping(component.node, 0.01);
		self.LevitatorSprayer.downForce = massresult * -9.81; 
        self.massresult = massresult *1000;
		self.yForce = self.LevitatorSprayer.downForce * -5;
--    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
--    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
end;

function LevitatorSprayer:deactivateFlightMode()
	local component = self.components[1]
		setLinearDamping(component.node, 0.0); 
		setAngularDamping(component.node, 0.01);
		self.LevitatorSprayer.downForce = self:getTotalMass(true) * -9.81;
		self.yForce = 0;
--    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
--    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
end;

function LevitatorSprayer:onPostLoad(savegame)
--[[
]]
end;

function LevitatorSprayer:onUpdate(dt, isActiveForInput, isActiveForInputIgnoreSelection, isSelected)
    local massresult = (self:getTotalMass(false)) * 1000
        self.massresult = massresult

    local component = self.components[1]
    local altAboveGround, altAboveNN = self.getAltitude(component.node); 
	
    if self.getIsMotorStarted and altAboveGround < 4 then
--        Utils.setEmittingState(self.pipeGrainParticleSystem, true);
    else
--        Utils.setEmittingState(self.pipeGrainParticleSystem, false);
    end;
    if self.getIsMotorStarted and altAboveGround < 9 then
--        Utils.setEmittingState(self.pipeGrainParticleSystem2, true);
    else
--        Utils.setEmittingState(self.pipeGrainParticleSystem2, false);
    end;

    if self.spec_motorized.isMotorStarted and self.spec_enterable.isEntered then
        if not self.LevitatorSprayer.active then
            self.LevitatorSprayer.startTimer = self.LevitatorSprayer.startTimer + dt;
            if self.LevitatorSprayer.startTimer > 18000 then
                LevitatorSprayer.activateFlightMode(self);
                self.LevitatorSprayer.active = true;
                self.wiper = true;
                self.LevitatorSprayer.startTimer = 0;
            end;
        end;
    elseif self.LevitatorSprayer.active then
        LevitatorSprayer.deactivateFlightMode(self);
        self.LevitatorSprayer.active = false;
        self.wiper = false;
    end;
    if not self.LevitatorSprayer.active then return end; 
local collectiveup = getInputAxis(10, 0);
local collectivedown = getInputAxis(11, 0);
local gamepads = getNumOfGamepads();
self.normalizedCollectiveUp = (collectiveup - (-1)) / (1 - (-1));
self.normalizedCollectiveDown = (collectivedown - (-1)) / (1 - (-1));
LevitatorSprayer.updateMovement(self, dt);
    if self.isActive and isActiveForInput and gamepads>0 then
if collectiveup <= 1 or collectivedown <= 1 then
            if collectiveup < 1 then
                self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 1/self.normalizedCollectiveUp/4, self.LevitatorSprayer.downForce * -0.85);
            end;
            if collectivedown < 1 then
                self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 1/self.normalizedCollectiveDown/4, -25.02);
            end;
        end;
if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT) or Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
            if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT)then
                self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 2, self.LevitatorSprayer.downForce * -0.85);
            end;
            if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
                self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 2, -25.02); 
            end;
       elseif self.LevitatorSprayer.pitch ~= 0 then
if collectiveup == 1 and collectivedown == 1 then 
              self.LevitatorSprayer.pitch = 0;
           end; 
        end;
	end;
        if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
            if not g_server then
                self:raiseDirtyFlags(self.levitatorSprayerFlag);
            end;
            self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
        end;
        if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
            if not g_server then
                self:raiseDirtyFlags(self.levitatorSprayerFlag);
            end;
            self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
        end;
    if self.isServer then
        local dX,dY,dZ = localDirectionToWorld(component.node, 1, 0, 0);
        local sinDir = dX / 15;
        local cosDir = dZ / -15;
        self.sd = 307;
        if self.spec_motorized.getIsMotorStarted then
            self.sd = 250;
        end;
        local zSteer = self.sd * self.spec_drivable.axisForward;
        local xForce = zSteer * cosDir;
        local zForce = zSteer * sinDir;
        if self.spec_drivable.axisForward == 1 or self.spec_drivable.axisForward == -1 or self.spec_drivable.lastDigitalForward == 1 or self.spec_drivable.lastDigitalForward == -1  then
            dg = 0.01;
        else
            dg = 3; 
        end;
        local component = self.components[1]
                self.LevitatorSprayer.yForce = (self.LevitatorSprayer.pitch + self.LevitatorSprayer.downForce * -0.8422);
                addForce(component.node, xForce, self.LevitatorSprayer.yForce,  zForce, 0, dg, 0, true); 
        local yTurnSpeed = 0;
        if self.spec_drivable.axisSide > 0.1 or self.spec_drivable.axisSide < -0.1 or self.spec_drivable.lastDigitalSide > 0.1 or self.spec_drivable.lastDigitalSide < -0.1  then
            if InputBinding.getIsAnalogInput then
                yTurnSpeed = self.spec_drivable.axisSide * -0.95;
            else
                yTurnSpeed = self.spec_drivable.lastDigitalSide * -0.95;
            end;
        end;

        local AVx, AVy, AVz = getAngularVelocity(component.node);
        if yTurnSpeed == 0 then
           yTurnSpeed = AVy * 0.85;
        end;
        setAngularVelocity(component.node, AVx * 0.75, yTurnSpeed, AVz * 0.75);
        self.yLV = getLinearVelocity(component.node);
        if self.getIsActive and self.getIsTurnedOn then
            local altAboveGround = self.getAltitude(component.node);
            local addw = altAboveGround*6.5;
            local addh = altAboveGround/5;
            local addz = (altAboveGround/2) + (self.lastSpeed * 3850/50);
local lworkAreas = self.spec_workArea.workAreas[1]
            for c=1, table.getn(lworkAreas) do
                local cp = self.workAreaPositions[c];
                local ca = lworkAreas[c];
                setTranslation(ca.start ,  cp.start[1]+ (cp.start[1] *addw/100) , cp.start[2]  , cp.start[3]- addz);
                setTranslation(ca.width ,  cp.width[1]+ (cp.width[1] *addw/100) , cp.width[2]  , cp.width[3]- addz);
                if altAboveGround > 50 then
                    setTranslation(ca.height , cp.start[1]+(cp.start[1]*addw/100) , cp.start[2] , cp.start[3] - addz);
                else
                    setTranslation(ca.height , cp.height[1]+(cp.height[1]*addw/100) , cp.height[2] , cp.height[3]-addz-addh);
                end;
            end;
        end;
    end;
end;

function LevitatorSprayer:onUpdateTick(dt)
end;

function LevitatorSprayer:saveToXMLFile(xmlFile, key)
--[[ key includes the name of the script
]]
end;

function LevitatorSprayer:onDraw()
    local component = self.components[1]
    local text = g_i18n.modEnvironments.Ka26.texts.move --just digging...should b fetched from XML as :getText("move")
    local LVx, LVy, LVz = getLinearVelocity(component.node);
    if self.spec_enterable.getIsEntered then

        setTextAlignment(RenderText.ALIGN_CENTER);
        setTextColor(1,1,1,1);
        if self.LevitatorSprayer.active then
            renderText(0.17, 0.29, 0.016, text);
            renderText(0.17, 0.36, 0.025, string.format("V S I=" .. " %4.2f m/s", LVy));
            local altAboveGround, altAboveNN = self.getAltitude(component.node);
          --renderText(0.17, 0.33, 0.025, string.format(g_i18n.modEnvironments.Ka26.texts.ground .. " %4.2f m", altAboveGround));
            renderText(0.17, 0.33, 0.025, string.format("A G L=" .. " %4.2f m", altAboveGround));
            renderText(0.17, 0.26, 0.016, string.format("BLADE PITCH" .. " %3.4f ", self.LevitatorSprayer.pitch));
            renderText(0.17, 0.24, 0.016, string.format("pretend G Downforce" .. " %4.2f m/s", self.LevitatorSprayer.downForce));
            renderText(0.17, 0.22, 0.016, string.format("LevitatorFORCE" .. " %4.2f m/s", self.LevitatorSprayer.yForce));
            renderText(0.17, 0.20, 0.016, string.format("MASS" .. " %4.2f kg", self.massresult));
            setTextBold(false);
        end;

        setTextAlignment(RenderText.ALIGN_LEFT);
        setTextColor(1,1,1,1);
    end;
--            local altAboveGround = self.getAltitude(component.node);
--        if self.isActive and altAboveGround > 50 then
--        g_currentMission:showBlinkingWarning(g_i18n.modEnvironments.Ka26.texts.helpGrid, 600);
--    end;
end;
function LevitatorSprayer:toggleLevitatorSprayer(state, nes)
end;

function LevitatorSprayer:readStream(streamId, connection)
end;

function LevitatorSprayer:writeStream(streamId, connection)
end;

function LevitatorSprayer:getMorldDirectionDegree(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(sinus, cosinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getMorldDirectionDegree2(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(cosinus, sinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getMorldDirectionDegree3(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, -1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(cosinus, sinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getAltitude(rootNode)
    local terrainHeight = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, getWorldTranslation(self));
    local x, altAboveNN = getWorldTranslation(self);
    local altAboveGround = altAboveNN - terrainHeight;
    if altAboveGround < 0 then altAboveGround = 0.0 end; 
    return altAboveGround, altAboveNN, terrainHeight;
end;

function LevitatorSprayer:getTailForce(rootNode, xSteer)
        local dX,dY,dZ = localDirectionToWorld(self, 0, 0, -1);
        local sinDir = dX / 1;
        local cosDir = dZ / 1;
        local xBackward = 10 * sinDir;
        local zBackward = 10 * cosDir;

        dX,dY,dZ = localDirectionToWorld(rootNode, 1, 0, 0);
        sinDir = dX / 1;
        cosDir = dZ / 1;
        local xTurnForce = xSteer * sinDir;
        local zTurnForce = xSteer * cosDir;

    return xTurnForce, 0, zTurnForce, xBackward, 0.6, zBackward
end;

function LevitatorSprayer:updateMovement(dt)
self.axisSideIsAnalog = InputBinding.getIsAnalogInput
self.axisForwardIsAnalog = InputBinding.getIsAnalogInput
		if not self.getIsEntered then return; end
		local axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate                 
		local axisBrake = self.spec_drivable.lastInputValues.axisBrake
		local axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
		
		if InputBinding.isAxisZero(axisForward) then
			axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate
			axisBrake = self.spec_drivable.lastInputValues.axisBrake
			self.axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
fetch = self.axisForward
        if not InputBinding.isAxisZero(self.axisForward) then
            self.axisForwardIsAnalog = true;
        end
        self.lastDigitalForward = 0;
    end
    self.axisSide = self.spec_drivable.lastInputValues.axisSide
    if InputBinding.isAxisZero(self.axisSide) then
        self.axisSide = self.spec_drivable.lastInputValues.axisSide
        if not InputBinding.isAxisZero(self.axisSide) then
            self.axisSideIsAnalog = true;
        end
        self.lastDigitalSide = 0;
    else
        self.axisSide = MathUtil.clamp(self.lastDigitalSide + dt/self.axisSmoothTime*self.axisSide, -1, 1);
        self.axisSideIsAnalog = false;
        self.lastDigitalSide = self.axisSide;
    end;

     if not self.getIsActiveForInput then
        if not self.axisSideIsAnalog then
            self.axisSide = 0;
        end
        if not self.axisForwardIsAnalog then
            self.axisForward = 0;
        end
    end;
    if not g_server then
        self:raiseDirtyFlags(self.levitatorSprayerFlag);
    end;
end;
After changing the script and resolving all the errors in singleplayer/local multiplayer, when I put it on a dedicated server it presents the following errors in the script, could you help me again XP?

Code: Select all

2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

onlybr wrote: Thu Nov 30, 2023 1:01 am
XPModder wrote: Wed Nov 29, 2023 11:17 pm I am having some trouble following you here...
Your original question was about some errors caused by a wrong paramter being passed to hasXMLProperty in a script file called AddConfig.lua for a mod called FS19_PM_Cropduster_converted.
Have you fixed that issue?
Because this latest post from you seems to be about completely different errors from a completely different mod.
Can you please clarify what exactly you are asking about.
Please mention it in your post when you are suddenly talking about a completely different issue...


Apart from that:
Looking at these files you have linked, you seem to be having multiple independent errors.
So lets first break them down and concentrate on one error at a time.

The most prominent error in the log is related to a call to renderText().
The error is caused by the variable that is supposed to contain text being nil (aka not containing anything). Looking at the definition of the variable, according to the comment in the script it should get the text from your moddesc. The thing thats confusing me here is that you are apperently getting attempting to get the same text twice and assigning it to two different variables. If its the same text, why dont you just use the same variable? Or are they supposed to be two different things and the comment is wrong? If the comment is incorrect, I assume that you are likely missing the l10n entry for the second text.

Second error is that you are trying to do a string format, but the second parameter, your LVy variable is (sometimes?) empty (nil). Maybe the getLinearVelocity() function you are calling returns nil if something is incorrect or if the velocity is 0. Im not super familiar with specilization scripts, but since that only occasionally seems to be nil, I would suggest simply checking if the variable is nil and if it is maybe simply setting it to 0 before the string format.

Then there is a third error, stemming from your calls to raiseDirtyFlags().
This error is simply caused by the fact that you are passing the raiseDirtyFlag() function a variable (self.levitatorSprayerFlag) that was never defined or initialized and therefore attempting to do so results in nil being passed. It appears that this is likely just a typo, as the variable self.LevitatorSprayer.levitatorSprayerFlag is defined in your onLoad() function.
Keep in mind that this same mistake exists in three different locations in your script and needs to be fixed in all three.

I think that covers all the errors in this log file (apart from some issue with your inputBinding xml file, but thats completely unrelated to any mods).
I found other script here in giants forum from author zip, he fixed this errors!

Code: Select all

--[[
/*******************************************************************************\
*                                                                               *
* LevitatorSprayer.lua                                                                 *
*                                                                               *
*********************************************************************************
* Licensed under the MIT or X11 License                                         *
*                                                                               *
* Copyright (c) 2016 Eisbearg                                                   *
*                                                                               *
* Permission is hereby granted, free of charge, to any person obtaining a copy  *
* of this software and associated documentation files (the "Software"), to deal *
* in the Software without restriction, including without limitation the rights  *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell     *
* copies of the Software, and to permit persons to whom the Software is         *
* furnished to do so, subject to the following conditions:                      *
*                                                                               *
* The above copyright notice and this permission notice shall be included in    *
* all copies or substantial portions of the Software.                           *
*                                                                               *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR    *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,      *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER        *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN     *
* THE SOFTWARE.                                                                 *
\*******************************************************************************/
--]]
-- Edit FS17: werik, Silak_68
--28.05.17 network edition by igor29381
--Edit port to FS19: Zippyo v0.99b


LevitatorSprayer = {};

LevitatorSprayer._NAME			= "LevitatorSprayer"
LevitatorSprayer.title = "FS19 LEV";
LevitatorSprayer.author = "zip";
LevitatorSprayer.modDirectory  = g_currentModDirectory;

function LevitatorSprayer.prerequisitesPresent(specializations)
	return true;
	end;

function LevitatorSprayer.registerFunctions(vehicleType)
    SpecializationUtil.registerFunction(vehicleType, "mouseEvent", LevitatorSprayer.mouseEvent)
    SpecializationUtil.registerFunction(vehicleType, "keyEvent", LevitatorSprayer.keyEvent)
    SpecializationUtil.registerFunction(vehicleType, "activateFlightMode", LevitatorSprayer.activateFlightMode)
    SpecializationUtil.registerFunction(vehicleType, "deactivateFlightMode", LevitatorSprayer.deactivateFlightMode)
    SpecializationUtil.registerFunction(vehicleType, "toggleLevitatorSprayer", LevitatorSprayer.toggleLevitatorSprayer)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree", LevitatorSprayer.getMorldDirectionDegree)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree2", LevitatorSprayer.getMorldDirectionDegree2)
    SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree3", LevitatorSprayer.getMorldDirectionDegree3)
    SpecializationUtil.registerFunction(vehicleType, "getAltitude", LevitatorSprayer.getAltitude)
    SpecializationUtil.registerFunction(vehicleType, "getTailForce", LevitatorSprayer.getTailForce)
    SpecializationUtil.registerFunction(vehicleType, "updateMovement", LevitatorSprayer.updateMovement)
  --SpecializationUtil.registerFunction(vehicleType, "saveToXMLFile", LevitatorSprayer.saveToXMLFile)
end;

function LevitatorSprayer.registerEventListeners(vehicleType)
	for _, functionName in pairs( { "onLoad", "onPostLoad", "onUpdate", "onUpdateTick", "onDraw", "saveToXMLFile" } ) do
		SpecializationUtil.registerEventListener(vehicleType, functionName, LevitatorSprayer);
	end;
end;

function LevitatorSprayer:onLoad(savegame)
    self.isSelectable = true;
    self.toggleLevitatorSprayer = SpecializationUtil.callSpecializationsFunction("toggleLevitatorSprayer");
	self.LevitatorSprayer = {};

    local name = getXMLString(self.xmlFile, "vehicle.storeData.name");
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.en"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.de"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.es"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.fr"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.pt"); end;
    if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.ru"); end;
    if name == nil then name = "UnknownVehicle"; end;

    self.LevitatorSprayer.id = LevitatorSprayer._NAME;
    self.LevitatorSprayer.name = name;
    self.LevitatorSprayer.move = false;
    self.LevitatorSprayer.active = false;
    self.LevitatorSprayer.downForce = 0;
    self.LevitatorSprayer.yForce = 0;
    self.LevitatorSprayer.pitch = 0;
    self.LevitatorSprayer.sendPitch = 0;
    self.LevitatorSprayer.startTimer = 0;
    self.LevitatorSprayer.levitatorSprayerFlag = self:getNextDirtyFlag();
    self.LevitatorSprayer.lastDigitalSide = 0;
	self.workAreaPositions = {};
	local lworkAreas = self.spec_workArea.workAreas[1]
	for k,c in pairs (self.spec_workArea) do
       local xs,ys,zs = getWorldTranslation(lworkAreas.start);
       local xw,yw,zw = getWorldTranslation(lworkAreas.width);
       local xh,yh,zh = getWorldTranslation(lworkAreas.height);
       local cap = {};
       cap.start = {xs,ys,zs};
       cap.width = {xw,yw,zw};
       cap.height = {xh,yh,zh};
       table.insert(self.workAreaPositions, cap);
   end;

      self.pipeGrainParticleSystem = {};
--    self.pipeGrainParticleSystemindex = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem#index"));
--    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem, "vehicle.pipeGrainParticleSystem", self.pipeGrainParticleSystemindex, false, nil, self.baseDirectory);
--    self.pipeGrainParticleSystem2 = {};
--    self.pipeGrainParticleSystem2index = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem2#index"));
--    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem2, "vehicle.pipeGrainParticleSystem2", self.pipeGrainParticleSystem2index, false, nil, self.baseDirectory);
	print("Load mod: '"..LevitatorSprayer.title.."' by: '"..LevitatorSprayer.author.."' loaded sucessfully.");
end;

function LevitatorSprayer:onDelete()
--    Utils.deleteParticleSystem(self.pipeGrainParticleSystem);
--    Utils.deleteParticleSystem(self.pipeGrainParticleSystem2);
end;

function LevitatorSprayer:mouseEvent(posX, posY, isDown, isUp, button)
end;

function LevitatorSprayer:keyEvent(unicode, sym, modifier, isDown)
end;

function LevitatorSprayer:activateFlightMode()
	local component = self.components[1]
    local massresult = self:getTotalMass(true)
		setLinearDamping(component.node, 0.15);
		setAngularDamping(component.node, 0.01);
		self.LevitatorSprayer.downForce = massresult * -9.81; 
        self.massresult = massresult *1000;
		self.yForce = self.LevitatorSprayer.downForce * -5;
--    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
--    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
end;

function LevitatorSprayer:deactivateFlightMode()
	local component = self.components[1]
		setLinearDamping(component.node, 0.0); 
		setAngularDamping(component.node, 0.01);
		self.LevitatorSprayer.downForce = self:getTotalMass(true) * -9.81;
		self.yForce = 0;
--    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
--    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
end;

function LevitatorSprayer:onPostLoad(savegame)
--[[
]]
end;

function LevitatorSprayer:onUpdate(dt, isActiveForInput, isActiveForInputIgnoreSelection, isSelected)
    local massresult = (self:getTotalMass(false)) * 1000
        self.massresult = massresult

    local component = self.components[1]
    local altAboveGround, altAboveNN = self.getAltitude(component.node); 
	
    if self.getIsMotorStarted and altAboveGround < 4 then
--        Utils.setEmittingState(self.pipeGrainParticleSystem, true);
    else
--        Utils.setEmittingState(self.pipeGrainParticleSystem, false);
    end;
    if self.getIsMotorStarted and altAboveGround < 9 then
--        Utils.setEmittingState(self.pipeGrainParticleSystem2, true);
    else
--        Utils.setEmittingState(self.pipeGrainParticleSystem2, false);
    end;

    if self.spec_motorized.isMotorStarted and self.spec_enterable.isEntered then
        if not self.LevitatorSprayer.active then
            self.LevitatorSprayer.startTimer = self.LevitatorSprayer.startTimer + dt;
            if self.LevitatorSprayer.startTimer > 18000 then
                LevitatorSprayer.activateFlightMode(self);
                self.LevitatorSprayer.active = true;
                self.wiper = true;
                self.LevitatorSprayer.startTimer = 0;
            end;
        end;
    elseif self.LevitatorSprayer.active then
        LevitatorSprayer.deactivateFlightMode(self);
        self.LevitatorSprayer.active = false;
        self.wiper = false;
    end;
    if not self.LevitatorSprayer.active then return end; 
local collectiveup = getInputAxis(10, 0);
local collectivedown = getInputAxis(11, 0);
local gamepads = getNumOfGamepads();
self.normalizedCollectiveUp = (collectiveup - (-1)) / (1 - (-1));
self.normalizedCollectiveDown = (collectivedown - (-1)) / (1 - (-1));
LevitatorSprayer.updateMovement(self, dt);
    if self.isActive and isActiveForInput and gamepads>0 then
if collectiveup <= 1 or collectivedown <= 1 then
            if collectiveup < 1 then
                self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 1/self.normalizedCollectiveUp/4, self.LevitatorSprayer.downForce * -0.85);
            end;
            if collectivedown < 1 then
                self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 1/self.normalizedCollectiveDown/4, -25.02);
            end;
        end;
if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT) or Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
            if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT)then
                self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 2, self.LevitatorSprayer.downForce * -0.85);
            end;
            if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
                self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 2, -25.02); 
            end;
       elseif self.LevitatorSprayer.pitch ~= 0 then
if collectiveup == 1 and collectivedown == 1 then 
              self.LevitatorSprayer.pitch = 0;
           end; 
        end;
	end;
        if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
            if not g_server then
                self:raiseDirtyFlags(self.levitatorSprayerFlag);
            end;
            self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
        end;
        if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
            if not g_server then
                self:raiseDirtyFlags(self.levitatorSprayerFlag);
            end;
            self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
        end;
    if self.isServer then
        local dX,dY,dZ = localDirectionToWorld(component.node, 1, 0, 0);
        local sinDir = dX / 15;
        local cosDir = dZ / -15;
        self.sd = 307;
        if self.spec_motorized.getIsMotorStarted then
            self.sd = 250;
        end;
        local zSteer = self.sd * self.spec_drivable.axisForward;
        local xForce = zSteer * cosDir;
        local zForce = zSteer * sinDir;
        if self.spec_drivable.axisForward == 1 or self.spec_drivable.axisForward == -1 or self.spec_drivable.lastDigitalForward == 1 or self.spec_drivable.lastDigitalForward == -1  then
            dg = 0.01;
        else
            dg = 3; 
        end;
        local component = self.components[1]
                self.LevitatorSprayer.yForce = (self.LevitatorSprayer.pitch + self.LevitatorSprayer.downForce * -0.8422);
                addForce(component.node, xForce, self.LevitatorSprayer.yForce,  zForce, 0, dg, 0, true); 
        local yTurnSpeed = 0;
        if self.spec_drivable.axisSide > 0.1 or self.spec_drivable.axisSide < -0.1 or self.spec_drivable.lastDigitalSide > 0.1 or self.spec_drivable.lastDigitalSide < -0.1  then
            if InputBinding.getIsAnalogInput then
                yTurnSpeed = self.spec_drivable.axisSide * -0.95;
            else
                yTurnSpeed = self.spec_drivable.lastDigitalSide * -0.95;
            end;
        end;

        local AVx, AVy, AVz = getAngularVelocity(component.node);
        if yTurnSpeed == 0 then
           yTurnSpeed = AVy * 0.85;
        end;
        setAngularVelocity(component.node, AVx * 0.75, yTurnSpeed, AVz * 0.75);
        self.yLV = getLinearVelocity(component.node);
        if self.getIsActive and self.getIsTurnedOn then
            local altAboveGround = self.getAltitude(component.node);
            local addw = altAboveGround*6.5;
            local addh = altAboveGround/5;
            local addz = (altAboveGround/2) + (self.lastSpeed * 3850/50);
local lworkAreas = self.spec_workArea.workAreas[1]
            for c=1, table.getn(lworkAreas) do
                local cp = self.workAreaPositions[c];
                local ca = lworkAreas[c];
                setTranslation(ca.start ,  cp.start[1]+ (cp.start[1] *addw/100) , cp.start[2]  , cp.start[3]- addz);
                setTranslation(ca.width ,  cp.width[1]+ (cp.width[1] *addw/100) , cp.width[2]  , cp.width[3]- addz);
                if altAboveGround > 50 then
                    setTranslation(ca.height , cp.start[1]+(cp.start[1]*addw/100) , cp.start[2] , cp.start[3] - addz);
                else
                    setTranslation(ca.height , cp.height[1]+(cp.height[1]*addw/100) , cp.height[2] , cp.height[3]-addz-addh);
                end;
            end;
        end;
    end;
end;

function LevitatorSprayer:onUpdateTick(dt)
end;

function LevitatorSprayer:saveToXMLFile(xmlFile, key)
--[[ key includes the name of the script
]]
end;

function LevitatorSprayer:onDraw()
    local component = self.components[1]
    local text = g_i18n.modEnvironments.Ka26.texts.move --just digging...should b fetched from XML as :getText("move")
    local LVx, LVy, LVz = getLinearVelocity(component.node);
    if self.spec_enterable.getIsEntered then

        setTextAlignment(RenderText.ALIGN_CENTER);
        setTextColor(1,1,1,1);
        if self.LevitatorSprayer.active then
            renderText(0.17, 0.29, 0.016, text);
            renderText(0.17, 0.36, 0.025, string.format("V S I=" .. " %4.2f m/s", LVy));
            local altAboveGround, altAboveNN = self.getAltitude(component.node);
          --renderText(0.17, 0.33, 0.025, string.format(g_i18n.modEnvironments.Ka26.texts.ground .. " %4.2f m", altAboveGround));
            renderText(0.17, 0.33, 0.025, string.format("A G L=" .. " %4.2f m", altAboveGround));
            renderText(0.17, 0.26, 0.016, string.format("BLADE PITCH" .. " %3.4f ", self.LevitatorSprayer.pitch));
            renderText(0.17, 0.24, 0.016, string.format("pretend G Downforce" .. " %4.2f m/s", self.LevitatorSprayer.downForce));
            renderText(0.17, 0.22, 0.016, string.format("LevitatorFORCE" .. " %4.2f m/s", self.LevitatorSprayer.yForce));
            renderText(0.17, 0.20, 0.016, string.format("MASS" .. " %4.2f kg", self.massresult));
            setTextBold(false);
        end;

        setTextAlignment(RenderText.ALIGN_LEFT);
        setTextColor(1,1,1,1);
    end;
--            local altAboveGround = self.getAltitude(component.node);
--        if self.isActive and altAboveGround > 50 then
--        g_currentMission:showBlinkingWarning(g_i18n.modEnvironments.Ka26.texts.helpGrid, 600);
--    end;
end;
function LevitatorSprayer:toggleLevitatorSprayer(state, nes)
end;

function LevitatorSprayer:readStream(streamId, connection)
end;

function LevitatorSprayer:writeStream(streamId, connection)
end;

function LevitatorSprayer:getMorldDirectionDegree(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(sinus, cosinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getMorldDirectionDegree2(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(cosinus, sinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getMorldDirectionDegree3(rootNode)
    local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, -1);
    local sinus = dX / 1;
    local cosinus = dZ / 1;
    local direction = math.deg(math.atan2(cosinus, sinus));
    return direction, sinus, cosinus;
end;

function LevitatorSprayer:getAltitude(rootNode)
    local terrainHeight = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, getWorldTranslation(self));
    local x, altAboveNN = getWorldTranslation(self);
    local altAboveGround = altAboveNN - terrainHeight;
    if altAboveGround < 0 then altAboveGround = 0.0 end; 
    return altAboveGround, altAboveNN, terrainHeight;
end;

function LevitatorSprayer:getTailForce(rootNode, xSteer)
        local dX,dY,dZ = localDirectionToWorld(self, 0, 0, -1);
        local sinDir = dX / 1;
        local cosDir = dZ / 1;
        local xBackward = 10 * sinDir;
        local zBackward = 10 * cosDir;

        dX,dY,dZ = localDirectionToWorld(rootNode, 1, 0, 0);
        sinDir = dX / 1;
        cosDir = dZ / 1;
        local xTurnForce = xSteer * sinDir;
        local zTurnForce = xSteer * cosDir;

    return xTurnForce, 0, zTurnForce, xBackward, 0.6, zBackward
end;

function LevitatorSprayer:updateMovement(dt)
self.axisSideIsAnalog = InputBinding.getIsAnalogInput
self.axisForwardIsAnalog = InputBinding.getIsAnalogInput
		if not self.getIsEntered then return; end
		local axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate                 
		local axisBrake = self.spec_drivable.lastInputValues.axisBrake
		local axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
		
		if InputBinding.isAxisZero(axisForward) then
			axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate
			axisBrake = self.spec_drivable.lastInputValues.axisBrake
			self.axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
fetch = self.axisForward
        if not InputBinding.isAxisZero(self.axisForward) then
            self.axisForwardIsAnalog = true;
        end
        self.lastDigitalForward = 0;
    end
    self.axisSide = self.spec_drivable.lastInputValues.axisSide
    if InputBinding.isAxisZero(self.axisSide) then
        self.axisSide = self.spec_drivable.lastInputValues.axisSide
        if not InputBinding.isAxisZero(self.axisSide) then
            self.axisSideIsAnalog = true;
        end
        self.lastDigitalSide = 0;
    else
        self.axisSide = MathUtil.clamp(self.lastDigitalSide + dt/self.axisSmoothTime*self.axisSide, -1, 1);
        self.axisSideIsAnalog = false;
        self.lastDigitalSide = self.axisSide;
    end;

     if not self.getIsActiveForInput then
        if not self.axisSideIsAnalog then
            self.axisSide = 0;
        end
        if not self.axisForwardIsAnalog then
            self.axisForward = 0;
        end
    end;
    if not g_server then
        self:raiseDirtyFlags(self.levitatorSprayerFlag);
    end;
end;
After changing the script and resolving all the errors in singleplayer/local multiplayer, when I put it on a dedicated server it presents the following errors in the script, could you help me again XP?
In local multiplayer, only the host can fly, when it is a dedicated server, no one can make a bug and it presents the aforementioned errors (draw - all images of speed and button visualization by the script are bugged)

Code: Select all

2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitOR': Argument 2 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/network/Object.lua (171) : bitOR
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (420) : raiseDirtyFlags
  =C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua (191) : updateMovement
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1912) : raiseEvent
  dataS/scripts/network/NetworkNode.lua (163) : update
  dataS/scripts/network/Client.lua (86) : updateActiveObjects
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Error: Running LUA method 'draw'.
C:/Users/danil/Documents/My Games/FarmingSimulator2022/mods/FS22_AT_602_BR/scripts/fs19LevitatorSprayer.lua:304: bad argument #2 to 'format' (number expected, got nil)
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Motorized.lua (778) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
2023-11-29 20:56 Warning (script): 'bitAND': Argument 1 has wrong type. Expected: UInt. Actual: Nil 
2023-11-29 20:56   2023-11-29 20:56 D:\auto_builder\cache\svn\0fe094cb2d0ec4b784b781920968bc31\src\base\scripting\lua\LuaScriptSystem.cpp (903)2023-11-29 20:56 : 2023-11-29 20:56 expectedType == Value::VoidType || expectedType == Value::ClassType
2023-11-29 20:56 LUA call stack:
  dataS/scripts/vehicles/specializations/Drivable.lua (382) : bitAND
  dataS/scripts/specialization/SpecializationUtil.lua (23)
  dataS/scripts/vehicles/Vehicle.lua (1774) : raiseEvent
  dataS/scripts/network/Client.lua (138) : writeUpdateStream
  dataS/scripts/BaseMission.lua (1151) : update
  dataS/scripts/FSBaseMission.lua (1983) : update
  dataS/scripts/missions/mission00.lua (577) : update
  dataS/scripts/main.lua (1289) : update
XPModder
Posts: 76
Joined: Thu Oct 30, 2014 2:45 pm

Re: FS19 converted script error LUA call stack

Post by XPModder »

Ok, I will just go with the errors in your latest post here for now.
Are you using the old script or this new script now?

1. The new script you posted still has the error in the raiseDirtyFlags() calls. As you correctly did before, you need to replace self.levitatorSprayerFlag with self.LevitatorSprayer.levitatorSprayerFlag in all places where it can be found.

2. There is still an error related to string formatting. In the old script this lines up with the same place as before, where LVy is passed to string.format().
Here you dont want to insert anything into the string.format() call itself. Leave that as it is. But a few lines above this LVy is defined as one of the return values of a function (local LVx, LVy, LVz = getLinearVelocity(component.node)). Somewhere underneath that line and above the string.format() line, add this:

Code: Select all

if LVy == nil then
	LVy = 0
end
This checks if LVy is nil and if it is, sets it to 0. This ensures that LVy always contains a value when string.format() is trying to read it.

Since the error caused by the string.format() is in the onDraw() function, this will mess up the UI, because the moment it hits the error it stops drawing stuff. Everything that would have been drawn later will never be drawn and therefore the UI will look all messed up. But that also means that fixing this one error, unless there end up being more errors later down the line, will likely fix the entire UI.

Fix these two things and try it again.
Das Universum ist unvorstellbar groß und wir sind im Vergleich dazu winzig.

Daher kann mir jemand der unter uns Winzlingen Unterschiede in Hautfarbe oder Herkunft sucht, nur Leid tun, weil seine Sichtweise so begrenzt ist!

Fremdenfeindlichkeit ist Menschenfeindlichkeit!
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

XPModder wrote: Thu Nov 30, 2023 11:24 am Ok, I will just go with the errors in your latest post here for now.
Are you using the old script or this new script now?

1. The new script you posted still has the error in the raiseDirtyFlags() calls. As you correctly did before, you need to replace self.levitatorSprayerFlag with self.LevitatorSprayer.levitatorSprayerFlag in all places where it can be found.

2. There is still an error related to string formatting. In the old script this lines up with the same place as before, where LVy is passed to string.format().
Here you dont want to insert anything into the string.format() call itself. Leave that as it is. But a few lines above this LVy is defined as one of the return values of a function (local LVx, LVy, LVz = getLinearVelocity(component.node)). Somewhere underneath that line and above the string.format() line, add this:

Code: Select all

if LVy == nil then
	LVy = 0
end
This checks if LVy is nil and if it is, sets it to 0. This ensures that LVy always contains a value when string.format() is trying to read it.

Since the error caused by the string.format() is in the onDraw() function, this will mess up the UI, because the moment it hits the error it stops drawing stuff. Everything that would have been drawn later will never be drawn and therefore the UI will look all messed up. But that also means that fixing this one error, unless there end up being more errors later down the line, will likely fix the entire UI.

Fix these two things and try it again.
Thanks! fixed all the errors, now even in multiplayer there is no LUA error, however, the mod does not work on a dedicated server, the plane should take off with the script pressing the controls, but it only shows the information (if I walk normally the same a tractor, the speed information does not change, it is reset to zero in the speed graph created), would it be necessary to create a specific part for dedicated servers? Even local multiplayer only works for those who created the match.
XPModder
Posts: 76
Joined: Thu Oct 30, 2014 2:45 pm

Re: FS19 converted script error LUA call stack

Post by XPModder »

Good to hear that its error free now!

As for the multiplayer problem: Im not familiar enough with that part of FS and dont know the client/server architecture, but it sounds like the relevant information is not correctly or not at all synchronised between client and server. As I said, Im not familiar with the client/server architecture of FS, but I would assume that the server stores all the information about vehicles (location, rotation, speed, fill level, fill type, etc, etc...) and distributes this information to the clients. With that assumption, the clients would have to send their updated information (eg if a vehicle moved) to the server.
Im guessing that there is an issue where the information is simply never sent from client to server.
On Local multiplayer it still works for the one who created the session as their game acts as the server in this case.

As I said, Im not familiar with that part of FS, so I cant really help you with that at the moment. All I can do is to make some edjucated guesses, which I did above...
Das Universum ist unvorstellbar groß und wir sind im Vergleich dazu winzig.

Daher kann mir jemand der unter uns Winzlingen Unterschiede in Hautfarbe oder Herkunft sucht, nur Leid tun, weil seine Sichtweise so begrenzt ist!

Fremdenfeindlichkeit ist Menschenfeindlichkeit!
onlybr
Posts: 24
Joined: Mon Oct 02, 2023 6:06 am

Re: FS19 converted script error LUA call stack

Post by onlybr »

XPModder wrote: Thu Nov 30, 2023 7:21 pm Good to hear that its error free now!

As for the multiplayer problem: Im not familiar enough with that part of FS and dont know the client/server architecture, but it sounds like the relevant information is not correctly or not at all synchronised between client and server. As I said, Im not familiar with the client/server architecture of FS, but I would assume that the server stores all the information about vehicles (location, rotation, speed, fill level, fill type, etc, etc...) and distributes this information to the clients. With that assumption, the clients would have to send their updated information (eg if a vehicle moved) to the server.
Im guessing that there is an issue where the information is simply never sent from client to server.
On Local multiplayer it still works for the one who created the session as their game acts as the server in this case.

As I said, Im not familiar with that part of FS, so I cant really help you with that at the moment. All I can do is to make some edjucated guesses, which I did above...
It has helped a lot, thank you for everything!
Post Reply