Category | Scripting |
Created | 31.05.2023 17:31 |
Barry Ryerson (bazthehat) | 31.05.2023 17:31 |
---|---|
I really want to get stuck into modding, but the learning curve is impossibly steep. I'm trying to do what should be a really simple first "Hello World" mod, one that displays text. Nothing else. Could be after a keypress, could be just immediately on startup, but it's eluding me entirely. Something as simple as: HelloWorldBlinky = {}; function HellowWorldBlinky:draw() g_currentMission:showBlinkingWarning("Hello World!") end addModEventListener(HelloWorldBlinky); I've set up the modDesc.xml and FS22 sees the mod as installed and I've selected it, yet on loading nothing happens. More annoyingly, Remote Debugger is telling me that it doesn't recognise the globals g_currentMission or addModEventListener. According to the tutorial page on this site, code along the lines of if sym == Input.KEY.Escape and isDown then (do stuff here) end should trigger something on the escape key being pressed, yet it does nothing. I'm sure there are some basic steps I'm missing here, but that's the whole point - I've literally spent hours trying to reverse engineer existing mods and hunt for clues online and I still can't get something as simple as this to work. Please, any help on just how to start the world's simplest mod would be gratefully appreciated. |
M_k Mcd4 (MKMcD) | 02.06.2023 20:05 |
---|---|
Take a look at https://github.com/w33zl/FS22_WeezlsModLib This should help you get started |
Barry Ryerson (bazthehat) | 02.06.2023 21:54 |
---|---|
Thanks, I really appreciate that. Will look into it and see what I can learn. |
David Zadnik (DzInLa) | 03.06.2023 06:47 |
---|---|
One way to learn is find a GIANTS mod that does something close to what you want to do. Then make a copy of the MOD to edit, and make small changes to see how it works in-game. Every GIANTS update, I make a copy of the "Farming Simulator 22/DATA" folder on my D: drive.(I rename DATA to include the update date so I can compare changes from the previous update) <feel free to correct me if I am giving bad advice> |
Barry Ryerson (bazthehat) | 03.06.2023 07:01 |
---|---|
Thanks David. I've been trying that, I'm just finding it utterly bewildering as a newbie. I found possibly the simplest mod out there, one that changes the price of diesel. And the first line of that had me looking at FSBaseMission.loadmap, to which there seems to be no information anywhere on the internet as to how to use it. So, how did that mod developer know how to use it? What else can it do, and why use that instead of any other loadmap function? That's what I find so infurating, the lack of comprehensive information. To be fair, I've learned more about playng FS22 from YouTube than I have from its tutorials or documentation, and I kinda hoped the same would be true for modding. There's a metric ton of info on using Giants Editor and Blender, but lua? Absolute tumbleweed. |
David Zadnik (DzInLa) | 04.06.2023 05:27 |
---|---|
Check this video out: "FS22 Search all xml files for specific code." https://youtu.be/vk0WBf8WreQ |
Bert Bkp (Bkp666) | 14.02.2024 22:21 |
---|---|
Hey, have you made any progress? I too wanted to learn more about modding, scripting specifically, and I downloaded the Giants Studio App (or Remote Debugger) and I'm having the same problem with it as you do, it says it doesn't recognize globals like g_currentMission, g_currentMod, Utils, etc. |
54reddog | 08.03.2024 12:53 |
---|---|
The remote debugger is utter garbage |
Nicola Trombini (Chappie) | 08.06.2024 22:48 |
---|---|
I too have had many problems when starting to script in FS, and even though only a few months have passed I think I learned a lot and already made a couple mods with some non-basic scripts. Some things that helped me out were: 1. Learning LUA up to OOP (duh) 2. Looking at other mods that include scripts on the modhub and trying to emulate by removing all the significant code and instead just printing out things inside the functions to understand when they were called 3. LOOK AT THE GAME'S SOURCE CODE, there are tons of useful functions for each specialization, and even if there isn't a function specifically for what you want to do, you can still look around to see how different things are done in the game |
Steph Vanden (SVDB99) | 22.06.2024 12:36 |
---|---|
So, it's 2024. I still agree with the OP. Everybody concurs that "debugger is utter garbage", the documentation is abysmal, the forum itself is from 1994, and "learning" by copying others without any explanation about what anything does or is for only goes so far. It's remarkable that anyone is able to make any quality mods at all, unless you consider that top modders have been at it for many years... Not everyone has that much time on their hands to get things done. A company who actually cares about it's modding community would provide better tools. (don't gaslight me with "it's a small company blah blah", I've worked for software companies big and small, when there's will there's a way) |
Blake Kerr (Dskywere) | 26.11.2024 00:06 |
---|---|
sure, im bumping a old thread - sue me i agree with @Steph Vanden (SVDB99), very little documentation and hardly any tutorials about lua for Farm sim, even leafing through the game files there isnt much in the way of helpful info, even getting a list of console commands requires editing a xml file then scrolling through the log files for the console output there's 4 mods i'd like to make, and i've spent today downloading random mods, lifting bits of code out and putting in another mod to make a franken-mod with code ranging from FS19 through FS22 and praying to the virtual lua gods it'll run in FS25 and be close to what im after - got 3 of 4 complete that way (not that any would be accepted on ModHub since its a whole mix of other authors work) still not a clue what any of it does exactly and just guessing based on the variables used idk, giving us a quick Example.lua file and commenting what each section does would be fine, atleast we'd know what the layout should be |
Colin Mm (ColinM9991) | 27.11.2024 19:43 |
---|---|
I'm also adding my voice that the documentation is absolutely atrocious. At the moment I'm looking to understand more around the GUI elements and screen names so I can refresh an old mod. I know I need to look at "g_gui.screenControllers" to index the relevant page for owned and rented vehicles which is a tabbed item. Yet there's no documentation that shows what pages can be indexed in the "g_gui.screenControllers" array. Even if I find it I'll have another hell of a time trying to understand how to navigate around tabbed components to hook into an item-changed event for when a player clicks another vehicle. GIANTS - you may be doing a decent job with the game but your attempts to document any of your APIs are awful if you can't even give us a list of global variables as documentation. Short of hacking around with GIANTS Studio to view all global variables, I would definitely appreciate a steer in the right direction from any community members who have worked with the GUI API in Farming Sim. I am a software engineer so I don't expect to have my hand held - happy to simply be pointed in the right direction. |
Olivier Beauchemin (obeauchemin) | 28.11.2024 19:27 |
---|---|
I just finished setting up my dev environment, and the FS25 DataDump mod really helped me. https://github.com/w33zl/FS25_DataDump Combined with this mod from the same modder: https://www.farming-simulator.com/mod.php?mod_id=303447&title=fs2025 You can export data tables to a LUA file and then set up your IDE workspace library to recognize these files. The DataDump output can also be converted into a LUA file to be added to the workspace library. For this task, I simply asked to ChatGPT to create a python converter, very simple. Lastly, here's the repository to convert the scriptBinding.xml to LUA (you should also add it to your workspace library): https://github.com/w33zl/FS25-Script-Binding-Converter I recommend using VSCode. And yeah, the debugger is quite buggy, but it can be really helpful if you understand how it works. This video helped me a lot in understanding it better. It's not perfect, but watching variables and setting breakpoints is a must. The video shows how to start the debugger in a game that's already open, which is very helpful: https://gdn.giants-software.com/videoTutorials2.php?s=7&p=0&c=5&LANGUAGE=en |
Note: Log in to post. Create a new account here.