Community Forum

Basic Script for Changing Help Menu

Forum Overview >> Scripting

Created27.05.2014 23:46

Ray Kyle (Unknown) 27.05.2014 23:51
I'm new to scriptng and i'm trying to start off with doing something very basic.

I want to add a seperate script to my mods that will only have 1 function - add extra lines of text to the in-game Help Menu (F1) for keybind inputs (ie..extra headlights etc)

My current file:


HUD = {};

function HUD.prerequisitesPresent(specializations)
return true;

function HUD:draw()
g_currentMission:addHelpButtonText(g_i18n:getText("joblight_v"), InputBinding.joblight_v);
g_currentMission:addHelpButtonText(g_i18n:getText("joblight_b"), InputBinding.joblight_b);

That is what I want and it should work but I cannot get it to load in my moddesc.xml, i added:

<specialization name="HUD" className="HUD" filename="scripts/HUD.lua"/>

The correct l10n and input bindings exist aswell, but if I try to add the specializtion under the vehicletypes section, i will get an error saying unknown type so i must be mising something very obvious.

Is it possible to have such a simple script and load it in to any mod?

Thank you in advance

Emil Drefers (Unknown) 28.05.2014 08:34

it should definitly be possible to load such a simple script.

Maybe you could use an other script from a mod as a draft.

-> - the script cablight also has a MP event, which you will very likely want to add sometime to your very own script.

or have a look at this mod:
-> - Wipers.lua also shows the basic body for a lua script.
Maybe your lua is just missing some functions (they do nothing but have to be callable though)

Hope that can help you somehow.


Ray Kyle (Unknown) 28.05.2014 10:58
Thank You Emil, I used the wipers as a template and copied over the empty functions which I did not know had to be there and now it works perfectly.

Much Appreciated.

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