COMMUNITY FORUM

Adding console command not working properly.

Forum Overview >> Farming Simulator 19

CategoryFarming Simulator 19
Created17.09.2020 16:48


Tom Stirnkorb (CR4NKH) 17.09.2020 16:48
Hi there,
I am trying to write a script where i want to use console commands to call different functions.
I tried experimenting a bit but I can't get the console command to call the function.
My little test-script looks like this:

ConsoleTest = {}

function ConsoleTest:testPrint()
print("1")
return "Test"
end

addConsoleCommand("testPrint", "ABC", "testPrint", self)

addModEventListener(ConsoleTest)

I can run the "testPrint" command but it only returns an empty line to the console. Any ideas?

Best regards,
Tom

Bilbo Beutlin (BBeutlin) 17.09.2020 20:26
The 'self' construct is here invalid. Right is:
addConsoleCommand("testPrint", "ABC", "testPrint", ConsoleTest)
1st is the command you type
2nd is the help text
3rd is your function name

You don't need 'addModEventListener()' since there's no event to handle.

Tom Stirnkorb (CR4NKH) 17.09.2020 22:32
Thank you so much!
I looked up the code from other scripts calling the addConsoleCommand() method inside a function, now this makes sense!

Charlie Pinches (Unknown) 17.11.2020 15:19
> I’m on PS4 and just added the factories mod and placed the boards factory. When I go to switch the factory on in the animal dialog box and move a board across to the farm section a notification appears at the bottom of the screen saying
>
> Missing ‘seasons_animalinfo_BOARDS_PRODUCTION’ in l10n_en.xml
>
> Why is this? Also it won’t let me trigger the trailer to unload

Bilbo Beutlin (BBeutlin) 18.11.2020 03:42
1. Your concern has nothing to do with the topic title.
2. This (sub) forum is about modding practice. On console you cannot mod/edit yourself.
3. If you have questions about downloaded mods, ask in the related user forum.
4. This warning "Missing .. in l10n.." means the localization for the mod is not present.


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