Community Forum

Need complete list of g_currentMission

Forum Overview >> Scripting

CategoryScripting
Created12.11.2016 17:56


Daniel Andersen (dakar2008) 12.11.2016 17:58
Hi There, i need a complete list of all g_currentMission variables so i can make some mods for my game, could you please make a complete API with all variables so it's easier to write mods for this game :)

Samuel H. (modelleicher) 12.11.2016 20:00
Hi,

You can use DebugUtil.printTableRecursively(g_currentMission, -, 0, 1) to print out all variables contained in g_currentMission.. ;)



Gunnar Lesser (Unknown) 18.11.2016 23:07
Hey, I started scripting for LS 17 yesterday and that helps me, thanks a lot.
Is it possible to get a list of the functions too ?
I don´t know how to get all possible functions for some objects or tables.

for example:

g_client:getServerConnection()
g_currentMission:getIsServer()





Tykonket (Unknown) 19.11.2016 13:48
printTableRecursively also prints the functions.


Gunnar Lesser (Unknown) 19.11.2016 14:28
Oh okay thanks.

I see this function call:

"g_currentMission:showBlinkingWarning(text, 2000);"

Now I want to get more information about possible popups and messagewindows with :

"DebugUtil.printTableRecursively(g_currentMission,".",0,5);" // I think maxDeepth 5 give me enough Information

But if I search in the log file for "showBlinkingWarning" i get no result.

Maybe someone can explain that a little bit more how to get all functions ?



Patrick Kirsch (Unknown) 21.11.2016 11:04
Hey,

sorry if this question sound bad but, were do you write this line of code.

what i tried was:

1. created a new mod Folder in my case TestMod
2. created a new xml File modDesc.xml with: author, version, title, description, iconFilename, multiplayer and extraSourceFiles Fields and filled all values... (are here something i missed?) didn't found a list of possible Fields or so...
3.create Lua File Test1.lua
also i think like you, i added only this one line
DebugUtil.printTableRecursively(g_currentMission,".",0,5)
to get more information.

so as i lookked it up in other mods until here all should work fine but i still get an error
when i start a new career/mission
Error: dataS/scripts/utils/DebugUtil.lua:0: bad argument #1 to 'pairs' (table expected, got nil)

If i understood i right the first Parameter should be the table which i want to get the information from?!
so the error says "(table expected, got nil)" but how can it be nil if in all other mods it get used all over the place...

i'm really frustrated at the moment, lua isn't new to me and i spend the last weekend to read/watch all tutorials and API-References here on gdn but still didn't get it to work...

I hope you can help me.

Patrick Kirsch (Unknown) 21.11.2016 11:05
sorry send the Formular twice -.-

Gunnar Lesser (Unknown) 21.11.2016 13:25
Hey Patrick,

you get the error that your lua is not correct so i think that your modDesc.xml is okay. (Because it loads your lua file)

The next step is to get a event when your code have to start.
I don´t know how your lua looks like so let me explain how i do it:

<luacode>

myClass = {};

addModEventListener(myClass);


function myClass:loadMap(name)
DebugUtil.printTableRecursively(g_currentMission,".",0,5)
end;

function myClass:deleteMap()

end;

function myClass:keyEvent(unicode, sym, modifier, isDown)

end;

function myClass:mouseEvent(posX, posY, isDown, isUp, button)

end;

function myClass:update(dt)

end;

function myClass:draw()

end;


</luacode>

All functions you can see are required as default. You can see that on "loadMap" your code will run once and alle what you write down here will be executed when you start your map.

After that you find alle Tables in your Log file.

I hope it works for you :-)
Greetings from germany.



Patrick Kirsch (Unknown) 21.11.2016 14:38
Hey Gunnar,

thanks for your help, now it works and i see the issue i made, sometimes you don't see the easiest thinks... :D

And thanks for the fast answer!

PS: i'm also from Germany, maybe if you want to talk about modding, feel free to contact me in skype

Andre Nierhaus (Dimer24) 21.11.2016 16:56
Hello Patrick

Can you give me my template for a trigger?

With this trigger wants to make small player-free.

But I'm unsure because there are different trigger scripts.

Can you tell me something about these entries

local BarnMoverTrigger_mt = Class(BarnMoverTrigger);
MultiSiloTriggerSetIsFillingEvent_mt = Class(MultiSiloTriggerSetIsFillingEvent, Event);
local MultiSiloTrigger_mt = Class(MultiSiloTrigger, Object);
local BgaTipTrigger_mt = Class(BgaTipTrigger, TipTrigger);
BunkerSiloShovelTrigger_mt = Class(BunkerSiloShovelTrigger, ShovelFillTrigger);

Thank you very much for your efforts.

Greeting Dimer24

Patrick Kirsch (Unknown) 21.11.2016 17:40
Hey Andre,

sry i'm new to the modding for ls17 so i didn't think i can help you out with that, sry.

greetings Patrick


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