Community Forum

Interconnection between mods

Forum Overview >> Scripting

CategoryScripting
Created30.08.2016 12:44


Denis Solano (Sugurugt) 30.08.2016 12:52
Hello,
how should I do to pass the value of a variable between two separate mods?
In practice the first mod manages the variations of the value, while the second mod always uses the value set in the first mod.
Thanks!
DD ModPassion

Denis Solano (Sugurugt) 02.09.2016 09:18
I created a post to request your assistance and find a expert response.
You can answer kindly my question?
Thank you!
DD ModPassion

Clemens Klug (agp8x) 03.09.2016 23:48
You could set a variable in a reasonable Class, e.g. you could create a field in g_currentMission. This then be written by the first mod, and read by the second

Denis Solano (Sugurugt) 05.09.2016 07:58
Thanks for the reply.
We can't successfully get writing with the first mod and reading with the second mod.

Denis Solano (Sugurugt) 05.09.2016 13:45
None of Giants staff responds to my post?
I found this function: AITractor.invertsMarkerOnTurn
It might help? The function works with only bollean values?
Thanks if anyone will respond to my request.
DD ModPassion

Emil Drefers (Unknown) 06.09.2016 07:31
Hi,

what is wrong with the idea mentioned by "agp8x" ?
That way should work.

AITractor.invertsMarkerOnTurn - has nothing to do with any interconnection between mods. It is used by the AI.

Anyhow, what is your actual goal?
Maybe that would help us to understand what you wanna do.

Cheers,
Emil




Denis Solano (Sugurugt) 06.09.2016 19:20
Hi,
the mods in development are:
- first mod is a sowing machine and it has a workarea, the player can change the workarea in the game.
- second mod is a tank and it is a fertilizer.
The second mod should always use the same workarea of the first mod, when both are attached to the same tractor.

The idea mentioned by "agp8x" is wrong, because the value is assigned to all the second mod (tank) used in the game.

I tried to use the function: AITractor.invertsMarkerOnTurn from example from start customization, since it allows the communication of values between two mod, but doesn't work.

I ask you, what is the best solution?

Thank again.
DD ModPassion

Emil Drefers (Unknown) 07.09.2016 08:09
Hi,

well the nicest approach might be to write a custom script for the sowing machine (kind of an addition).
This custom script can check if a fertilizer tank is attached to the tractor.
If yes, it could run the fertilizing function on the same area which has been used for the sowing machine.

Cheers,
Emil

Denis Solano (Sugurugt) 07.09.2016 20:20
Hi,
ok, thanks.
I proceed as you suggested.
I can use to find the tank, as a starting point from which to make the changes, the function: Sprayer.findAttachedSprayerTank?
Thank you.
DD ModPassion


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