Community Forum

Where to find list of object attirbutes and methods

Forum Overview >> Scripting

CategoryScripting
Created03.06.2018 15:22


Zoltan Birkas (RickDeckard) 03.06.2018 15:22
Hi

I am looking for ways to get the fill level per fill types, get the maximum capacity per fill type and set the fill level per fill type for husbanderies and storages.

Can someone guide me where I can find a list showing the available attirbutes and methods of different objects?

Thanks,
Deckard

Bilbo Beutlin (BBeutlin) 03.06.2018 20:21
See Documentation -> LUADOC -> Specializations -> Fillable for functions and arguments.
For objects the methods are quite similiar. Examine the appropriate LUAs in Objects, Placeables, Triggers.

Zoltan Birkas (RickDeckard) 06.06.2018 10:56
Hi Bilbo,

Thanks I have done that, but I'm still not sure how to update the fill levels.

I can already get the fill levels and capacities per fill types using formulas like this:
g_currentMission.husbandries.cow:getFillLevel(FillUtil.FILLTYPE_STRAW);
g_currentMission.husbandries.cow:getCapacity(FillUtil.FILLTYPE_STRAW);

So I assumed I can use some of the set methods listed under specialization Fillable, but both the calls to setFillLevel and setUnitFillLevel (which I'd prefer actually) ends with a "Refernce to NIL" error, so it seems they are not available.
g_currentMission.husbandries.cow:setFillLevel(fillLevel, FillUtil.FILLTYPE_STRAW, force, fillInfo);

Do you (or anyone) have any specific hint what I could use for setting the fill levels per Unit or fillType in the husbandries?

Thanks,
Deckard

Bilbo Beutlin (BBeutlin) 06.06.2018 15:12
Be aware, "g_currentMission.husbandries.cow" is merely a link to a table.
It contains further table descriptors like eg. ".cow.tipTriggers" which you must handle as an array.

Zoltan Birkas (RickDeckard) 30.11.2018 11:37
My original question still stands, especially that the game engine is changed for FS19.

Is there a place where or a is there a way how I can see specific object structures (their attributes and methods)? At the moment I'm interested in the husbandries, later I might need more (storages, prices).


Bilbo Beutlin (BBeutlin) 30.11.2018 12:22
Since the FS19 docs aren't available yet, you must examine yourself.
Dump the tables with a self written function or use "DebugUtil.printTableRecursively". See docs here, this should work also in FS19.
Begin with "g_currentMission" - this is still be valid (afaik).

Espen K. (estyx) 30.11.2018 18:35
I've made some data available on github repo:
https://github.com/scfmod/fs19_lua

A work in progress.

Zoltan Birkas (RickDeckard) 01.12.2018 11:38
@Bilbo Beutlin (BBeutlin):
Thanks! I start with that then.
With FS17 I wasn't far from where I wanted to get (I was trying to work on a script that automatically feeds the animals using the goods from the farm storage), I had the different pieces separately I just didn't have the time to work out how to put them together.
But I'm still very novice with scripting, so I'm sure it will be quite difficult to work out just based on debugUtil, an updated section from Giants could still be very helpful in terms of function signatures, so hopefully they will do that soon...

@Espen K. (estyx):
Thanks for the link! It's gonna be a very useful resource.




Ben Sollis (sollisb) 01.12.2018 17:46
@estyx: Superb info, much appreciated!

Has anyone figured out how to get the field info?

Ben Sollis (sollisb) 01.12.2018 17:52
@estyx: Superb info, much appreciated!

Has anyone figured out how to get the field info?

Espen K. (estyx) 01.12.2018 21:34
Glad to help out :)

g_fieldManager.fields


PS: use it after map is loaded

Ben Sollis (sollisb) 02.12.2018 08:29
Thank you Sir! Epic work! I'd offer to help, but I'm a C# man, just learning lua last 2 days.


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