Community Forum

Reload lua file without restarting the game

Forum Overview >> Scripting

Created06.07.2009 21:03

Claudio Accotardi (Unknown) 06.07.2009 21:09

I have modified a script file, when the game is running.
In the console I have launched the command reloadAll but nothing was reloaded, the console output is: "Reload all resources with given type", what was my mistake?

Thanks in advance
Best regards

Christian Ammann - GIANTS Software 06.07.2009 21:52
Hi Claudio,

The command reloadAll needs an argument. To reload all scripts you would use this console command: reloadAll SCRIPT

The problem is that this feature is broken in Farming Simulator 2009.


Claudio Accotardi (Unknown) 06.07.2009 21:58

If reloadAll doesn't work is there another solution to reload a script in the game?

Thanks in advance
Best regards

Christian Ammann - GIANTS Software 06.07.2009 23:15
Hi Claudio,

The reload command should work. Use listResources to see what filename you need to reload. Reload needs the full path to the resource file.


Claudio Accotardi (Unknown) 07.07.2009 20:28

I have tried the commnad listResources but not see the filename.
In the script I must to write a special function because the filname to see into the list.
Thanks in advance
Best regards.

Christian Ammann - GIANTS Software 07.07.2009 21:19
Hi Claudio,

listResources is a console command and not a script command.


Claudio Accotardi (Unknown) 07.07.2009 21:28
Best regards

Andrew Asche (Unknown) 06.12.2009 18:02
I've tried using the listResources command from the console in LS09 as well, with no effect. It says "Resource List", followed by a single blank line.

I was able to use reload with negligible success by reloading one of the stock .lua specializations from the dataS archive.. (By the way, why doesn't copyFile work?)

But I haven't been able to reload anything at all from the mods folder.
the getUserProfileAppPath() function does not work from the console, and reload doesn't work from the script, and the path it is in is:
C:/Users/Andrew/Documents/My Games/FarmingSimulator2009/mods/Gregoire_Besson_XXXL/raba_cultivator.lua

It won't accept that path with or without quotes, nor will it take %20 instead of a space, nor will it respond to windows environment variables, and the ~ key I need to shorten the folder name is the same key that opens and closes the console.. o.O I'm going to try to remap it and see if that works.

Anyway, point being, why doesn't listResources work?

Christian Ammann - GIANTS Software 07.12.2009 10:56

We disabled the listResources console command. Because we changed resource loading in the engine and didn't had the time to update the command. We will maybe enable this command again in the future.


Andrew Asche (Unknown) 07.12.2009 22:47
So reloading the .lua file from inside the game is an impossibility at this point?


Christian Ammann - GIANTS Software 08.12.2009 01:04
Hi Andrew,

Reload and reloadAll still work.


Andrew Asche (Unknown) 08.12.2009 18:30
What's the correct way to handle file paths with spaces? Or is there a variable for the mod path that the console accepts?

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